Patch Detail
Show a patch.
GET /api/1.1/patches/12026/?format=api
{ "id": 12026, "url": "https://patchwork.libcamera.org/api/1.1/patches/12026/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12026/", "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": "<20210421064847.324118-2-hiroh@chromium.org>", "date": "2021-04-21T06:48:46", "name": "[libcamera-devel,v4,1/2] pipeline: ipu3: Store requests in the case a buffer shortage", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "d2f1750b40ad3ce32a2a4b51a89c822e3e9e68b8", "submitter": { "id": 63, "url": "https://patchwork.libcamera.org/api/1.1/people/63/?format=api", "name": "Hirokazu Honda", "email": "hiroh@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/12026/mbox/", "series": [ { "id": 1954, "url": "https://patchwork.libcamera.org/api/1.1/series/1954/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1954", "date": "2021-04-21T06:48:45", "name": "ipu3: Enable to handle a number of concurrent requests", "version": 4, "mbox": "https://patchwork.libcamera.org/series/1954/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12026/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12026/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 862CEBDB16\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 21 Apr 2021 06:48:58 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 447A5602C8;\n\tWed, 21 Apr 2021 08:48:58 +0200 (CEST)", "from mail-pg1-x530.google.com (mail-pg1-x530.google.com\n\t[IPv6:2607:f8b0:4864:20::530])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AF8D6602C8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Apr 2021 08:48:55 +0200 (CEST)", "by mail-pg1-x530.google.com with SMTP id t22so28883854pgu.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Apr 2021 23:48:55 -0700 (PDT)", "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:7aaa:cbeb:5d87:4ab6])\n\tby smtp.gmail.com with ESMTPSA id\n\tng6sm1021458pjb.14.2021.04.20.23.48.52\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 20 Apr 2021 23:48:53 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"iDKGjPdC\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=HBsxA1gxQO2cvVP/rXd9MM7fVm+QSyhCuF+uevX40CA=;\n\tb=iDKGjPdCcz5alj1K5vn+dBcrPr/yUYCSn5mxv9rx4gMuNMClZOSMoE1xErsMQV7U34\n\tBiPDVizNmnpEZxTNJRROGCntdjCdKqq5IUYq6N5+eBSlefoh4dwTUhYWm8GIPe07Q7Tg\n\tkmGeMj2hIvrzpro6ewUOL3MZLQNkEe6dw+fxE=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=HBsxA1gxQO2cvVP/rXd9MM7fVm+QSyhCuF+uevX40CA=;\n\tb=pBK64Qx4lBE6xx/ea01Hc2u5HMjkKuXw6P74Xo11xMy6soJppZuTUZhmF7q1OnsipX\n\tv7n2QqvZrjVobDt2UijV24CvrBKUgl09trCX6lPDTPamjnAxLEmJofRKeYxjIPfW2kwv\n\tzztChJFg0dql9GwfUupAAH30is5YwfqFHBqDcrSUNAEoep567ENqc50/54rjwNg5zS25\n\tErxlyaow/kRiaiq16MwhomR2C2yjDrn0359Y2lEXz1LrhzOkRu60U6joWFcHOGJgLTeV\n\tHFP2VzTpoMQycqL4Bg5Zg4Rybmq316I1x5Tf38XriY6Oy4yRFXVB3vqjF0Lp42egr3qz\n\tj7bQ==", "X-Gm-Message-State": "AOAM531bRkActITbDpkNgLRcR7yrkKlMO29QzgO7vo5sTFKXO1LOrclR\n\t0z6PbtTMbycptat+piimJhxc0Zai2O2+Wg==", "X-Google-Smtp-Source": "ABdhPJwiQzBxdirvbyC9aIMDMbyil/dBTAzPOowlFaIMExqR/SNVFydupIST7blO21+A+gm0QLVqlA==", "X-Received": "by 2002:a63:688:: with SMTP id\n\t130mr20185880pgg.280.1618987734137; \n\tTue, 20 Apr 2021 23:48:54 -0700 (PDT)", "From": "Hirokazu Honda <hiroh@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 21 Apr 2021 15:48:46 +0900", "Message-Id": "<20210421064847.324118-2-hiroh@chromium.org>", "X-Mailer": "git-send-email 2.31.1.368.gbe11c130af-goog", "In-Reply-To": "<20210421064847.324118-1-hiroh@chromium.org>", "References": "<20210421064847.324118-1-hiroh@chromium.org>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v4 1/2] pipeline: ipu3: Store requests in\n\tthe case a buffer shortage", "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>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "PipelineHandlerIPU3 returns -ENOBUFS and -ENOMEM on queueing a\nrequest when there are not sufficient buffers for the request.\nSince the request will be successful if it is queued later when\nenough buffers are available. The requests failed due to a buffer\nshortage should be stored and retried later in the FIFO order.\nThis introduces the queue in IPU3CameraData to do that.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/libcamera/pipeline/ipu3/cio2.cpp | 2 +-\n src/libcamera/pipeline/ipu3/frames.cpp | 4 +-\n src/libcamera/pipeline/ipu3/ipu3.cpp | 73 +++++++++++++++++++-------\n 3 files changed, 56 insertions(+), 23 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\nindex 3cd777d1..8bbef174 100644\n--- a/src/libcamera/pipeline/ipu3/cio2.cpp\n+++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n@@ -272,7 +272,7 @@ FrameBuffer *CIO2Device::queueBuffer(Request *request, FrameBuffer *rawBuffer)\n \t/* If no buffer is provided in the request, use an internal one. */\n \tif (!buffer) {\n \t\tif (availableBuffers_.empty()) {\n-\t\t\tLOG(IPU3, Error) << \"CIO2 buffer underrun\";\n+\t\t\tLOG(IPU3, Debug) << \"CIO2 buffer underrun\";\n \t\t\treturn nullptr;\n \t\t}\n \ndiff --git a/src/libcamera/pipeline/ipu3/frames.cpp b/src/libcamera/pipeline/ipu3/frames.cpp\nindex a1b014ee..2c4fe508 100644\n--- a/src/libcamera/pipeline/ipu3/frames.cpp\n+++ b/src/libcamera/pipeline/ipu3/frames.cpp\n@@ -44,12 +44,12 @@ IPU3Frames::Info *IPU3Frames::create(Request *request)\n \tunsigned int id = request->sequence();\n \n \tif (availableParamBuffers_.empty()) {\n-\t\tLOG(IPU3, Error) << \"Parameters buffer underrun\";\n+\t\tLOG(IPU3, Debug) << \"Parameters buffer underrun\";\n \t\treturn nullptr;\n \t}\n \n \tif (availableStatBuffers_.empty()) {\n-\t\tLOG(IPU3, Error) << \"Statistics buffer underrun\";\n+\t\tLOG(IPU3, Debug) << \"Statistics buffer underrun\";\n \t\treturn nullptr;\n \t}\n \ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 73306cea..3f311e58 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -66,6 +66,8 @@ public:\n \tvoid cio2BufferReady(FrameBuffer *buffer);\n \tvoid paramBufferReady(FrameBuffer *buffer);\n \tvoid statBufferReady(FrameBuffer *buffer);\n+\tvoid queuePendingRequests();\n+\tvoid cancelPendingRequests();\n \n \tCIO2Device cio2_;\n \tImgUDevice *imgu_;\n@@ -84,6 +86,8 @@ public:\n \n \tstd::unique_ptr<ipa::ipu3::IPAProxyIPU3> ipa_;\n \n+\tstd::queue<Request *> pendingRequests_;\n+\n private:\n \tvoid queueFrameAction(unsigned int id,\n \t\t\t const ipa::ipu3::IPU3Action &action);\n@@ -764,6 +768,8 @@ void PipelineHandlerIPU3::stop(Camera *camera)\n \tIPU3CameraData *data = cameraData(camera);\n \tint ret = 0;\n \n+\tdata->cancelPendingRequests();\n+\n \tdata->ipa_->stop();\n \n \tret |= data->imgu_->stop();\n@@ -774,33 +780,60 @@ void PipelineHandlerIPU3::stop(Camera *camera)\n \tfreeBuffers(camera);\n }\n \n-int PipelineHandlerIPU3::queueRequestDevice(Camera *camera, Request *request)\n+void IPU3CameraData::cancelPendingRequests()\n {\n-\tIPU3CameraData *data = cameraData(camera);\n+\twhile (!pendingRequests_.empty()) {\n+\t\tRequest *request = pendingRequests_.front();\n \n-\tIPU3Frames::Info *info = data->frameInfos_.create(request);\n-\tif (!info)\n-\t\treturn -ENOBUFS;\n+\t\tfor (auto it : request->buffers()) {\n+\t\t\tFrameBuffer *buffer = it.second;\n+\t\t\tbuffer->cancel();\n+\t\t\tpipe_->completeBuffer(request, buffer);\n+\t\t}\n \n-\t/*\n-\t * Queue a buffer on the CIO2, using the raw stream buffer provided in\n-\t * the request, if any, or a CIO2 internal buffer otherwise.\n-\t */\n-\tFrameBuffer *reqRawBuffer = request->findBuffer(&data->rawStream_);\n-\tFrameBuffer *rawBuffer = data->cio2_.queueBuffer(request, reqRawBuffer);\n-\tif (!rawBuffer) {\n-\t\tdata->frameInfos_.remove(info);\n-\t\treturn -ENOMEM;\n+\t\tpipe_->completeRequest(request);\n+\t\tpendingRequests_.pop();\n \t}\n+}\n \n-\tinfo->rawBuffer = rawBuffer;\n+void IPU3CameraData::queuePendingRequests()\n+{\n+\twhile (!pendingRequests_.empty()) {\n+\t\tRequest *request = pendingRequests_.front();\n \n-\tipa::ipu3::IPU3Event ev;\n-\tev.op = ipa::ipu3::EventProcessControls;\n-\tev.frame = info->id;\n-\tev.controls = request->controls();\n-\tdata->ipa_->processEvent(ev);\n+\t\tIPU3Frames::Info *info = frameInfos_.create(request);\n+\t\tif (!info)\n+\t\t\tbreak;\n+\n+\t\t/*\n+\t\t * Queue a buffer on the CIO2, using the raw stream buffer\n+\t\t * provided in the request, if any, or a CIO2 internal buffer\n+\t\t * otherwise.\n+\t\t */\n+\t\tFrameBuffer *reqRawBuffer = request->findBuffer(&rawStream_);\n+\t\tFrameBuffer *rawBuffer = cio2_.queueBuffer(request, reqRawBuffer);\n+\t\tif (!rawBuffer) {\n+\t\t\tframeInfos_.remove(info);\n+\t\t\tbreak;\n+\t\t}\n+\n+\t\tinfo->rawBuffer = rawBuffer;\n \n+\t\tipa::ipu3::IPU3Event ev;\n+\t\tev.op = ipa::ipu3::EventProcessControls;\n+\t\tev.frame = info->id;\n+\t\tev.controls = request->controls();\n+\t\tipa_->processEvent(ev);\n+\n+\t\tpendingRequests_.pop();\n+\t}\n+}\n+\n+int PipelineHandlerIPU3::queueRequestDevice(Camera *camera, Request *request)\n+{\n+\tIPU3CameraData *data = cameraData(camera);\n+\tdata->pendingRequests_.push(request);\n+\tdata->queuePendingRequests();\n \treturn 0;\n }\n \n", "prefixes": [ "libcamera-devel", "v4", "1/2" ] }