From patchwork Mon Feb 3 10:43:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 22723 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 AA8BAC3260 for ; Mon, 3 Feb 2025 10:43:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 74AA868588; Mon, 3 Feb 2025 11:43:31 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=protonmail.com header.i=@protonmail.com header.b="M5CYYgX/"; dkim-atps=neutral Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7F6036857A for ; Mon, 3 Feb 2025 11:43:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1738579410; x=1738838610; bh=1R1BISHVdqErcyRJD1onzerDZ+4cX2jP6Z5GP/xx5qc=; h=Date:To:From:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=M5CYYgX/JJWK2DYIj2l7La0gGcSJCJp1jWPX4Wfhba+o5y4cPbDaVLMRiCF+LhFgL FDLSCwFf8jVeItp4bRR5dbz0obgZqwfh1QmoVMA0nUAzFBZEirrzqZtXf4iuWzFrh1 hXBXr2k8t8JgXVXQW3EZExoyJeDoetnlT4+X6pDFVjrW1liox0xOuyY0MXK8h0nhPI pgmgh5/73IQelJxbkUUXh25cyT5YqgX40ik6oSOR7hf9sD0flph+UGmnoeMb0bTG7h rzw4sVHd/GQ14nttdSld2F7LGs2i7UtpAUxgn59i+bqbxE7OL4SFozV8WzEBBqm9jI KPv1ZNOvchd8g== Date: Mon, 03 Feb 2025 10:43:24 +0000 To: libcamera-devel@lists.libcamera.org From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Subject: [PATCH v1 1/3] libcamera: pipeline: virtual: Simplify error return Message-ID: <20250203104318.135628-2-pobrn@protonmail.com> In-Reply-To: <20250203104318.135628-1-pobrn@protonmail.com> References: <20250203104318.135628-1-pobrn@protonmail.com> Feedback-ID: 20568564:user:proton X-Pm-Message-ID: 7ad9abafa74da0594e7c9b957f38305ebdf0f529 MIME-Version: 1.0 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" Just return an `std::unique_ptr` constructed from an empty initializer instead of doing a `reset()` on the existing `config` variable and returning that. This is simpler. Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- src/libcamera/pipeline/virtual/virtual.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp index fc46653f6..94c2bd91e 100644 --- a/src/libcamera/pipeline/virtual/virtual.cpp +++ b/src/libcamera/pipeline/virtual/virtual.cpp @@ -232,8 +232,7 @@ PipelineHandlerVirtual::generateConfiguration(Camera *camera, default: LOG(Virtual, Error) << "Requested stream role not supported: " << role; - config.reset(); - return config; + return {}; } std::map> streamFormats; From patchwork Mon Feb 3 10:43:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 22724 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 8E681C3260 for ; Mon, 3 Feb 2025 10:43:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 397AA6858C; Mon, 3 Feb 2025 11:43:37 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=protonmail.com header.i=@protonmail.com header.b="YjFUIG+x"; dkim-atps=neutral Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 42AA26857A for ; Mon, 3 Feb 2025 11:43:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1738579414; x=1738838614; bh=NXTZOwbq7qrLNYlXyivWbbyUZ65fjgU3U3UGXy1aELY=; h=Date:To:From:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=YjFUIG+xJlijAcoookSNtEh0vjo9LOTXe+UzgoInvH9T7D68uEYCfkrVTQU57L8uN nyr1ZLGEHW6MgtVnqin0yfcMapLROftWtR8HKMl94tBJjRA1CeCb3YIy1zBr5BQVQD 6XRkgZwSZrI0Cm+y36TAOUBnQ5dy2Aeltn7M3fytQh08J+ajUyIBWqGbvCIOmtEpTP scoy3I0nL95hp+Jfj6JDWC5VXClS7Z31LtBOrq40yLJTYlujip6G3zl5Llf9bAKlU2 2g+kzG3kIQJl8yDJhXFIhDTKoxzxPjeYT3X5kd1u5DoP5nma46cBVa++MnrBWr5B+F 3W1953OG+K4dw== Date: Mon, 03 Feb 2025 10:43:31 +0000 To: libcamera-devel@lists.libcamera.org From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Subject: [PATCH v1 2/3] libcamera: pipeline: virtual: Fill buffer's metadata Message-ID: <20250203104318.135628-3-pobrn@protonmail.com> In-Reply-To: <20250203104318.135628-1-pobrn@protonmail.com> References: <20250203104318.135628-1-pobrn@protonmail.com> Feedback-ID: 20568564:user:proton X-Pm-Message-ID: 8fa4db268adadcbc9030686ecc36f9350dff7f2e MIME-Version: 1.0 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" Fill the `FrameMetadata` object of the `FrameBuffer`s because it should not be left uninitialized as users expect to be able to access it and find reasonable data there. Bug: https://bugs.libcamera.org/show_bug.cgi?id=245 Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- src/libcamera/pipeline/virtual/virtual.cpp | 18 +++++++++++++++++- src/libcamera/pipeline/virtual/virtual.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp index 94c2bd91e..1a75f35aa 100644 --- a/src/libcamera/pipeline/virtual/virtual.cpp +++ b/src/libcamera/pipeline/virtual/virtual.cpp @@ -286,6 +286,11 @@ int PipelineHandlerVirtual::exportFrameBuffers([[maybe_unused]] Camera *camera, int PipelineHandlerVirtual::start([[maybe_unused]] Camera *camera, [[maybe_unused]] const ControlList *controls) { + VirtualCameraData *data = cameraData(camera); + + for (auto &s : data->streamConfigs_) + s.seq = 0; + return 0; } @@ -297,13 +302,24 @@ int PipelineHandlerVirtual::queueRequestDevice([[maybe_unused]] Camera *camera, Request *request) { VirtualCameraData *data = cameraData(camera); + const auto timestamp = currentTimestamp(); for (auto const &[stream, buffer] : request->buffers()) { bool found = false; /* map buffer and fill test patterns */ for (auto &streamConfig : data->streamConfigs_) { if (stream == &streamConfig.stream) { + FrameMetadata &fmd = buffer->_d()->metadata(); + + fmd.status = FrameMetadata::Status::FrameSuccess; + fmd.sequence = streamConfig.seq++; + fmd.timestamp = timestamp; + + for (const auto [i, p] : utils::enumerate(buffer->planes())) + fmd.planes()[i].bytesused = p.length; + found = true; + if (streamConfig.frameGenerator->generateFrame( stream->configuration().size, buffer)) buffer->_d()->cancel(); @@ -315,7 +331,7 @@ int PipelineHandlerVirtual::queueRequestDevice([[maybe_unused]] Camera *camera, ASSERT(found); } - request->metadata().set(controls::SensorTimestamp, currentTimestamp()); + request->metadata().set(controls::SensorTimestamp, timestamp); completeRequest(request); return 0; diff --git a/src/libcamera/pipeline/virtual/virtual.h b/src/libcamera/pipeline/virtual/virtual.h index 92ad7d4a9..683cb82b4 100644 --- a/src/libcamera/pipeline/virtual/virtual.h +++ b/src/libcamera/pipeline/virtual/virtual.h @@ -37,6 +37,7 @@ public: struct StreamConfig { Stream stream; std::unique_ptr frameGenerator; + unsigned int seq = 0; }; /* The config file is parsed to the Configuration struct */ struct Configuration { From patchwork Mon Feb 3 10:43:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 22725 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 56BDEC3260 for ; Mon, 3 Feb 2025 10:43:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0B5326858E; Mon, 3 Feb 2025 11:43:40 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=protonmail.com header.i=@protonmail.com header.b="Xj7Duvp8"; dkim-atps=neutral Received: from mail-40133.protonmail.ch (mail-40133.protonmail.ch [185.70.40.133]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EE75768585 for ; Mon, 3 Feb 2025 11:43:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1738579417; x=1738838617; bh=5ejtu9YPowddirCWzAzbUxwojEFr/JrgsPcW4/tgres=; h=Date:To:From:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=Xj7Duvp8POA21R/RtI2AdCF7CzgnthfF/Y9ZY9uSgJzthcd7tezNH0pNrnyySaY5u bOp5F2HYYPGU5ET0NlN17jV7RbLAHL7f6y5oCQ3rsOvUuicVMdXnvYPQSdJO/thOVE WOvr0JSyB4PF/Yuy64EfVPUnjlWkERszqmDiVEWnF21rJ9kBewjUJnFp+LGTUYoWNS 4WE34Q2v8Hx7GgDPLQg1KXqsvYNiQ7ltorlKTU0/j9fFDRBzJTrz3sWlvqxmTS9Dg7 k7BRh3uQ5PA8raJLR6c0Qn3iS6ZFgTAbDA/bl7CCxulV26NqV8ZsdrU6PsVyGwDIkL MKO5EkR6wq3PA== Date: Mon, 03 Feb 2025 10:43:34 +0000 To: libcamera-devel@lists.libcamera.org From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Subject: [PATCH v1 3/3] libcamera: pipeline: virtual: Set `FrameError` on error Message-ID: <20250203104318.135628-4-pobrn@protonmail.com> In-Reply-To: <20250203104318.135628-1-pobrn@protonmail.com> References: <20250203104318.135628-1-pobrn@protonmail.com> Feedback-ID: 20568564:user:proton X-Pm-Message-ID: 85e122d89b17603ddd8333d6914737fffd49adb4 MIME-Version: 1.0 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" Do not cancel, simply set the buffer's status to `FrameError` to notify the user about the error condition. Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- src/libcamera/pipeline/virtual/virtual.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp index 1a75f35aa..cbba08c82 100644 --- a/src/libcamera/pipeline/virtual/virtual.cpp +++ b/src/libcamera/pipeline/virtual/virtual.cpp @@ -322,7 +322,7 @@ int PipelineHandlerVirtual::queueRequestDevice([[maybe_unused]] Camera *camera, if (streamConfig.frameGenerator->generateFrame( stream->configuration().size, buffer)) - buffer->_d()->cancel(); + fmd.status = FrameMetadata::Status::FrameError; completeBuffer(request, buffer); break;