From patchwork Wed Mar 24 15:01:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 11695 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com 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 C1D3CC32E5 for ; Wed, 24 Mar 2021 15:01:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1893A602E3; Wed, 24 Mar 2021 16:01:34 +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="WyKf+r6r"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 64AF5602E3 for ; Wed, 24 Mar 2021 16:01:31 +0100 (CET) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BADFE8F3; Wed, 24 Mar 2021 16:01:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1616598091; bh=vQKpfhkgfbyPBUPGapP8weKWmKAw3k6l5cBEmmYLjSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WyKf+r6r1cOKuGrB0R3pjqau6zpBOMuzP6L28L6pHTMEkjlPVvFK9k0GDKzjTHeBe kYmt2MZMkIsxRevhW/A2/3UyEd5iO02Jlet0IiWKiB4HRI2sdmRGmE/3Qgp9QetK63 fMOpaABXfB+YS/qXDs6lR+rzAz4GOYRCWuoKjNMo= From: Kieran Bingham To: libcamera devel Date: Wed, 24 Mar 2021 15:01:20 +0000 Message-Id: <20210324150125.1318325-2-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210324150125.1318325-1-kieran.bingham@ideasonboard.com> References: <20210324150125.1318325-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 1/6] utils: ipc: proxy: Assert asynchronous calls execute in the running state 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" From: Laurent Pinchart Signals and calls from the IPA should not occur after the IPA has been put into the stopped state. Add assertions to catch and prevent any messages being processed after this. Reviewed-by: Niklas Söderlund Reviewed-by: Jacopo Mondi Signed-off-by: Laurent Pinchart Signed-off-by: Kieran Bingham --- .../generators/libcamera_templates/module_ipa_proxy.cpp.tmpl | 2 ++ utils/ipc/generators/libcamera_templates/proxy_functions.tmpl | 4 ++-- 2 files changed, 4 insertions(+), 2 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 f75b1206cad4..e3b541db4e36 100644 --- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl +++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl @@ -173,6 +173,7 @@ void {{proxy_name}}::recvMessage(const IPCMessage &data) {%- endfor -%} ); {% elif method|is_async %} + ASSERT(running_); proxy_.invokeMethod(&ThreadProxy::{{method.mojom_name}}, ConnectionTypeQueued, {%- for param in method|method_param_names -%} {{param}}{{- ", " if not loop.last}} @@ -225,6 +226,7 @@ void {{proxy_name}}::recvMessage(const IPCMessage &data) {% for method in interface_event.methods %} {{proxy_funcs.func_sig(proxy_name, method, "Thread")}} { + ASSERT(running_); {{method.mojom_name}}.emit({{method.parameters|params_comma_sep}}); } diff --git a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl index c2ac42fca45b..13dc8fdcab6e 100644 --- a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl +++ b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl @@ -26,12 +26,12 @@ if (!running_) return; - running_ = false; - proxy_.invokeMethod(&ThreadProxy::stop, ConnectionTypeBlocking); thread_.exit(); thread_.wait(); + + running_ = false; {%- endmacro -%} From patchwork Wed Mar 24 15:01:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 11696 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com 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 716A6C32E5 for ; Wed, 24 Mar 2021 15:01:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F16F468D68; Wed, 24 Mar 2021 16:01:34 +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="DIrws9G+"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CC077602E3 for ; Wed, 24 Mar 2021 16:01:31 +0100 (CET) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 54E02580; Wed, 24 Mar 2021 16:01:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1616598091; bh=k3gnrktnFtKlTIoS3bCPGXMoxEuZ9o1+XOAkKRXQAFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DIrws9G+ODMbA424AA9iLv1QvZJqXzQRDcuGBaulU22fxuFE90mCaR+iVeuotmJ1f KXortHFN0bR4j0ZvZTIwW0NA4lzmUM4bq1ScZKw9Ze8NNOHJev4LAMGwfx3cHFJ0BS dN2DlfB8OnEVAW4w0Tp8T/b+KJAp2RRgNSpk0JEs= From: Kieran Bingham To: libcamera devel Date: Wed, 24 Mar 2021 15:01:21 +0000 Message-Id: <20210324150125.1318325-3-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210324150125.1318325-1-kieran.bingham@ideasonboard.com> References: <20210324150125.1318325-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 2/6] utils: ipc: proxy: Process pending messages 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" From: Laurent Pinchart Events may be queued to the pipeline handler between the pipeline handler entering the ::stop() function, and before the call to stop the IPA has completed. Handle these events by dispatching all pending messages at the proxy after the IPA has fully stopped. Reviewed-by: Jacopo Mondi Signed-off-by: Laurent Pinchart Signed-off-by: Kieran Bingham --- utils/ipc/generators/libcamera_templates/proxy_functions.tmpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl index 13dc8fdcab6e..8addc2fad0a8 100644 --- a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl +++ b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl @@ -31,6 +31,8 @@ thread_.exit(); thread_.wait(); + Thread::current()->dispatchMessages(Message::Type::InvokeMessage); + running_ = false; {%- endmacro -%} From patchwork Wed Mar 24 15:01:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 11697 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com 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 14635C32E5 for ; Wed, 24 Mar 2021 15:01:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C88B968D72; Wed, 24 Mar 2021 16:01:36 +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="jQLWb1EQ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 27BC5602E3 for ; Wed, 24 Mar 2021 16:01:32 +0100 (CET) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B2E37A52; Wed, 24 Mar 2021 16:01:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1616598091; bh=EGb+GuXa1N2wwQFIP+D+xlmADU9XJ/ajKKA/y4GqIJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jQLWb1EQtstcKaYpnjHhWsamSXa9hoCFpBynuih8v18CS/3h98j8KBJIJG4ZRfD3q A9iMlcYAOk2hkEvR7XpF1wFloB22DssIY3D7qb9xVomZN2c6Y2qZv9mrtmraonljpp hxJOYur+xICTsEtnNLcPF9t9XyHXt/FKAoyHsOXw= From: Kieran Bingham To: libcamera devel Date: Wed, 24 Mar 2021 15:01:22 +0000 Message-Id: <20210324150125.1318325-4-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210324150125.1318325-1-kieran.bingham@ideasonboard.com> References: <20210324150125.1318325-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 3/6] libcamera: buffer: Initialise status 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" Buffers queued to a pipeline handler may not be yet queued to a device when the request is cancelled. This can lead to the FrameMetadata having never been explicitly set by an underlying V4L2 device. The status field on this is used to check the state of the buffer to determine if it was correctly filled, or if it was cancelled. In the event that the buffer is not used, it must be marked as Cancelled as the metadata associated with that frame will not be valid. Initialise the FrameMetadata to FrameCancelled to prevent uninitialised access. Furthermore, re-initialise the metadata to this state when the buffers are re-used, or added to a Request to ensure that they are in the correct state in the event that they do not get used at all. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart Reviewed-by: Laurent Pinchart --- v3: - Initialise as FrameCancelled - Re-initialise to FrameCancelled when buffers are re-used - Do not re-order the enum include/libcamera/buffer.h | 2 +- src/libcamera/request.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h index 302fe3d3e86b..f6673e2f6eda 100644 --- a/include/libcamera/buffer.h +++ b/include/libcamera/buffer.h @@ -28,7 +28,7 @@ struct FrameMetadata { unsigned int bytesused; }; - Status status; + Status status = FrameCancelled; unsigned int sequence; uint64_t timestamp; std::vector planes; diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp index 0071667e4a2c..9ea6ed09446b 100644 --- a/src/libcamera/request.cpp +++ b/src/libcamera/request.cpp @@ -118,8 +118,12 @@ void Request::reuse(ReuseFlag flags) pending_.clear(); if (flags & ReuseBuffers) { for (auto pair : bufferMap_) { - pair.second->request_ = this; - pending_.insert(pair.second); + FrameBuffer *buffer = pair.second; + + buffer->metadata_.status = FrameMetadata::Status::FrameCancelled; + buffer->request_ = this; + + pending_.insert(buffer); } } else { bufferMap_.clear(); @@ -188,6 +192,7 @@ int Request::addBuffer(const Stream *stream, FrameBuffer *buffer) } buffer->request_ = this; + buffer->metadata_.status = FrameMetadata::Status::FrameCancelled; pending_.insert(buffer); bufferMap_[stream] = buffer; From patchwork Wed Mar 24 15:01:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 11698 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com 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 92046C32E5 for ; Wed, 24 Mar 2021 15:01:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4852F68D6D; Wed, 24 Mar 2021 16:01:37 +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="pDTQDi5z"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8118E602E3 for ; Wed, 24 Mar 2021 16:01:32 +0100 (CET) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 145928F3; Wed, 24 Mar 2021 16:01:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1616598092; bh=+DxDbIUa9hnNztgGs3b/btCSQklwvSzv9ZM90nyBzsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pDTQDi5zpgg+V9I80WMdtxDDh5WD/jX/rgY1K9793FoEyiQ4G6mndx8rdZ3ZJ5OVC 4TfR0o5GTeYWa8AU2cVNwgYotjuJ9lpsHsDBLRClzhml5Cs43KuPnCI1gVqbItB/oD Lr0YfIuBkdUu+7ZkF3fXsRwlmbIXHx8MjEzyXj/g= From: Kieran Bingham To: libcamera devel Date: Wed, 24 Mar 2021 15:01:23 +0000 Message-Id: <20210324150125.1318325-5-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210324150125.1318325-1-kieran.bingham@ideasonboard.com> References: <20210324150125.1318325-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 4/6] libcamera: pipeline: ipu3: Stop IPA before stopping devices 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" The IPA should be stopped before the hardware devices to ensure that all asynchronous actions have completed within the IPA before resources are removed and released. Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Signed-off-by: Kieran Bingham --- src/libcamera/pipeline/ipu3/ipu3.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index fc40dcb381ea..34ee600340b1 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -764,13 +764,13 @@ void PipelineHandlerIPU3::stop(Camera *camera) IPU3CameraData *data = cameraData(camera); int ret = 0; + data->ipa_->stop(); + ret |= data->imgu_->stop(); ret |= data->cio2_.stop(); if (ret) LOG(IPU3, Warning) << "Failed to stop camera " << camera->id(); - data->ipa_->stop(); - freeBuffers(camera); } From patchwork Wed Mar 24 15:01:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 11699 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com 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 5627DC32E5 for ; Wed, 24 Mar 2021 15:01:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D651368D6C; Wed, 24 Mar 2021 16:01:37 +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="BOFwVej5"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D884F602E3 for ; Wed, 24 Mar 2021 16:01:32 +0100 (CET) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 76655580; Wed, 24 Mar 2021 16:01:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1616598092; bh=15bCuzLW/sYhWEqQ8t+ApQSQwoCz/TNRhi3iGNhUb4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BOFwVej5wfSMcJZqPeTJQlUnY/+nRqifBOdJhCUQbLTDD0K18R9j1VzR9GXyvaizq U7R4FdI75e/unf0mquIvKLco8M4DG4GEsI6zvsH9/2mrLnw4QRmhIs2Dw7jJbsItOX XDMFmWatDH+kF3vXlDIWorksthZCGh/Yht5Vf2Ug= From: Kieran Bingham To: libcamera devel Date: Wed, 24 Mar 2021 15:01:24 +0000 Message-Id: <20210324150125.1318325-6-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210324150125.1318325-1-kieran.bingham@ideasonboard.com> References: <20210324150125.1318325-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 5/6] libcamera: pipeline: ipu3: Do not mark metadata complete early 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" When the imguOutputBufferReady() detects a cancelled frame, it is reporting that the metadata has been processed in order to be able to complete the cancelled request. This causes the FrameInfo to be completed and deleted early, but then an active buffer on the IMGU can complete and be unable to find the FrameInfo for it to complete correctly. Do not mark metadataProcessed early on the event that a single buffer is detected as cancelled. The stopping of the V4L2 devices will ensure that all queued buffers are returned to us and we can follow the normal and expected shutdown sequence. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/ipu3/ipu3.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 34ee600340b1..a8edf906220b 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1232,9 +1232,6 @@ void IPU3CameraData::imguOutputBufferReady(FrameBuffer *buffer) cropRegion_ = request->controls().get(controls::ScalerCrop); request->metadata().set(controls::ScalerCrop, cropRegion_); - if (buffer->metadata().status == FrameMetadata::FrameCancelled) - info->metadataProcessed = true; - if (frameInfos_.tryComplete(info)) pipe_->completeRequest(request); } From patchwork Wed Mar 24 15:01:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 11700 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com 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 94681C32E9 for ; Wed, 24 Mar 2021 15:01:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 52CFA68D75; Wed, 24 Mar 2021 16:01:38 +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="o8zAxJlC"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4C64568D6D for ; Wed, 24 Mar 2021 16:01:33 +0100 (CET) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C61388F3; Wed, 24 Mar 2021 16:01:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1616598092; bh=iUvS2PpgzAjP5fRAdisbJ107L5bPd52IEECPc7Va/+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o8zAxJlCe1A1NDj+h0g3N2zAbztneLBR/8Z4jxk2oISDu8EWpAl2BnpABLbjlKIct agNaijAl/GOQDknz8bdhVCj7ntyKA6a5GrIzs164VxCnOrbSccmYmXeBCdy2ROzkGZ QjcF/vTx/bp+SsGaHjKGoKsEAmnIUF6cS4F6J7Cg= From: Kieran Bingham To: libcamera devel Date: Wed, 24 Mar 2021 15:01:25 +0000 Message-Id: <20210324150125.1318325-7-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210324150125.1318325-1-kieran.bingham@ideasonboard.com> References: <20210324150125.1318325-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 6/6] ipa: ipu3: Do not set controls during configure 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" The configure operation is synchronous and should not send events back to the pipeline handler. If information needs to be returned from configure it should be handled through the interface directly. Move the initial call to setControls() out of configure() and into the start() method which is called after the IPA running_ state is updated. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/ipa/ipu3/ipu3.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index a5c5e029f465..34a907f23ef5 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -32,7 +32,7 @@ public: { return 0; } - int start() override { return 0; } + int start() override; void stop() override {} void configure(const std::map &entityControls, @@ -63,6 +63,13 @@ private: uint32_t maxGain_; }; +int IPAIPU3::start() +{ + setControls(0); + + return 0; +} + void IPAIPU3::configure(const std::map &entityControls, [[maybe_unused]] const Size &bdsOutputSize) { @@ -90,8 +97,6 @@ void IPAIPU3::configure(const std::map &entityControls minGain_ = std::max(itGain->second.min().get(), 1); maxGain_ = itGain->second.max().get(); gain_ = maxGain_; - - setControls(0); } void IPAIPU3::mapBuffers(const std::vector &buffers)