From patchwork Mon Mar 8 07:48:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 11505 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 4D27EBD80C for ; Mon, 8 Mar 2021 07:48:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0ADA968A9C; Mon, 8 Mar 2021 08:48:42 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="e+Aj949L"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3625460520 for ; Mon, 8 Mar 2021 08:48:40 +0100 (CET) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 21175E7B; Mon, 8 Mar 2021 08:48:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1615189719; bh=YvnsxGT1vhLUwJcK8YYkLvwKig+nsIT0JR72Iqt7qcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e+Aj949LTQPoEwgP7wytysMuQl82TjDO72EMhpF2n5kt8oX3kN8EkaCUXXe+408mh edRjB1iUmxyiAS3okRVMJtm2+tc+uTT4WeV4sayTejPCqaDlivb9D6T1C/4ImU0PzT 19IrhVTKWQ8BHTHz7pI6tntLnrBY4lMcoQvZJiWU= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 8 Mar 2021 16:48:26 +0900 Message-Id: <20210308074828.13228-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210308074828.13228-1-paul.elder@ideasonboard.com> References: <20210308074828.13228-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/3] utils: ipc: Support custom parameters to init() 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add support to the mojom-based code generator for custom parameters to init(). Remove the parameter type and count validation as well. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- No change in v2 Changes in v1.1 - remove unused variables in the python file --- .../libcamera_templates/module_ipa_proxy.cpp.tmpl | 15 ++++++++++++--- .../libcamera_templates/proxy_functions.tmpl | 13 ------------- utils/ipc/generators/mojom_libcamera_generator.py | 12 +----------- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl index d451fab3..3eb3dced 100644 --- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl +++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl @@ -141,10 +141,19 @@ void {{proxy_name}}::recvMessage(const IPCMessage &data) {{proxy_funcs.func_sig(proxy_name, method, "Thread")}} { -{%- if method.mojom_name == "init" %} - {{proxy_funcs.init_thread_body()}} -{%- elif method.mojom_name == "stop" %} +{%- if method.mojom_name == "stop" %} {{proxy_funcs.stop_thread_body()}} +{%- elif method.mojom_name == "init" %} + {{ method|method_return_value + " _ret = " if method|method_return_value != "void" -}} + ipa_->{{method.mojom_name}}( + {%- for param in method|method_param_names -%} + {{param}}{{- ", " if not loop.last}} + {%- endfor -%} +); + + proxy_.moveToThread(&thread_); + + return {{ "_ret" if method|method_return_value != "void" }}; {%- elif method.mojom_name == "start" %} running_ = true; thread_.start(); diff --git a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl index 40611feb..f2d86b67 100644 --- a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl +++ b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl @@ -19,19 +19,6 @@ ){{" override" if override}} {%- endmacro -%} -{# - # \brief Generate function body for IPA init() function for thread - #} -{%- macro init_thread_body() -%} - int ret = ipa_->init(settings); - if (ret) - return ret; - - proxy_.moveToThread(&thread_); - - return 0; -{%- endmacro -%} - {# # \brief Generate function body for IPA stop() function for thread #} diff --git a/utils/ipc/generators/mojom_libcamera_generator.py b/utils/ipc/generators/mojom_libcamera_generator.py index 438e41c6..fa0c21a2 100644 --- a/utils/ipc/generators/mojom_libcamera_generator.py +++ b/utils/ipc/generators/mojom_libcamera_generator.py @@ -341,19 +341,9 @@ def ValidateInterfaces(interfaces): ValidateSingleLength(f_start, 'start()', False) ValidateSingleLength(f_stop, 'stop()', False) - f_init = f_init[0] - f_start = f_start[0] f_stop = f_stop[0] - # Validate parameters to init() - ValidateSingleLength(f_init.parameters, 'input parameter to init()') - ValidateSingleLength(f_init.response_parameters, 'output parameter from init()') - if f_init.parameters[0].kind.mojom_name != 'IPASettings': - raise Exception('init() must have single IPASettings input parameter') - if f_init.response_parameters[0].kind.spec != 'i32': - raise Exception('init() must have single int32 output parameter') - - # No need to validate start() as it is customizable + # No need to validate init() and start() as they are customizable # Validate parameters to stop() ValidateZeroLength(f_stop.parameters, 'input parameter to stop()') From patchwork Mon Mar 8 07:48:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 11506 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id A05F1BD80C for ; Mon, 8 Mar 2021 07:48:44 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 602F360520; Mon, 8 Mar 2021 08:48:44 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="D0zn2y8i"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9A0EA60106 for ; Mon, 8 Mar 2021 08:48:42 +0100 (CET) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9097010C5; Mon, 8 Mar 2021 08:48:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1615189722; bh=V7wBRWSRHRE1LmT6sXZiXSIfi9FnofByVc+8lMlwdqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D0zn2y8iw8ZsINC0v9x7rW9caApr/7Nc9kkXqIUg/u8YhBzQQkHg0ZctY/CGC3MvA UKm7XmRtH8yWjlAyJOHRCo8hTFTTCQjD0e3k8Uq7/tBxu5SJeMVyd1byb9Kfn4wOO9 U4wBeyHibTuPUgNv9pAtVosY+ynkycuJYQtOF8y0= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 8 Mar 2021 16:48:27 +0900 Message-Id: <20210308074828.13228-3-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210308074828.13228-1-paul.elder@ideasonboard.com> References: <20210308074828.13228-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/3] utils: ipc: Make first output parameter direct return if int32 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" To make it more convenient for synchronous IPA calls to return a status, convert the first output into a direct return if it is an int32. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart Acked-by: Naushir Patuck --- Changes in v2: - cosmetic changes --- .../module_ipa_proxy.cpp.tmpl | 7 ++- .../module_ipa_proxy_worker.cpp.tmpl | 8 ++-- .../libcamera_templates/proxy_functions.tmpl | 4 +- .../generators/mojom_libcamera_generator.py | 45 ++++++++++++------- 4 files changed, 40 insertions(+), 24 deletions(-) diff --git a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl index 3eb3dced..f75b1206 100644 --- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl +++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl @@ -209,7 +209,12 @@ void {{proxy_name}}::recvMessage(const IPCMessage &data) {%- endif %} } {% if method|method_return_value != "void" %} - return IPADataSerializer<{{method.response_parameters|first|name}}>::deserialize(_ipcOutputBuf.data(), 0); + {{method|method_return_value}} _retValue = IPADataSerializer<{{method|method_return_value}}>::deserialize(_ipcOutputBuf.data(), 0); + +{{proxy_funcs.deserialize_call(method|method_param_outputs, '_ipcOutputBuf.data()', '_ipcOutputBuf.fds()', init_offset = method|method_return_value|byte_width|int)}} + + return _retValue; + {% elif method|method_param_outputs|length > 0 %} {{proxy_funcs.deserialize_call(method|method_param_outputs, '_ipcOutputBuf.data()', '_ipcOutputBuf.fds()')}} {% endif -%} diff --git a/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl b/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl index ac037fa1..8a57b6cc 100644 --- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl +++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl @@ -83,15 +83,14 @@ public: {{param|name}} {{param.mojom_name}}; {% endfor %} {%- if method|method_return_value != "void" %} - {{method|method_return_value}} _callRet = ipa_->{{method.mojom_name}}({{method.parameters|params_comma_sep}}); -{%- else %} + {{method|method_return_value}} _callRet = +{%- endif -%} ipa_->{{method.mojom_name}}({{method.parameters|params_comma_sep}} {{- ", " if method|method_param_outputs|params_comma_sep -}} {%- for param in method|method_param_outputs -%} &{{param.mojom_name}}{{", " if not loop.last}} {%- endfor -%} ); -{%- endif %} {% if not method|is_async %} IPCMessage::Header header = { _ipcMessage.header().cmd, _ipcMessage.header().cookie }; IPCMessage _response(header); @@ -100,9 +99,8 @@ public: std::tie(_callRetBuf, std::ignore) = IPADataSerializer<{{method|method_return_value}}>::serialize(_callRet); _response.data().insert(_response.data().end(), _callRetBuf.cbegin(), _callRetBuf.cend()); -{%- else %} - {{proxy_funcs.serialize_call(method|method_param_outputs, "_response.data()", "_response.fds()")|indent(16, true)}} {%- endif %} + {{proxy_funcs.serialize_call(method|method_param_outputs, "_response.data()", "_response.fds()")|indent(16, true)}} int _ret = socket_.send(_response.payload()); if (_ret < 0) { LOG({{proxy_worker_name}}, Error) diff --git a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl index f2d86b67..c2ac42fc 100644 --- a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl +++ b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl @@ -135,8 +135,8 @@ # # \todo Avoid intermediate vectors #} -{%- macro deserialize_call(params, buf, fds, pointer = true, declare = false, iter = false, data_size = '') -%} -{% set ns = namespace(size_offset = 0) %} +{%- macro deserialize_call(params, buf, fds, pointer = true, declare = false, iter = false, data_size = '', init_offset = 0) -%} +{% set ns = namespace(size_offset = init_offset) %} {%- if params|length > 1 %} {%- for param in params %} [[maybe_unused]] const size_t {{param.mojom_name}}BufSize = readPOD({{buf}}, {{ns.size_offset}} diff --git a/utils/ipc/generators/mojom_libcamera_generator.py b/utils/ipc/generators/mojom_libcamera_generator.py index fa0c21a2..db9e28a6 100644 --- a/utils/ipc/generators/mojom_libcamera_generator.py +++ b/utils/ipc/generators/mojom_libcamera_generator.py @@ -149,10 +149,16 @@ def MethodParamInputs(method): return method.parameters def MethodParamOutputs(method): - if (MethodReturnValue(method) != 'void' or - method.response_parameters is None): + if method.response_parameters is None: + return [] + + if MethodReturnValue(method) == 'void': + return method.response_parameters + + if len(method.response_parameters) <= 1: return [] - return method.response_parameters + + return method.response_parameters[1:] def MethodParamsHaveFd(parameters): return len([x for x in parameters if HasFd(x)]) > 0 @@ -167,11 +173,8 @@ def MethodParamNames(method): params = [] for param in method.parameters: params.append(param.mojom_name) - if MethodReturnValue(method) == 'void': - if method.response_parameters is None: - return params - for param in method.response_parameters: - params.append(param.mojom_name) + for param in MethodParamOutputs(method): + params.append(param.mojom_name) return params def MethodParameters(method): @@ -180,18 +183,17 @@ def MethodParameters(method): params.append('const %s %s%s' % (GetNameForElement(param), '&' if not IsPod(param) else '', param.mojom_name)) - if MethodReturnValue(method) == 'void': - if method.response_parameters is None: - return params - for param in method.response_parameters: - params.append(f'{GetNameForElement(param)} *{param.mojom_name}') + for param in MethodParamOutputs(method): + params.append(f'{GetNameForElement(param)} *{param.mojom_name}') return params def MethodReturnValue(method): - if method.response_parameters is None: + if method.response_parameters is None or len(method.response_parameters) == 0: return 'void' - if len(method.response_parameters) == 1 and IsPod(method.response_parameters[0]): - return GetNameForElement(method.response_parameters[0]) + first_output = method.response_parameters[0] + if ((len(method.response_parameters) == 1 and IsPod(first_output)) or + first_output.kind == mojom.INT32): + return GetNameForElement(first_output) return 'void' def IsAsync(method): @@ -237,6 +239,16 @@ def BitWidth(element): return '32' return '' +def ByteWidthFromCppType(t): + key = None + for mojo_type, cpp_type in _kind_to_cpp_type.items(): + if t == cpp_type: + key = mojo_type + if key is None: + raise Exception('invalid type') + return str(int(_bit_widths[key]) // 8) + + # Get the type name for a given element def GetNameForElement(element): # structs @@ -373,6 +385,7 @@ class Generator(generator.Generator): libcamera_filters = { 'all_types': GetAllTypes, 'bit_width': BitWidth, + 'byte_width' : ByteWidthFromCppType, 'cap': Capitalize, 'choose': Choose, 'comma_sep': CommaSep, From patchwork Mon Mar 8 07:48:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 11507 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 08B0CBD80C for ; Mon, 8 Mar 2021 07:48:47 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BB01668A9A; Mon, 8 Mar 2021 08:48:46 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="L1QyMm2u"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AF2CA68A9A for ; Mon, 8 Mar 2021 08:48:44 +0100 (CET) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0C3658A3; Mon, 8 Mar 2021 08:48:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1615189724; bh=PArKrVRk2kdQOHs3K+i4WdSQRmDOoh3tgXWzMwn1Ee0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L1QyMm2uJYTPPHfPK2E3PKKEm4J8xMh4CvRpE+9WaA9NFsfGqp3SCIQmWBEVI6pBI rFRt3dYD8KS3KAzlbYbdT775rIWpEeS166Ra6MFm0mUoEejYj7GH/bTnBiXd4Poz62 zN+AJszr8wko/ipL6eT8iZhdV78F9k2jZ0T7rPbI= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 8 Mar 2021 16:48:28 +0900 Message-Id: <20210308074828.13228-4-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210308074828.13228-1-paul.elder@ideasonboard.com> References: <20210308074828.13228-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 3/3] DEMO: raspberrypi: Use custom parameters to init() 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This is just a demo to show custom parameters to init() with the raspberrypi IPA interface. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- include/libcamera/ipa/raspberrypi.mojom | 5 ++- src/ipa/raspberrypi/raspberrypi.cpp | 44 ++++++++++--------- .../pipeline/raspberrypi/raspberrypi.cpp | 10 +++-- 3 files changed, 32 insertions(+), 27 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index f733a2cd..99a62c02 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -51,7 +51,8 @@ struct StartControls { }; interface IPARPiInterface { - init(IPASettings settings) => (int32 ret); + init(IPASettings settings, string sensorName) + => (int32 ret, bool metadataSupport); start(StartControls controls) => (StartControls result); stop(); @@ -77,7 +78,7 @@ interface IPARPiInterface { map streamConfig, map entityControls, ConfigInput ipaConfig) - => (ConfigOutput results, int32 ret); + => (int32 ret, ConfigOutput results); /** * \fn mapBuffers() diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 6348d071..ac18dcbd 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -79,16 +79,17 @@ public: munmap(lsTable_, ipa::RPi::MaxLsGridSize); } - int init(const IPASettings &settings) override; + int init(const IPASettings &settings, const std::string &sensorName, + bool *metadataSupport) override; void start(const ipa::RPi::StartControls &data, ipa::RPi::StartControls *result) override; void stop() override {} - void configure(const CameraSensorInfo &sensorInfo, - const std::map &streamConfig, - const std::map &entityControls, - const ipa::RPi::ConfigInput &data, - ipa::RPi::ConfigOutput *response, int32_t *ret) override; + int configure(const CameraSensorInfo &sensorInfo, + const std::map &streamConfig, + const std::map &entityControls, + const ipa::RPi::ConfigInput &data, + ipa::RPi::ConfigOutput *response) override; void mapBuffers(const std::vector &buffers) override; void unmapBuffers(const std::vector &ids) override; void signalStatReady(const uint32_t bufferId) override; @@ -164,9 +165,14 @@ private: double maxFrameDuration_; }; -int IPARPi::init(const IPASettings &settings) +int IPARPi::init(const IPASettings &settings, const std::string &sensorName, + bool *metadataSupport) { + LOG(IPARPI, Debug) << "sensor name is " << sensorName; + tuningFile_ = settings.configurationFile; + + *metadataSupport = true; return 0; } @@ -290,16 +296,15 @@ void IPARPi::setMode(const CameraSensorInfo &sensorInfo) mode_.max_frame_length = sensorInfo.maxFrameLength; } -void IPARPi::configure(const CameraSensorInfo &sensorInfo, - [[maybe_unused]] const std::map &streamConfig, - const std::map &entityControls, - const ipa::RPi::ConfigInput &ipaConfig, - ipa::RPi::ConfigOutput *result, int32_t *ret) +int IPARPi::configure(const CameraSensorInfo &sensorInfo, + [[maybe_unused]] const std::map &streamConfig, + const std::map &entityControls, + const ipa::RPi::ConfigInput &ipaConfig, + ipa::RPi::ConfigOutput *result) { if (entityControls.size() != 2) { LOG(IPARPI, Error) << "No ISP or sensor controls found."; - *ret = -1; - return; + return -1; } result->params = 0; @@ -309,14 +314,12 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, if (!validateSensorControls()) { LOG(IPARPI, Error) << "Sensor control validation failed."; - *ret = -1; - return; + return -1; } if (!validateIspControls()) { LOG(IPARPI, Error) << "ISP control validation failed."; - *ret = -1; - return; + return -1; } /* Setup a metadata ControlList to output metadata. */ @@ -334,8 +337,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, if (!helper_) { LOG(IPARPI, Error) << "Could not create camera helper for " << cameraName; - *ret = -1; - return; + return -1; } /* @@ -403,7 +405,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, lastMode_ = mode_; - *ret = 0; + return 0; } void IPARPi::mapBuffers(const std::vector &buffers) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index db91f1b5..3ff0f1cd 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1194,7 +1194,10 @@ int RPiCameraData::loadIPA() IPASettings settings(ipa_->configurationFile(sensor_->model() + ".json")); - return ipa_->init(settings); + bool metadataSupport; + int ret = ipa_->init(settings, "sensor name", &metadataSupport); + LOG(RPI, Debug) << "metadata support " << (metadataSupport ? "yes" : "no"); + return ret; } int RPiCameraData::configureIPA(const CameraConfiguration *config) @@ -1250,9 +1253,8 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) /* Ready the IPA - it must know about the sensor resolution. */ ipa::RPi::ConfigOutput result; - ipa_->configure(sensorInfo_, streamConfig, entityControls, ipaConfig, - &result, &ret); - + ret = ipa_->configure(sensorInfo_, streamConfig, entityControls, ipaConfig, + &result); if (ret < 0) { LOG(RPI, Error) << "IPA configuration failed!"; return -EPIPE;