[{"id":2712,"web_url":"https://patchwork.libcamera.org/comment/2712/","msgid":"<20190928144422.bydte5blzgczpkzi@uno.localdomain>","date":"2019-09-28T14:44:22","subject":"Re: [libcamera-devel] [PATCH] ipa: Allow short-circuiting the\n\tipa_operations","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Sat, Sep 28, 2019 at 07:17:34AM +0300, Laurent Pinchart wrote:\n> When an IPA module is loaded without isolation and implements the\n> IPAInterface internally, going through ipa_operations is a waste of\n> time. Add an operation to retrieve the IPAInterface, and use it directly\n> in the IPAContextWrapper.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  include/ipa/ipa_interface.h                 |  1 +\n>  src/ipa/libipa/ipa_interface_wrapper.cpp    |  8 ++++++++\n>  src/ipa/libipa/ipa_interface_wrapper.h      |  1 +\n>  src/libcamera/include/ipa_context_wrapper.h |  1 +\n>  src/libcamera/ipa_context_wrapper.cpp       |  8 +++++++-\n>  src/libcamera/ipa_interface.cpp             | 15 +++++++++++++++\n>  6 files changed, 33 insertions(+), 1 deletion(-)\n>\n> diff --git a/include/ipa/ipa_interface.h b/include/ipa/ipa_interface.h\n> index a0dfce96fd1c..7c7771b97e30 100644\n> --- a/include/ipa/ipa_interface.h\n> +++ b/include/ipa/ipa_interface.h\n> @@ -18,6 +18,7 @@ struct ipa_context {\n>  struct ipa_operations {\n>  \tvoid (*destroy)(struct ipa_context *ctx);\n>  \tvoid (*init)(struct ipa_context *ctx);\n> +\tvoid *(*get_interface)(struct ipa_context *ctx);\n>  };\n>\n>  #ifdef __cplusplus\n> diff --git a/src/ipa/libipa/ipa_interface_wrapper.cpp b/src/ipa/libipa/ipa_interface_wrapper.cpp\n> index 0a58b5e8f7e1..a39b699ad600 100644\n> --- a/src/ipa/libipa/ipa_interface_wrapper.cpp\n> +++ b/src/ipa/libipa/ipa_interface_wrapper.cpp\n> @@ -68,6 +68,13 @@ void IPAInterfaceWrapper::init(struct ipa_context *_ctx)\n>  \tctx->ipa->init();\n>  }\n>\n> +void *IPAInterfaceWrapper::get_interface(struct ipa_context *_ctx)\n> +{\n> +\tIPAInterfaceWrapper *ctx = static_cast<IPAInterfaceWrapper *>(_ctx);\n> +\n> +\treturn ctx->ipa;\n> +}\n> +\n>  #ifndef __DOXYGEN__\n>  /*\n>   * This construct confuses Doygen and makes it believe that all members of the\n> @@ -76,6 +83,7 @@ void IPAInterfaceWrapper::init(struct ipa_context *_ctx)\n>  const struct ipa_operations IPAInterfaceWrapper::operations = {\n>  \t.destroy = &IPAInterfaceWrapper::destroy,\n>  \t.init = &IPAInterfaceWrapper::init,\n> +\t.get_interface = &IPAInterfaceWrapper::get_interface,\n>  };\n>  #endif\n>\n> diff --git a/src/ipa/libipa/ipa_interface_wrapper.h b/src/ipa/libipa/ipa_interface_wrapper.h\n> index 582d787d27ed..66aa387ac191 100644\n> --- a/src/ipa/libipa/ipa_interface_wrapper.h\n> +++ b/src/ipa/libipa/ipa_interface_wrapper.h\n> @@ -19,6 +19,7 @@ public:\n>  private:\n>  \tstatic void destroy(struct ipa_context *ctx);\n>  \tstatic void init(struct ipa_context *ctx);\n> +\tstatic void *get_interface(struct ipa_context *ctx);\n>\n>  \tstatic const struct ipa_operations operations;\n>\n> diff --git a/src/libcamera/include/ipa_context_wrapper.h b/src/libcamera/include/ipa_context_wrapper.h\n> index 879911e8a566..928781429845 100644\n> --- a/src/libcamera/include/ipa_context_wrapper.h\n> +++ b/src/libcamera/include/ipa_context_wrapper.h\n> @@ -21,6 +21,7 @@ public:\n>\n>  private:\n>  \tstruct ipa_context *ctx_;\n> +\tIPAInterface *intf_;\n>  };\n>\n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/ipa_context_wrapper.cpp b/src/libcamera/ipa_context_wrapper.cpp\n> index bdd3857731ef..edbfea612515 100644\n> --- a/src/libcamera/ipa_context_wrapper.cpp\n> +++ b/src/libcamera/ipa_context_wrapper.cpp\n> @@ -41,6 +41,10 @@ namespace libcamera {\n>  IPAContextWrapper::IPAContextWrapper(struct ipa_context *context)\n>  \t: ctx_(context)\n>  {\n> +\tif (ctx_ && ctx_->ops->get_interface)\n> +\t\tintf_ = reinterpret_cast<IPAInterface *>(ctx_->ops->get_interface(ctx_));\n> +\telse\n> +\t\tintf_ = nullptr;\n>  }\n>\n>  IPAContextWrapper::~IPAContextWrapper()\n> @@ -51,7 +55,9 @@ IPAContextWrapper::~IPAContextWrapper()\n>\n>  int IPAContextWrapper::init()\n>  {\n> -\tif (ctx_)\n> +\tif (intf_)\n> +\t\tintf_->init();\n> +\telse if (ctx_)\n\nI tried thnking of a way to avoid doinig this switch every operation.\nFor init is easy, but intf_->op() and ctx_->ops->ops() will differ in\nthe argument they take, as in the first case we can skip\nserialization, so I see not many ways around this...\n\n>  \t\tctx_->ops->init(ctx_);\n>\n>  \treturn 0;\n> diff --git a/src/libcamera/ipa_interface.cpp b/src/libcamera/ipa_interface.cpp\n> index e95ccecda019..38d284cea114 100644\n> --- a/src/libcamera/ipa_interface.cpp\n> +++ b/src/libcamera/ipa_interface.cpp\n> @@ -40,6 +40,12 @@\n>   * handlers to communicate with IPA modules. IPA modules may use the\n>   * IPAInterface API internally if they want to benefit from the data and helper\n>   * classes offered by libcamera.\n> + *\n> + * When an IPA module is loaded directly into the libcamera process and uses\n> + * the IPAInterface API internally, short-circuiting the path to the\n> + * ipa_operations and back to IPAInterface is desirable. To support this, IPA\n\nand back ?\n\n> + * modules may implement the ipa_operations::get_interface function to return a\n> + * pointer to their internal IPAInterface.\n>   */\n>\n>  /**\n> @@ -80,6 +86,15 @@\n>   *\n>   * \\var ipa_operations::init\n>   * \\brief Initialise the ipa_context\n> + *\n> + * \\var ipa_operations::get_interface\n> + * \\brief Retrieve the IPAInterface implemented by the ipa_context (optional)\n> + *\n> + * IPA modules may implement this operation to expose their internal\n> + * IPAInterface, if any. When implemented, libcamera may at its sole discretion\n> + * call it and then bypass the ipa_operations API by calling the IPAInterface\n> + * methods directly. IPA modules shall still implement and support the full\n\nI would mention we save translating to C APIs. Or maybe it's implied.\n\nIn any case:\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n\n> + * ipa_operations API.\n>   */\n>\n>  namespace libcamera {\n> --\n> Regards,\n>\n> Laurent Pinchart\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net\n\t[217.70.183.201])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E1E2F60BBA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 28 Sep 2019 16:42:41 +0200 (CEST)","from uno.localdomain\n\t(host7-199-dynamic.171-212-r.retail.telecomitalia.it [212.171.199.7])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay8-d.mail.gandi.net (Postfix) with ESMTPSA id E2EA31BF205;\n\tSat, 28 Sep 2019 14:42:40 +0000 (UTC)"],"X-Originating-IP":"212.171.199.7","Date":"Sat, 28 Sep 2019 16:44:22 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190928144422.bydte5blzgczpkzi@uno.localdomain>","References":"<20190928041734.20045-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"tkmshzetszdij4gd\"","Content-Disposition":"inline","In-Reply-To":"<20190928041734.20045-1-laurent.pinchart@ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH] ipa: Allow short-circuiting the\n\tipa_operations","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Sat, 28 Sep 2019 14:42:42 -0000"}},{"id":2713,"web_url":"https://patchwork.libcamera.org/comment/2713/","msgid":"<20190928150828.GA4865@pendragon.ideasonboard.com>","date":"2019-09-28T15:08:28","subject":"Re: [libcamera-devel] [PATCH] ipa: Allow short-circuiting the\n\tipa_operations","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Sat, Sep 28, 2019 at 04:44:22PM +0200, Jacopo Mondi wrote:\n> On Sat, Sep 28, 2019 at 07:17:34AM +0300, Laurent Pinchart wrote:\n> > When an IPA module is loaded without isolation and implements the\n> > IPAInterface internally, going through ipa_operations is a waste of\n> > time. Add an operation to retrieve the IPAInterface, and use it directly\n> > in the IPAContextWrapper.\n> >\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  include/ipa/ipa_interface.h                 |  1 +\n> >  src/ipa/libipa/ipa_interface_wrapper.cpp    |  8 ++++++++\n> >  src/ipa/libipa/ipa_interface_wrapper.h      |  1 +\n> >  src/libcamera/include/ipa_context_wrapper.h |  1 +\n> >  src/libcamera/ipa_context_wrapper.cpp       |  8 +++++++-\n> >  src/libcamera/ipa_interface.cpp             | 15 +++++++++++++++\n> >  6 files changed, 33 insertions(+), 1 deletion(-)\n> >\n> > diff --git a/include/ipa/ipa_interface.h b/include/ipa/ipa_interface.h\n> > index a0dfce96fd1c..7c7771b97e30 100644\n> > --- a/include/ipa/ipa_interface.h\n> > +++ b/include/ipa/ipa_interface.h\n> > @@ -18,6 +18,7 @@ struct ipa_context {\n> >  struct ipa_operations {\n> >  \tvoid (*destroy)(struct ipa_context *ctx);\n> >  \tvoid (*init)(struct ipa_context *ctx);\n> > +\tvoid *(*get_interface)(struct ipa_context *ctx);\n> >  };\n> >\n> >  #ifdef __cplusplus\n> > diff --git a/src/ipa/libipa/ipa_interface_wrapper.cpp b/src/ipa/libipa/ipa_interface_wrapper.cpp\n> > index 0a58b5e8f7e1..a39b699ad600 100644\n> > --- a/src/ipa/libipa/ipa_interface_wrapper.cpp\n> > +++ b/src/ipa/libipa/ipa_interface_wrapper.cpp\n> > @@ -68,6 +68,13 @@ void IPAInterfaceWrapper::init(struct ipa_context *_ctx)\n> >  \tctx->ipa->init();\n> >  }\n> >\n> > +void *IPAInterfaceWrapper::get_interface(struct ipa_context *_ctx)\n> > +{\n> > +\tIPAInterfaceWrapper *ctx = static_cast<IPAInterfaceWrapper *>(_ctx);\n> > +\n> > +\treturn ctx->ipa;\n> > +}\n> > +\n> >  #ifndef __DOXYGEN__\n> >  /*\n> >   * This construct confuses Doygen and makes it believe that all members of the\n> > @@ -76,6 +83,7 @@ void IPAInterfaceWrapper::init(struct ipa_context *_ctx)\n> >  const struct ipa_operations IPAInterfaceWrapper::operations = {\n> >  \t.destroy = &IPAInterfaceWrapper::destroy,\n> >  \t.init = &IPAInterfaceWrapper::init,\n> > +\t.get_interface = &IPAInterfaceWrapper::get_interface,\n> >  };\n> >  #endif\n> >\n> > diff --git a/src/ipa/libipa/ipa_interface_wrapper.h b/src/ipa/libipa/ipa_interface_wrapper.h\n> > index 582d787d27ed..66aa387ac191 100644\n> > --- a/src/ipa/libipa/ipa_interface_wrapper.h\n> > +++ b/src/ipa/libipa/ipa_interface_wrapper.h\n> > @@ -19,6 +19,7 @@ public:\n> >  private:\n> >  \tstatic void destroy(struct ipa_context *ctx);\n> >  \tstatic void init(struct ipa_context *ctx);\n> > +\tstatic void *get_interface(struct ipa_context *ctx);\n> >\n> >  \tstatic const struct ipa_operations operations;\n> >\n> > diff --git a/src/libcamera/include/ipa_context_wrapper.h b/src/libcamera/include/ipa_context_wrapper.h\n> > index 879911e8a566..928781429845 100644\n> > --- a/src/libcamera/include/ipa_context_wrapper.h\n> > +++ b/src/libcamera/include/ipa_context_wrapper.h\n> > @@ -21,6 +21,7 @@ public:\n> >\n> >  private:\n> >  \tstruct ipa_context *ctx_;\n> > +\tIPAInterface *intf_;\n> >  };\n> >\n> >  } /* namespace libcamera */\n> > diff --git a/src/libcamera/ipa_context_wrapper.cpp b/src/libcamera/ipa_context_wrapper.cpp\n> > index bdd3857731ef..edbfea612515 100644\n> > --- a/src/libcamera/ipa_context_wrapper.cpp\n> > +++ b/src/libcamera/ipa_context_wrapper.cpp\n> > @@ -41,6 +41,10 @@ namespace libcamera {\n> >  IPAContextWrapper::IPAContextWrapper(struct ipa_context *context)\n> >  \t: ctx_(context)\n> >  {\n> > +\tif (ctx_ && ctx_->ops->get_interface)\n> > +\t\tintf_ = reinterpret_cast<IPAInterface *>(ctx_->ops->get_interface(ctx_));\n> > +\telse\n> > +\t\tintf_ = nullptr;\n> >  }\n> >\n> >  IPAContextWrapper::~IPAContextWrapper()\n> > @@ -51,7 +55,9 @@ IPAContextWrapper::~IPAContextWrapper()\n> >\n> >  int IPAContextWrapper::init()\n> >  {\n> > -\tif (ctx_)\n> > +\tif (intf_)\n> > +\t\tintf_->init();\n> > +\telse if (ctx_)\n> \n> I tried thnking of a way to avoid doinig this switch every operation.\n> For init is easy, but intf_->op() and ctx_->ops->ops() will differ in\n> the argument they take, as in the first case we can skip\n> serialization, so I see not many ways around this...\n> \n> >  \t\tctx_->ops->init(ctx_);\n> >\n> >  \treturn 0;\n> > diff --git a/src/libcamera/ipa_interface.cpp b/src/libcamera/ipa_interface.cpp\n> > index e95ccecda019..38d284cea114 100644\n> > --- a/src/libcamera/ipa_interface.cpp\n> > +++ b/src/libcamera/ipa_interface.cpp\n> > @@ -40,6 +40,12 @@\n> >   * handlers to communicate with IPA modules. IPA modules may use the\n> >   * IPAInterface API internally if they want to benefit from the data and helper\n> >   * classes offered by libcamera.\n> > + *\n> > + * When an IPA module is loaded directly into the libcamera process and uses\n> > + * the IPAInterface API internally, short-circuiting the path to the\n> > + * ipa_operations and back to IPAInterface is desirable. To support this, IPA\n> \n> and back ?\n\n\"Back\" is for the IPA module side, going from the C API back to the C++ API.\n\n> > + * modules may implement the ipa_operations::get_interface function to return a\n> > + * pointer to their internal IPAInterface.\n> >   */\n> >\n> >  /**\n> > @@ -80,6 +86,15 @@\n> >   *\n> >   * \\var ipa_operations::init\n> >   * \\brief Initialise the ipa_context\n> > + *\n> > + * \\var ipa_operations::get_interface\n> > + * \\brief Retrieve the IPAInterface implemented by the ipa_context (optional)\n> > + *\n> > + * IPA modules may implement this operation to expose their internal\n> > + * IPAInterface, if any. When implemented, libcamera may at its sole discretion\n> > + * call it and then bypass the ipa_operations API by calling the IPAInterface\n> > + * methods directly. IPA modules shall still implement and support the full\n> \n> I would mention we save translating to C APIs. Or maybe it's implied.\n\nI think that's implied by \"bypass the ipa_operations API\".\n\n> In any case:\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> \n> > + * ipa_operations API.\n> >   */\n> >\n> >  namespace libcamera {","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6713E60BBA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 28 Sep 2019 17:08:40 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CE00E53B;\n\tSat, 28 Sep 2019 17:08:39 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1569683320;\n\tbh=oGEME5S9ffCZ62ilGg4uGoIb2Xhw9j0KyklNKCk9CXY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=mfL5L5w7J3bkeb7Uoe8p3DxuaFezCpU01yY4x4o1qdT4F9Wl6d7Ct3CGrjbG31ssR\n\t1HWJbyA2HayX0BzAOMZbELj5jdYJLcKvoPflVYxA6/tBwYM6zS0fbwnp/MLV+2zaGw\n\tTpqftRRLHzccZATsvFbbZVXYAxooFQHf97TCG/To=","Date":"Sat, 28 Sep 2019 18:08:28 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190928150828.GA4865@pendragon.ideasonboard.com>","References":"<20190928041734.20045-1-laurent.pinchart@ideasonboard.com>\n\t<20190928144422.bydte5blzgczpkzi@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190928144422.bydte5blzgczpkzi@uno.localdomain>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] ipa: Allow short-circuiting the\n\tipa_operations","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Sat, 28 Sep 2019 15:08:40 -0000"}},{"id":2767,"web_url":"https://patchwork.libcamera.org/comment/2767/","msgid":"<20191003204211.GV1322@bigcity.dyn.berto.se>","date":"2019-10-03T20:42:11","subject":"Re: [libcamera-devel] [PATCH] ipa: Allow short-circuiting the\n\tipa_operations","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your work.\n\nOn 2019-09-28 07:17:34 +0300, Laurent Pinchart wrote:\n> When an IPA module is loaded without isolation and implements the\n> IPAInterface internally, going through ipa_operations is a waste of\n> time. Add an operation to retrieve the IPAInterface, and use it directly\n> in the IPAContextWrapper.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  include/ipa/ipa_interface.h                 |  1 +\n>  src/ipa/libipa/ipa_interface_wrapper.cpp    |  8 ++++++++\n>  src/ipa/libipa/ipa_interface_wrapper.h      |  1 +\n>  src/libcamera/include/ipa_context_wrapper.h |  1 +\n>  src/libcamera/ipa_context_wrapper.cpp       |  8 +++++++-\n>  src/libcamera/ipa_interface.cpp             | 15 +++++++++++++++\n>  6 files changed, 33 insertions(+), 1 deletion(-)\n> \n> diff --git a/include/ipa/ipa_interface.h b/include/ipa/ipa_interface.h\n> index a0dfce96fd1c..7c7771b97e30 100644\n> --- a/include/ipa/ipa_interface.h\n> +++ b/include/ipa/ipa_interface.h\n> @@ -18,6 +18,7 @@ struct ipa_context {\n>  struct ipa_operations {\n>  \tvoid (*destroy)(struct ipa_context *ctx);\n>  \tvoid (*init)(struct ipa_context *ctx);\n> +\tvoid *(*get_interface)(struct ipa_context *ctx);\n>  };\n>  \n>  #ifdef __cplusplus\n> diff --git a/src/ipa/libipa/ipa_interface_wrapper.cpp b/src/ipa/libipa/ipa_interface_wrapper.cpp\n> index 0a58b5e8f7e1..a39b699ad600 100644\n> --- a/src/ipa/libipa/ipa_interface_wrapper.cpp\n> +++ b/src/ipa/libipa/ipa_interface_wrapper.cpp\n> @@ -68,6 +68,13 @@ void IPAInterfaceWrapper::init(struct ipa_context *_ctx)\n>  \tctx->ipa->init();\n>  }\n>  \n> +void *IPAInterfaceWrapper::get_interface(struct ipa_context *_ctx)\n> +{\n> +\tIPAInterfaceWrapper *ctx = static_cast<IPAInterfaceWrapper *>(_ctx);\n> +\n> +\treturn ctx->ipa;\n> +}\n> +\n>  #ifndef __DOXYGEN__\n>  /*\n>   * This construct confuses Doygen and makes it believe that all members of the\n> @@ -76,6 +83,7 @@ void IPAInterfaceWrapper::init(struct ipa_context *_ctx)\n>  const struct ipa_operations IPAInterfaceWrapper::operations = {\n>  \t.destroy = &IPAInterfaceWrapper::destroy,\n>  \t.init = &IPAInterfaceWrapper::init,\n> +\t.get_interface = &IPAInterfaceWrapper::get_interface,\n>  };\n>  #endif\n>  \n> diff --git a/src/ipa/libipa/ipa_interface_wrapper.h b/src/ipa/libipa/ipa_interface_wrapper.h\n> index 582d787d27ed..66aa387ac191 100644\n> --- a/src/ipa/libipa/ipa_interface_wrapper.h\n> +++ b/src/ipa/libipa/ipa_interface_wrapper.h\n> @@ -19,6 +19,7 @@ public:\n>  private:\n>  \tstatic void destroy(struct ipa_context *ctx);\n>  \tstatic void init(struct ipa_context *ctx);\n> +\tstatic void *get_interface(struct ipa_context *ctx);\n>  \n>  \tstatic const struct ipa_operations operations;\n>  \n> diff --git a/src/libcamera/include/ipa_context_wrapper.h b/src/libcamera/include/ipa_context_wrapper.h\n> index 879911e8a566..928781429845 100644\n> --- a/src/libcamera/include/ipa_context_wrapper.h\n> +++ b/src/libcamera/include/ipa_context_wrapper.h\n> @@ -21,6 +21,7 @@ public:\n>  \n>  private:\n>  \tstruct ipa_context *ctx_;\n> +\tIPAInterface *intf_;\n>  };\n>  \n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/ipa_context_wrapper.cpp b/src/libcamera/ipa_context_wrapper.cpp\n> index bdd3857731ef..edbfea612515 100644\n> --- a/src/libcamera/ipa_context_wrapper.cpp\n> +++ b/src/libcamera/ipa_context_wrapper.cpp\n> @@ -41,6 +41,10 @@ namespace libcamera {\n>  IPAContextWrapper::IPAContextWrapper(struct ipa_context *context)\n>  \t: ctx_(context)\n>  {\n> +\tif (ctx_ && ctx_->ops->get_interface)\n> +\t\tintf_ = reinterpret_cast<IPAInterface *>(ctx_->ops->get_interface(ctx_));\n> +\telse\n> +\t\tintf_ = nullptr;\n>  }\n>  \n>  IPAContextWrapper::~IPAContextWrapper()\n> @@ -51,7 +55,9 @@ IPAContextWrapper::~IPAContextWrapper()\n>  \n>  int IPAContextWrapper::init()\n>  {\n> -\tif (ctx_)\n> +\tif (intf_)\n> +\t\tintf_->init();\n> +\telse if (ctx_)\n>  \t\tctx_->ops->init(ctx_);\n>  \n>  \treturn 0;\n> diff --git a/src/libcamera/ipa_interface.cpp b/src/libcamera/ipa_interface.cpp\n> index e95ccecda019..38d284cea114 100644\n> --- a/src/libcamera/ipa_interface.cpp\n> +++ b/src/libcamera/ipa_interface.cpp\n> @@ -40,6 +40,12 @@\n>   * handlers to communicate with IPA modules. IPA modules may use the\n>   * IPAInterface API internally if they want to benefit from the data and helper\n>   * classes offered by libcamera.\n> + *\n> + * When an IPA module is loaded directly into the libcamera process and uses\n> + * the IPAInterface API internally, short-circuiting the path to the\n> + * ipa_operations and back to IPAInterface is desirable. To support this, IPA\n> + * modules may implement the ipa_operations::get_interface function to return a\n> + * pointer to their internal IPAInterface.\n>   */\n>  \n>  /**\n> @@ -80,6 +86,15 @@\n>   *\n>   * \\var ipa_operations::init\n>   * \\brief Initialise the ipa_context\n> + *\n> + * \\var ipa_operations::get_interface\n> + * \\brief Retrieve the IPAInterface implemented by the ipa_context (optional)\n> + *\n> + * IPA modules may implement this operation to expose their internal\n> + * IPAInterface, if any. When implemented, libcamera may at its sole discretion\n> + * call it and then bypass the ipa_operations API by calling the IPAInterface\n> + * methods directly. IPA modules shall still implement and support the full\n> + * ipa_operations API.\n>   */\n>  \n>  namespace libcamera {\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x243.google.com (mail-lj1-x243.google.com\n\t[IPv6:2a00:1450:4864:20::243])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8A45160BE8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  3 Oct 2019 22:42:13 +0200 (CEST)","by mail-lj1-x243.google.com with SMTP id l21so4251519lje.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 03 Oct 2019 13:42:13 -0700 (PDT)","from localhost (h-93-159.A463.priv.bahnhof.se. [46.59.93.159])\n\tby smtp.gmail.com with ESMTPSA id\n\th2sm765274ljm.26.2019.10.03.13.42.11\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 03 Oct 2019 13:42:11 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=x0cFOI2ARPyYBdPYiCYMVWwtEYfFLmWHgP/Nc0jiokY=;\n\tb=e3d8uVmHVadAYukAOnkXXmB7RcC4FYjCgveNpSHsc6Vw3OHRtJUFvyU0zjeQjPPwUo\n\tBxTtZ5/T6scRJ1qQCAqNcVQCCVQESI/Bsj8DICbdD9s+kxSZ6vgUEI0V8ydkmLGkgz5a\n\tvkUJVwzjOVNCRX4xDdteP6f8CHkhOj0NkNRrEBQxVVGGpUWEbE2XQoNNfQe6ZIbRlzUz\n\t6znWlU3Du956p0lEVOmTLRj+QQw01TjlXfBO/dVcbBhltB8FA+qtIssBT1s1wdZ7PjMp\n\tj9C+pQCcYpFAmy5n2GfWIzqjXq0D8jvKTDNC0V6VDw8gAFE0xImh7rUiVzUe9Ao6DQgu\n\t/f/w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=x0cFOI2ARPyYBdPYiCYMVWwtEYfFLmWHgP/Nc0jiokY=;\n\tb=fRJabxQ27Cs8fNNmptcRmGhm5awiZvisjuQnd2ZI8BoiD3r8zKbTH5VeOm+kQBvkSY\n\tLR1atHK50PEM6OBYVrqUVFbMpGtFmIu0Uq2eZ0bR0hLyUYNS38/vL085uusY2a7JPXWI\n\tCC9mE0FHhxhhML5N/JuGSgR1cytu+b1//pqSX1og/bJ5HRczn00RYo5Sk7GHYnwf1FF9\n\tj8/IcdXhpBDCK1VNhMgIjb3LADbEcBk8er6VtQJZdHa6kxqHhxmpjt1xx8GBc2LmW9Rz\n\tr6IrdvR0Br36M/3UbR8U1nNUOzHT1eY8CDb+ClG9PhUxzUqc0a024xaOiyWDJufD58jY\n\tkMrg==","X-Gm-Message-State":"APjAAAXvYJsle8GVw1O5RGy5wTDXdVDPiaew0/nJzPL61bm3dVByo1yq\n\tN2WQjYPsxKNaxaGj7PzdTnGdEOpfrdQ=","X-Google-Smtp-Source":"APXvYqx7SvsUyanvoYclTBAa6KhDdPWn/XrIbkqU3zNz6Mlb/XsNQ+hb4Bemft5T96uJPazAdMvnxw==","X-Received":"by 2002:a2e:8147:: with SMTP id t7mr7528082ljg.75.1570135332882; \n\tThu, 03 Oct 2019 13:42:12 -0700 (PDT)","Date":"Thu, 3 Oct 2019 22:42:11 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20191003204211.GV1322@bigcity.dyn.berto.se>","References":"<20190928041734.20045-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190928041734.20045-1-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [PATCH] ipa: Allow short-circuiting the\n\tipa_operations","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Thu, 03 Oct 2019 20:42:13 -0000"}}]