Patch Detail
Show a patch.
GET /api/1.1/patches/23828/?format=api
{ "id": 23828, "url": "https://patchwork.libcamera.org/api/1.1/patches/23828/?format=api", "web_url": "https://patchwork.libcamera.org/patch/23828/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20250716142027.236277-8-uajain@igalia.com>", "date": "2025-07-16T14:20:27", "name": "[RFC,6/6] libcamera: simple: Enable capturing of raw streams", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "36c2bdef775a1a4002899135c2fe5a3b8bd143a9", "submitter": { "id": 232, "url": "https://patchwork.libcamera.org/api/1.1/people/232/?format=api", "name": "Umang Jain", "email": "uajain@igalia.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/23828/mbox/", "series": [ { "id": 5290, "url": "https://patchwork.libcamera.org/api/1.1/series/5290/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5290", "date": "2025-07-16T14:20:27", "name": null, "version": 1, "mbox": "https://patchwork.libcamera.org/series/5290/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/23828/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/23828/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 5681DC3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 16 Jul 2025 14:20:39 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6CB4368F75;\n\tWed, 16 Jul 2025 16:20:38 +0200 (CEST)", "from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3979168F75\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 16 Jul 2025 16:20:31 +0200 (CEST)", "from [49.36.69.57] (helo=uajain) by fanzine2.igalia.com with\n\tesmtpsa \n\t(Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)\n\t(Exim) id 1uc2zm-00HLf5-As; Wed, 16 Jul 2025 16:20:30 +0200" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=igalia.com header.i=@igalia.com\n\theader.b=\"BNVlvUAQ\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com;\n\ts=20170329;\n\th=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:\n\tMessage-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:\n\tContent-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc\n\t:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:\n\tList-Post:List-Owner:List-Archive;\n\tbh=94vJOQ8k1NMAB6SFpWN9OzaSYf+V4WRxM9ATfHZ2lDc=;\n\tb=BNVlvUAQCjFl9QNTn1Y+VqFSoK\n\tpQE/xvSAGvGb5B+eesC3VjOKA6EsDAEPkFxWOyEkBayOcv9Xx8PJ82AXh8OZ4u8au7yNYJKfgh30y\n\tdVoFVRZGGYiVY68G+Yl29d1zU4dhPGwBKK2vXV6k/vY6EQJR3Kntvy2TXStzke8KCtu52G7/FQZK6\n\tWdUs/6GTb2suoj4w1jsV1dQ8Yu1Ehq9vUTUsm2xxEJA8TL7y6mh2hanJtCLJbA2rfMnbRBcPrxWIO\n\tvohdZ9+7SvWyPPIhhONHgPTzY7X7ytP4zLjtHlNeXv6MbGAVDDruuT8wfpqDZMpgJG7eO3aBTrJGf\n\tsb1gAyIw==;", "From": "Umang Jain <uajain@igalia.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Milan Zamazal <mzamazal@redhat.com>,\n\tRobert Mader <robert.mader@collabora.com>, Umang Jain <uajain@igalia.com>", "Subject": "[RFC PATCH 6/6] libcamera: simple: Enable capturing of raw streams", "Date": "Wed, 16 Jul 2025 19:50:27 +0530", "Message-ID": "<20250716142027.236277-8-uajain@igalia.com>", "X-Mailer": "git-send-email 2.50.0", "In-Reply-To": "<20250716142027.236277-1-uajain@igalia.com>", "References": "<20250716142027.236277-1-uajain@igalia.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Enable capturing of raw streams (standalone or in combination with\na processed stream). Track the raw stream (if requested) in\nSimpleCameraData and adapt the buffer handling management accordingly.\n\nSigned-off-by: Umang Jain <uajain@igalia.com>\n---\n src/libcamera/pipeline/simple/simple.cpp | 48 +++++++++++++++++-------\n 1 file changed, 35 insertions(+), 13 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 75469e3a..78c9758a 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -326,6 +326,7 @@ public:\n \t};\n \n \tstd::vector<Stream> streams_;\n+\tStream *rawStream_;\n \n \t/*\n \t * All entities in the pipeline, from the camera sensor to the video\n@@ -453,7 +454,7 @@ private:\n SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,\n \t\t\t\t unsigned int numStreams,\n \t\t\t\t MediaEntity *sensor)\n-\t: Camera::Private(pipe), streams_(numStreams)\n+\t: Camera::Private(pipe), streams_(numStreams), rawStream_(nullptr)\n {\n \t/*\n \t * Find the shortest path from the camera sensor to a video capture\n@@ -926,7 +927,8 @@ void SimpleCameraData::imageBufferReady(FrameBuffer *buffer)\n \t */\n \tif (useConversion_) {\n \t\tif (conversionQueue_.empty()) {\n-\t\t\tvideo_->queueBuffer(buffer);\n+\t\t\tif (!rawStream_)\n+\t\t\t\tvideo_->queueBuffer(buffer);\n \t\t\treturn;\n \t\t}\n \n@@ -979,7 +981,14 @@ void SimpleCameraData::tryCompleteRequest(Request *request)\n void SimpleCameraData::conversionInputDone(FrameBuffer *buffer)\n {\n \t/* Queue the input buffer back for capture. */\n-\tvideo_->queueBuffer(buffer);\n+\tif (!rawStream_) {\n+\t\tvideo_->queueBuffer(buffer);\n+\t} else {\n+\t\t/* Complete the input buffer. */\n+\t\tRequest *request = buffer->request();\n+\t\tif (pipe()->completeBuffer(request, buffer))\n+\t\t\ttryCompleteRequest(request);\n+\t}\n }\n \n void SimpleCameraData::conversionOutputDone(FrameBuffer *buffer)\n@@ -1219,7 +1228,7 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()\n \t * require any conversion, similar to raw capture use cases). This is\n \t * left as a future improvement.\n \t */\n-\tneedConversion_ = config_.size() > 1;\n+\tneedConversion_ = config_.size() > 1 + rawCount;\n \n \tfor (unsigned int i = 0; i < config_.size(); ++i) {\n \t\tStreamConfiguration &cfg = config_[i];\n@@ -1448,11 +1457,15 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n \n \tfor (unsigned int i = 0; i < config->size(); ++i) {\n \t\tStreamConfiguration &cfg = config->at(i);\n+\t\tbool rawStream = isFormatRaw(cfg.pixelFormat);\n \n \t\tcfg.setStream(&data->streams_[i]);\n \n-\t\tif (data->useConversion_ && !isFormatRaw(cfg.pixelFormat))\n+\t\tif (data->useConversion_ && !rawStream)\n \t\t\toutputCfgs.push_back(cfg);\n+\n+\t\tif (rawStream)\n+\t\t\tdata->rawStream_ = &data->streams_[i];\n \t}\n \n \tif (outputCfgs.empty())\n@@ -1483,7 +1496,7 @@ int SimplePipelineHandler::exportFrameBuffers(Camera *camera, Stream *stream,\n \t * Export buffers on the converter or capture video node, depending on\n \t * whether the converter is used or not.\n \t */\n-\tif (data->useConversion_)\n+\tif (data->useConversion_ && (stream != data->rawStream_))\n \t\treturn data->converter_\n \t\t\t ? data->converter_->exportBuffers(stream, count, buffers)\n \t\t\t : data->swIsp_->exportBuffers(stream, count, buffers);\n@@ -1505,8 +1518,7 @@ int SimplePipelineHandler::start(Camera *camera, [[maybe_unused]] const ControlL\n \t\t\t<< pad->entity()->name() << \" in use\";\n \t\treturn -EBUSY;\n \t}\n-\n-\tif (data->useConversion_) {\n+\tif (data->useConversion_ && !data->rawStream_) {\n \t\t/*\n \t\t * When using the converter allocate a fixed number of internal\n \t\t * buffers.\n@@ -1514,8 +1526,16 @@ int SimplePipelineHandler::start(Camera *camera, [[maybe_unused]] const ControlL\n \t\tret = video->allocateBuffers(kNumInternalBuffers,\n \t\t\t\t\t &data->conversionBuffers_);\n \t} else {\n-\t\t/* Otherwise, prepare for using buffers from the only stream. */\n-\t\tStream *stream = &data->streams_[0];\n+\t\t/*\n+\t\t * Otherwise, prepare for using buffers from either the raw\n+\t\t * stream((if requested) or the only stream configured.\n+\t\t */\n+\t\tStream *stream;\n+\t\tif (data->rawStream_)\n+\t\t\tstream = data->rawStream_;\n+\t\telse\n+\t\t\tstream = &data->streams_[0];\n+\n \t\tret = video->importBuffers(stream->configuration().bufferCount);\n \t}\n \tif (ret < 0) {\n@@ -1556,8 +1576,10 @@ int SimplePipelineHandler::start(Camera *camera, [[maybe_unused]] const ControlL\n \t\t}\n \n \t\t/* Queue all internal buffers for capture. */\n-\t\tfor (std::unique_ptr<FrameBuffer> &buffer : data->conversionBuffers_)\n-\t\t\tvideo->queueBuffer(buffer.get());\n+\t\tif (!data->rawStream_) {\n+\t\t\tfor (std::unique_ptr<FrameBuffer> &buffer : data->conversionBuffers_)\n+\t\t\t\tvideo->queueBuffer(buffer.get());\n+\t\t}\n \t}\n \n \treturn 0;\n@@ -1608,7 +1630,7 @@ int SimplePipelineHandler::queueRequestDevice(Camera *camera, Request *request)\n \t\t * queue, it will be handed to the converter in the capture\n \t\t * completion handler.\n \t\t */\n-\t\tif (data->useConversion_) {\n+\t\tif (data->useConversion_ && (stream != data->rawStream_)) {\n \t\t\tbuffers.emplace(stream, buffer);\n \t\t\tmetadataRequired = !!data->swIsp_;\n \t\t} else {\n", "prefixes": [ "RFC", "6/6" ] }