From patchwork Fri Oct 25 20:26:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 2222 Return-Path: Received: from relay12.mail.gandi.net (relay12.mail.gandi.net [217.70.178.232]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2AEE061375 for ; Fri, 25 Oct 2019 22:24:30 +0200 (CEST) Received: from uno.localdomain (143.121.2.93.rev.sfr.net [93.2.121.143]) (Authenticated sender: jacopo@jmondi.org) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 9CBF6200007; Fri, 25 Oct 2019 20:24:29 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 25 Oct 2019 22:26:16 +0200 Message-Id: <20191025202616.57177-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] ipa: Allow forcing usage of C API though environment X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 20:24:30 -0000 Parse the 'LIBCAMERA_IPA_FORCE_C_API' environment variable that allows forcing the usage of the IPA C API even if it's possible to short-circuit it through the ipa_context_ops get_interface() operation. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/ipa_context_wrapper.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libcamera/ipa_context_wrapper.cpp b/src/libcamera/ipa_context_wrapper.cpp index 736082e9b068..b178418eb9b8 100644 --- a/src/libcamera/ipa_context_wrapper.cpp +++ b/src/libcamera/ipa_context_wrapper.cpp @@ -9,6 +9,8 @@ #include +#include "utils.h" + /** * \file ipa_context_wrapper.h * \brief Image Processing Algorithm context wrapper @@ -41,7 +43,13 @@ namespace libcamera { IPAContextWrapper::IPAContextWrapper(struct ipa_context *context) : ctx_(context) { - if (ctx_ && ctx_->ops->get_interface) { + int skipIntf = 0; + const char *skipIntfEnv = + utils::secure_getenv("LIBCAMERA_IPA_FORCE_C_API"); + if (skipIntfEnv) + skipIntf = !!atoi(skipIntfEnv); + + if (!skipIntf && ctx_ && ctx_->ops->get_interface) { intf_ = reinterpret_cast(ctx_->ops->get_interface(ctx_)); intf_->queueFrameAction.connect(this, &IPAContextWrapper::queueFrameAction); } else {