Show a patch.

GET /api/patches/11868/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 11868,
    "url": "https://patchwork.libcamera.org/api/patches/11868/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/11868/",
    "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": "<20210408085101.1691729-3-hiroh@chromium.org>",
    "date": "2021-04-08T08:51:00",
    "name": "[libcamera-devel,RFC,v3,2/3] libcamera: ipu3: Try queuing pending requests if a buffer is available",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "47122223bd37dcb2475e3545d5df3b2abfaaf3da",
    "submitter": {
        "id": 63,
        "url": "https://patchwork.libcamera.org/api/people/63/?format=api",
        "name": "Hirokazu Honda",
        "email": "hiroh@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/11868/mbox/",
    "series": [
        {
            "id": 1904,
            "url": "https://patchwork.libcamera.org/api/series/1904/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1904",
            "date": "2021-04-08T08:50:58",
            "name": "ipu3: Enable to handle a number of concurrent requests",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/1904/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/11868/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/11868/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 48528BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  8 Apr 2021 08:51:15 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 093E068800;\n\tThu,  8 Apr 2021 10:51:15 +0200 (CEST)",
            "from mail-pf1-x429.google.com (mail-pf1-x429.google.com\n\t[IPv6:2607:f8b0:4864:20::429])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B5450687FB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  8 Apr 2021 10:51:12 +0200 (CEST)",
            "by mail-pf1-x429.google.com with SMTP id n38so1324532pfv.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 08 Apr 2021 01:51:12 -0700 (PDT)",
            "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:8822:ec6c:14d8:eea9])\n\tby smtp.gmail.com with ESMTPSA id\n\tg80sm1755993pfb.181.2021.04.08.01.51.09\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 08 Apr 2021 01:51:10 -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=\"J6Rt6StR\"; 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=AlMFdpjld/thmoA4QQbI8zwGsWKIYqW7MNGUakZcOnM=;\n\tb=J6Rt6StR8+HQt/WsIiA5kKMi5HfGDUdKkITXynfJOD+cgXyQXVpBKHTKQjJuInBJ93\n\tuExRxwvQGGtn++pfBDzMMluCoxwjBPmNdB9mEeV77t+XvbeCZVyaUURg9tFFeiMtnmeK\n\ttVV4iSUh/ZlaKgdq5G/5L0AKtWfuHQkOZBEDI=",
        "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=AlMFdpjld/thmoA4QQbI8zwGsWKIYqW7MNGUakZcOnM=;\n\tb=QSxsY0SciP+2ZwgzD1Rj7iTlGX9zOGt3LTjMbzxUjM3Uy3UoAxSyh5Ufd116JTeqsK\n\tko6760ZmeGJNqlgXPnLRitYVd95+DM5Q5qo1LlWVuD2xrEtCtndlXWVDnGydXiFMW6P0\n\t6aoRFDNQ3jTkpLXE8MInhMvdvAj77eWtkkedCaYuJ1pCc9GTPwnxi+Ptq6NM1GdHmKnP\n\tb01H35il4Z0c5RHdwxtDpAaKXlbAGTqm5DEUYyA4E6gC30qq9ZxyD3qO+eZScAl/zp3C\n\tR8qsTkjZ5vVvt4VZU0rh6s7xlkpyjCjRRLWfngyyv75Eikl1LWA45Cck/T5/ffOj246T\n\tkYow==",
        "X-Gm-Message-State": "AOAM533BJY5Q8pvpHCt3DWfBxswpKDQetNY6C5e1FlVZeRY6bsj9SYN/\n\tRl3k4eiYSGvW/EZ38i6sVyb7bBcxZnixzw==",
        "X-Google-Smtp-Source": "ABdhPJzOZ1ldWj2T3o6zfR+eXro004N+iFHRSCogJiBvCjC7tEG6VGD+kBZ1F52n16mNs1ojLPlYMw==",
        "X-Received": "by 2002:a63:ed49:: with SMTP id m9mr7158345pgk.323.1617871870548;\n\tThu, 08 Apr 2021 01:51:10 -0700 (PDT)",
        "From": "Hirokazu Honda <hiroh@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu,  8 Apr 2021 17:51:00 +0900",
        "Message-Id": "<20210408085101.1691729-3-hiroh@chromium.org>",
        "X-Mailer": "git-send-email 2.31.0.208.g409f899ff0-goog",
        "In-Reply-To": "<20210408085101.1691729-1-hiroh@chromium.org>",
        "References": "<20210408085101.1691729-1-hiroh@chromium.org>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [RFC PATCH v3 2/3] libcamera: ipu3: Try queuing\n\tpending requests if a buffer is available",
        "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": "IPU3CameraData stores requests that have been failed due to a\nbuffer shortage. The requests should be retried once enough\nbuffers are available. This sets the retry function as signal to\nCIO2Device and IPU3Frame, and invokes it from\nCIO2Device::tryReturnBuffer() and IPU3Frame::remove().\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/libcamera/pipeline/ipu3/cio2.cpp   | 4 +++-\n src/libcamera/pipeline/ipu3/cio2.h     | 3 +++\n src/libcamera/pipeline/ipu3/frames.cpp | 6 ++++--\n src/libcamera/pipeline/ipu3/frames.h   | 5 +++++\n src/libcamera/pipeline/ipu3/ipu3.cpp   | 4 ++++\n 5 files changed, 19 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\nindex 3cd777d1..6490fd46 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 \n@@ -302,6 +302,8 @@ void CIO2Device::tryReturnBuffer(FrameBuffer *buffer)\n \t\t\tbreak;\n \t\t}\n \t}\n+\n+\tbufferAvailable_.emit();\n }\n \n void CIO2Device::freeBuffers()\ndiff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h\nindex 5ecc4f47..8f37ee35 100644\n--- a/src/libcamera/pipeline/ipu3/cio2.h\n+++ b/src/libcamera/pipeline/ipu3/cio2.h\n@@ -54,6 +54,7 @@ public:\n \tFrameBuffer *queueBuffer(Request *request, FrameBuffer *rawBuffer);\n \tvoid tryReturnBuffer(FrameBuffer *buffer);\n \tSignal<FrameBuffer *> &bufferReady() { return output_->bufferReady; }\n+\tSignal<> &bufferAvailable() { return bufferAvailable_; }\n \tSignal<uint32_t> &frameStart() { return csi2_->frameStart; }\n \n private:\n@@ -65,6 +66,8 @@ private:\n \tstd::unique_ptr<V4L2Subdevice> csi2_;\n \tstd::unique_ptr<V4L2VideoDevice> output_;\n \n+\tSignal<> bufferAvailable_;\n+\n \tstd::vector<std::unique_ptr<FrameBuffer>> buffers_;\n \tstd::queue<FrameBuffer *> availableBuffers_;\n };\ndiff --git a/src/libcamera/pipeline/ipu3/frames.cpp b/src/libcamera/pipeline/ipu3/frames.cpp\nindex 03e8131c..58a47f98 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 \n@@ -86,6 +86,8 @@ void IPU3Frames::remove(IPU3Frames::Info *info)\n \n \t/* Delete the extended frame information. */\n \tframeInfo_.erase(info->id);\n+\n+\tbufferAvailable_.emit();\n }\n \n bool IPU3Frames::tryComplete(IPU3Frames::Info *info)\ndiff --git a/src/libcamera/pipeline/ipu3/frames.h b/src/libcamera/pipeline/ipu3/frames.h\nindex 4acdf48e..d2e5fbb9 100644\n--- a/src/libcamera/pipeline/ipu3/frames.h\n+++ b/src/libcamera/pipeline/ipu3/frames.h\n@@ -12,6 +12,8 @@\n #include <queue>\n #include <vector>\n \n+#include <libcamera/signal.h>\n+\n namespace libcamera {\n \n class FrameBuffer;\n@@ -49,10 +51,13 @@ public:\n \tInfo *find(unsigned int id);\n \tInfo *find(FrameBuffer *buffer);\n \n+\tSignal<> &bufferAvailable() { return bufferAvailable_; }\n private:\n \tstd::queue<FrameBuffer *> availableParamBuffers_;\n \tstd::queue<FrameBuffer *> availableStatBuffers_;\n \n+\tSignal<> bufferAvailable_;\n+\n \tstd::map<unsigned int, std::unique_ptr<Info>> frameInfo_;\n };\n \ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex c73e4f7c..462a0d9b 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -699,6 +699,8 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera)\n \tdata->ipa_->mapBuffers(ipaBuffers_);\n \n \tdata->frameInfos_.init(imgu->paramBuffers_, imgu->statBuffers_);\n+\tdata->frameInfos_.bufferAvailable().connect(\n+\t\tdata, &IPU3CameraData::queuePendingRequests);\n \n \treturn 0;\n }\n@@ -1123,6 +1125,8 @@ int PipelineHandlerIPU3::registerCameras()\n \t\t */\n \t\tdata->cio2_.bufferReady().connect(data.get(),\n \t\t\t\t\t&IPU3CameraData::cio2BufferReady);\n+\t\tdata->cio2_.bufferAvailable().connect(\n+\t\t\tdata.get(), &IPU3CameraData::queuePendingRequests);\n \t\tdata->imgu_->input_->bufferReady.connect(&data->cio2_,\n \t\t\t\t\t&CIO2Device::tryReturnBuffer);\n \t\tdata->imgu_->output_->bufferReady.connect(data.get(),\n",
    "prefixes": [
        "libcamera-devel",
        "RFC",
        "v3",
        "2/3"
    ]
}