Patch Detail
Show a patch.
GET /api/patches/23290/?format=api
{ "id": 23290, "url": "https://patchwork.libcamera.org/api/patches/23290/?format=api", "web_url": "https://patchwork.libcamera.org/patch/23290/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20250428090413.38234-18-s.pueschel@pengutronix.de>", "date": "2025-04-28T09:02:42", "name": "[v11,17/19] libcamera: pipeline: rkisp1: Add internal request queue", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "8f378aa38347f99b9f9e73fce76e13fa7d916063", "submitter": { "id": 225, "url": "https://patchwork.libcamera.org/api/people/225/?format=api", "name": "Sven Püschel", "email": "s.pueschel@pengutronix.de" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/23290/mbox/", "series": [ { "id": 5148, "url": "https://patchwork.libcamera.org/api/series/5148/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5148", "date": "2025-04-28T09:02:25", "name": "lc-compliance: Add test to queue more requests than hardware depth", "version": 11, "mbox": "https://patchwork.libcamera.org/series/5148/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/23290/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/23290/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 95B74C3329\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 28 Apr 2025 09:05:41 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9E39768B41;\n\tMon, 28 Apr 2025 11:05:40 +0200 (CEST)", "from metis.whiteo.stw.pengutronix.de\n\t(metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 021B668B2A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Apr 2025 11:05:08 +0200 (CEST)", "from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77]\n\thelo=peter.guest.stw.pengutronix.de)\n\tby metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92)\n\t(envelope-from <s.pueschel@pengutronix.de>)\n\tid 1u9KQG-0001au-Lm; Mon, 28 Apr 2025 11:05:08 +0200" ], "From": "=?utf-8?q?Sven_P=C3=BCschel?= <s.pueschel@pengutronix.de>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "=?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= <nfraprado@collabora.com>, \n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>, \n\t=?utf-8?q?Sven_P=C3=BCschel?= <s.pueschel@pengutronix.de>", "Subject": "[PATCH v11 17/19] libcamera: pipeline: rkisp1: Add internal request\n\tqueue", "Date": "Mon, 28 Apr 2025 11:02:42 +0200", "Message-ID": "<20250428090413.38234-18-s.pueschel@pengutronix.de>", "X-Mailer": "git-send-email 2.49.0", "In-Reply-To": "<20250428090413.38234-1-s.pueschel@pengutronix.de>", "References": "<20250428090413.38234-1-s.pueschel@pengutronix.de>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "X-SA-Exim-Connect-IP": "2a0a:edc0:0:900:1d::77", "X-SA-Exim-Mail-From": "s.pueschel@pengutronix.de", "X-SA-Exim-Scanned": "No (on metis.whiteo.stw.pengutronix.de);\n\tSAEximRunCond expanded to false", "X-PTX-Original-Recipient": "libcamera-devel@lists.libcamera.org", "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": "From: Nícolas F. R. A. Prado <nfraprado@collabora.com>\n\nAdd an internal queue that stores requests until there are internal\nbuffers and V4L2 buffer slots available. This avoids the need to cancel\nrequests when there is a shortage of said buffers.\n\nSigned-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Sven Püschel <s.pueschel@pengutronix.de>\n\n---\nChanges in v11:\n- Added from https://lists.libcamera.org/pipermail/libcamera-devel/2021-September/024121.html\n---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 81 ++++++++++++++++++------\n 1 file changed, 62 insertions(+), 19 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 623bcfe5..d48da4e2 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -101,6 +101,9 @@ public:\n \tconst PipelineHandlerRkISP1 *pipe() const;\n \tint loadIPA(unsigned int hwRevision);\n \n+\tvoid queuePendingRequests();\n+\tvoid cancelPendingRequests();\n+\n \tStream mainPathStream_;\n \tStream selfPathStream_;\n \tstd::unique_ptr<CameraSensor> sensor_;\n@@ -115,6 +118,7 @@ public:\n \tstd::unique_ptr<ipa::rkisp1::IPAProxyRkISP1> ipa_;\n \n \tControlInfoMap ipaControls_;\n+\tstd::queue<Request *> pendingRequests_;\n \n private:\n \tvoid paramsComputed(unsigned int frame, unsigned int bytesused);\n@@ -254,12 +258,12 @@ RkISP1FrameInfo *RkISP1Frames::create(const RkISP1CameraData *data, Request *req\n \n \tif (!isRaw) {\n \t\tif (pipe_->availableParamBuffers_.empty()) {\n-\t\t\tLOG(RkISP1, Error) << \"Parameters buffer underrun\";\n+\t\t\tLOG(RkISP1, Debug) << \"Parameters buffer underrun\";\n \t\t\treturn nullptr;\n \t\t}\n \n \t\tif (pipe_->availableStatBuffers_.empty()) {\n-\t\t\tLOG(RkISP1, Error) << \"Statistic buffer underrun\";\n+\t\t\tLOG(RkISP1, Debug) << \"Statistic buffer underrun\";\n \t\t\treturn nullptr;\n \t\t}\n \n@@ -447,6 +451,56 @@ void RkISP1CameraData::metadataReady(unsigned int frame, const ControlList &meta\n \tpipe()->tryCompleteRequest(info);\n }\n \n+void RkISP1CameraData::queuePendingRequests()\n+{\n+\twhile (!pendingRequests_.empty()) {\n+\t\tRequest *request = pendingRequests_.front();\n+\n+\t\t/*\n+\t\t * If there aren't internal buffers available, we break and try\n+\t\t * again later. If there are, we're guaranteed to also have V4L2\n+\t\t * buffer slots available to queue the request, since we should\n+\t\t * always have more (or equal) buffer slots than internal\n+\t\t * buffers.\n+\t\t */\n+\t\tRkISP1FrameInfo *info = frameInfo_.create(this, request, pipe()->isRaw_);\n+\t\tif (!info)\n+\t\t\tbreak;\n+\n+\t\tipa_->queueRequest(frame_, request->controls());\n+\t\tif (pipe()->isRaw_) {\n+\t\t\tif (info->mainPathBuffer)\n+\t\t\t\tmainPath_->queueBuffer(info->mainPathBuffer);\n+\n+\t\t\tif (selfPath_ && info->selfPathBuffer)\n+\t\t\t\tselfPath_->queueBuffer(info->selfPathBuffer);\n+\t\t} else {\n+\t\t\tipa_->computeParams(frame_, info->paramBuffer->cookie());\n+\t\t}\n+\n+\t\tframe_++;\n+\n+\t\tpendingRequests_.pop();\n+\t}\n+}\n+\n+void RkISP1CameraData::cancelPendingRequests()\n+{\n+\twhile (!pendingRequests_.empty()) {\n+\t\tRequest *request = pendingRequests_.front();\n+\n+\t\tfor (auto it : request->buffers()) {\n+\t\t\tFrameBuffer *buffer = it.second;\n+\t\t\tbuffer->_d()->cancel();\n+\t\t\tpipe()->completeBuffer(request, buffer);\n+\t\t}\n+\n+\t\tpipe()->completeRequest(request);\n+\n+\t\tpendingRequests_.pop();\n+\t}\n+}\n+\n /* -----------------------------------------------------------------------------\n * Camera Configuration\n */\n@@ -1168,6 +1222,8 @@ void PipelineHandlerRkISP1::stopDevice(Camera *camera)\n \t\t\tdewarper_->stop();\n \t}\n \n+\tdata->cancelPendingRequests();\n+\n \tASSERT(data->queuedRequests_.empty());\n \tdata->frameInfo_.clear();\n \n@@ -1180,23 +1236,8 @@ int PipelineHandlerRkISP1::queueRequestDevice(Camera *camera, Request *request)\n {\n \tRkISP1CameraData *data = cameraData(camera);\n \n-\tRkISP1FrameInfo *info = data->frameInfo_.create(data, request, isRaw_);\n-\tif (!info)\n-\t\treturn -ENOENT;\n-\n-\tdata->ipa_->queueRequest(data->frame_, request->controls());\n-\tif (isRaw_) {\n-\t\tif (info->mainPathBuffer)\n-\t\t\tdata->mainPath_->queueBuffer(info->mainPathBuffer);\n-\n-\t\tif (data->selfPath_ && info->selfPathBuffer)\n-\t\t\tdata->selfPath_->queueBuffer(info->selfPathBuffer);\n-\t} else {\n-\t\tdata->ipa_->computeParams(data->frame_,\n-\t\t\t\t\t info->paramBuffer->cookie());\n-\t}\n-\n-\tdata->frame_++;\n+\tdata->pendingRequests_.push(request);\n+\tdata->queuePendingRequests();\n \n \treturn 0;\n }\n@@ -1481,6 +1522,8 @@ void PipelineHandlerRkISP1::tryCompleteRequest(RkISP1FrameInfo *info)\n \tdata->frameInfo_.destroy(info->frame);\n \n \tcompleteRequest(request);\n+\n+\tdata->queuePendingRequests();\n }\n \n void PipelineHandlerRkISP1::imageBufferReady(FrameBuffer *buffer)\n", "prefixes": [ "v11", "17/19" ] }