Show a patch.

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

{
    "id": 11804,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/11804/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/11804/",
    "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": "<20210331084539.930233-1-hiroh@chromium.org>",
    "date": "2021-03-31T08:45:39",
    "name": "[libcamera-devel] pipeline: ipu3: Store requests in the case a buffer shortage",
    "commit_ref": null,
    "pull_url": null,
    "state": "rfc",
    "archived": false,
    "hash": "46ec4e31852300c47265ecfa9de22dd800fa15c5",
    "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/11804/mbox/",
    "series": [
        {
            "id": 1876,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1876/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1876",
            "date": "2021-03-31T08:45:39",
            "name": "[libcamera-devel] pipeline: ipu3: Store requests in the case a buffer shortage",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1876/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/11804/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/11804/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 5F377C0DA3\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 31 Mar 2021 08:45:49 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8B4F368781;\n\tWed, 31 Mar 2021 10:45:48 +0200 (CEST)",
            "from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com\n\t[IPv6:2607:f8b0:4864:20::42c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 45C07602D7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 31 Mar 2021 10:45:47 +0200 (CEST)",
            "by mail-pf1-x42c.google.com with SMTP id l123so14035482pfl.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 31 Mar 2021 01:45:47 -0700 (PDT)",
            "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:c112:2822:484f:486])\n\tby smtp.gmail.com with ESMTPSA id\n\tk19sm1864981pgl.1.2021.03.31.01.45.44\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 31 Mar 2021 01:45:45 -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=\"D523aVMB\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; h=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=aHI2JGTQNu5bzQSr5oxtVmpRHNClhnSkZaRmqTHn6yY=;\n\tb=D523aVMBaloHjxguQ0AybHxJey/PfpsTvPKW1cCobOp5UshCiK4Vhdj598sigisyGV\n\tOpkgPtohMCkVaF4Y9mmNp2naM8V8VRjm8lSoSnogoH6nZYDxfJdDTbDuN0oRI8N8rANM\n\tbZF3k6+1RVCfi95N5vA9oqVx2Jeq0Qkkm44U8=",
        "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:mime-version\n\t:content-transfer-encoding;\n\tbh=aHI2JGTQNu5bzQSr5oxtVmpRHNClhnSkZaRmqTHn6yY=;\n\tb=jR1unBjzLmGkCeqaSamcrAtE7C/yXHDaEo6Ex9GY/J5Srf9j2gaif9Bzo7Okavwa3T\n\tGB0Yo+eMjgYMF2JJ4n9QMAq2DS3nCADBWDLmSMPOkDALZwNUawdzhSfrjjANqzDPU84k\n\tpexQQcubOYXjycUD0NiMP1+CwB4F/fsqTvKl50L/qHs/vDHVCFg7RiCq5vcu0bZqNXL/\n\tuN0Donf8H+UlGE3Q6eoZ86ix2g+gFgYH45CF4wT8MnW9iNqp3pjR+zK6mCBFGOzQhooF\n\tFd0UAQ9eWHmKMePsn5zXSKaGWQZ9shOFNB9bQIuT5+WxE3PtMPdIPul7ixZ5IyJqKY4D\n\tKaNQ==",
        "X-Gm-Message-State": "AOAM533DcFHwho9lImGh3HSwBtrtJuslcvVTJ/XBWUKkXcvyJo0/URr7\n\t6/cKA3XDnoVM7h9PhkmUTyy/Oy1r74eAug==",
        "X-Google-Smtp-Source": "ABdhPJzBoix6FX4jIoBpcr5nqBBjf7mhzKZDZdgJPNzKzHsy5R/xGZPJiaqT8DRAC0JHTYS2ERmUdw==",
        "X-Received": "by 2002:a65:430b:: with SMTP id\n\tj11mr2311683pgq.143.1617180345536; \n\tWed, 31 Mar 2021 01:45:45 -0700 (PDT)",
        "From": "Hirokazu Honda <hiroh@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 31 Mar 2021 17:45:39 +0900",
        "Message-Id": "<20210331084539.930233-1-hiroh@chromium.org>",
        "X-Mailer": "git-send-email 2.31.0.291.g576ba9dcdaf-goog",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH] pipeline: ipu3: Store requests in the\n\tcase 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 PipelineHandlerIPU3 to do that.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 62 ++++++++++++++++++----------\n 1 file changed, 41 insertions(+), 21 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 519cad4f..71dd311f 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -153,12 +153,16 @@ private:\n \tint allocateBuffers(Camera *camera);\n \tint freeBuffers(Camera *camera);\n \n+\tint queuePendingRequests();\n+\n \tImgUDevice imgu0_;\n \tImgUDevice imgu1_;\n \tMediaDevice *cio2MediaDev_;\n \tMediaDevice *imguMediaDev_;\n \n \tstd::vector<IPABuffer> ipaBuffers_;\n+\n+\tstd::queue<std::pair<IPU3CameraData *, Request *>> pendingRequests_;\n };\n \n IPU3CameraConfiguration::IPU3CameraConfiguration(IPU3CameraData *data)\n@@ -764,6 +768,8 @@ void PipelineHandlerIPU3::stop(Camera *camera)\n \tIPU3CameraData *data = cameraData(camera);\n \tint ret = 0;\n \n+\tpendingRequests_ = {};\n+\n \tdata->ipa_->stop();\n \n \tret |= data->imgu_->stop();\n@@ -774,36 +780,50 @@ void PipelineHandlerIPU3::stop(Camera *camera)\n \tfreeBuffers(camera);\n }\n \n-int PipelineHandlerIPU3::queueRequestDevice(Camera *camera, Request *request)\n+int PipelineHandlerIPU3::queuePendingRequests()\n {\n-\tIPU3CameraData *data = cameraData(camera);\n+\twhile (!pendingRequests_.empty()) {\n+\t\tIPU3CameraData *data = pendingRequests_.front().first;\n+\t\tRequest *request = pendingRequests_.front().second;\n \n-\tIPU3Frames::Info *info = data->frameInfos_.create(request);\n-\tif (!info)\n-\t\treturn -ENOBUFS;\n+\t\tIPU3Frames::Info *info = data->frameInfos_.create(request);\n+\t\tif (!info)\n+\t\t\tbreak;\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}\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(&data->rawStream_);\n+\t\tFrameBuffer *rawBuffer = data->cio2_.queueBuffer(request, reqRawBuffer);\n+\t\tif (!rawBuffer) {\n+\t\t\tdata->frameInfos_.remove(info);\n+\t\t\tbreak;\n+\t\t}\n \n-\tinfo->rawBuffer = rawBuffer;\n+\t\tinfo->rawBuffer = rawBuffer;\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\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\tdata->ipa_->processEvent(ev);\n+\n+\t\tpendingRequests_.pop();\n+\t}\n \n \treturn 0;\n }\n \n+int PipelineHandlerIPU3::queueRequestDevice(Camera *camera, Request *request)\n+{\n+\tIPU3CameraData *data = cameraData(camera);\n+\n+\tpendingRequests_.emplace(data, request);\n+\treturn queuePendingRequests();\n+}\n+\n bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator)\n {\n \tint ret;\n",
    "prefixes": [
        "libcamera-devel"
    ]
}