Show a patch.

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

{
    "id": 12492,
    "url": "https://patchwork.libcamera.org/api/patches/12492/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12492/",
    "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": "<20210603124345.2492885-1-naush@raspberrypi.com>",
    "date": "2021-06-03T12:43:45",
    "name": "[libcamera-devel] pipeline: raspberrypi: Simplify RPiCameraData::clearIncompleteRequests()",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "28a148c6db7e0b729c6b1b2533c4a7067226ce31",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/12492/mbox/",
    "series": [
        {
            "id": 2103,
            "url": "https://patchwork.libcamera.org/api/series/2103/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2103",
            "date": "2021-06-03T12:43:45",
            "name": "[libcamera-devel] pipeline: raspberrypi: Simplify RPiCameraData::clearIncompleteRequests()",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2103/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12492/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12492/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 1C310C3206\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  3 Jun 2021 12:43:53 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6720C602A3;\n\tThu,  3 Jun 2021 14:43:52 +0200 (CEST)",
            "from mail-wm1-x334.google.com (mail-wm1-x334.google.com\n\t[IPv6:2a00:1450:4864:20::334])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 09540602A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  3 Jun 2021 14:43:50 +0200 (CEST)",
            "by mail-wm1-x334.google.com with SMTP id\n\tp13-20020a05600c358db029019f44afc845so3617040wmq.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 03 Jun 2021 05:43:50 -0700 (PDT)",
            "from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:bd6e:fb37:8844:f274])\n\tby smtp.gmail.com with ESMTPSA id\n\ta77sm3588358wmd.14.2021.06.03.05.43.49\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 03 Jun 2021 05:43:49 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"YYhJeeFB\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=fItYp3tedsJj/+S2GxhJhw0m6xSsIwR2UaIlCLahRuI=;\n\tb=YYhJeeFBWib/s2glQx+TobzA60ycWeE1ZyodaCH0MYhimhJs2Ioz5ACMtNgSbeoLch\n\tXf2leGhgjUPJAjO8v7InZLwLqSVroVsrbmBlVqVk/1nmvUcNIfkmnVdk1LrOGotBuo7B\n\tbHm+y+5Lpxh4BlqnXttGg7d3AkQuDMo+BEsvsshpfChtXTkCHP4mIVzA07t7ydOVchHc\n\tf9Wq00Vol8niyiwywhids+PL6fYZ8woLf5v3vcfym1eOb+5v/RWUwj66XZ7hyGa12qGZ\n\tkkcVi2ot2hD+l1ucqmq8aGW2yoY4zPNIXyCZKEO6nY9Fmur5rrOlaCjUcyCF0kD6K9m+\n\t3u+Q==",
        "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=fItYp3tedsJj/+S2GxhJhw0m6xSsIwR2UaIlCLahRuI=;\n\tb=mvdeZTyEdxt+4LS773u7mnpN4lePFHOydzl5vLPXeKSAbgBJfn7dW3NbXGF+Ynml3X\n\tiu8lSIHNwpZJDwXcJg8eoGneAOW8m9028PKhRpLhszaa9asD7NRXbQEd7hOogsSLy0tz\n\tO0Ka5BabT5KasFWIhxZ8VpXQT+qd19HVNDRP8VgaSB6QpC6NYs14AHBJNcqpV00NoXGl\n\tDn2aQEGKN5Y9n3z2E3wddRnTsWbTtVgkambFXY85OSHTtQM7R4JtELBxfjjnAWOKX2tL\n\trZdTqz9Nl8n1qAOkDSd7aDyd+Fj47+KW1bN21aj57dB1Z3OnClMjjgGO8CCVy4GWX0Z7\n\tVqng==",
        "X-Gm-Message-State": "AOAM531e2eqSlSsIt+vikABM+VByzn38wmTvR47eRRJ6JNTvEWNDH3Zs\n\tOqRSFHEICX0KN/uQdpdp7niFwMlBnnwJow==",
        "X-Google-Smtp-Source": "ABdhPJykrOSMvd9VLCn+2nR1RLWEybcUcjnXBXZrN6dKIBy9HwKjWpV3KYs4DLOr6f31I3InHU1p9g==",
        "X-Received": "by 2002:a7b:cf2e:: with SMTP id\n\tm14mr18421240wmg.111.1622724230118; \n\tThu, 03 Jun 2021 05:43:50 -0700 (PDT)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu,  3 Jun 2021 13:43:45 +0100",
        "Message-Id": "<20210603124345.2492885-1-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH] pipeline: raspberrypi: Simplify\n\tRPiCameraData::clearIncompleteRequests()",
        "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": "With the addition of FrameBuffer::cancel(), the logic to clear and return\npending requests can be simplified by not having to queue all the request\nbuffers to the device before calling streamOff().\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 46 ++++---------------\n 1 file changed, 8 insertions(+), 38 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex a65b4568256c..887f8d0f7404 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -884,7 +884,9 @@ void PipelineHandlerRPi::stop(Camera *camera)\n \t/* Disable SOF event generation. */\n \tdata->unicam_[Unicam::Image].dev()->setFrameStartEnabled(false);\n \n-\t/* This also stops the streams. */\n+\tfor (auto const stream : data->streams_)\n+\t\tstream->dev()->streamOff();\n+\n \tdata->clearIncompleteRequests();\n \tdata->bayerQueue_ = {};\n \tdata->embeddedQueue_ = {};\n@@ -1477,49 +1479,17 @@ void RPiCameraData::ispOutputDequeue(FrameBuffer *buffer)\n \n void RPiCameraData::clearIncompleteRequests()\n {\n-\t/*\n-\t * Queue up any buffers passed in the request.\n-\t * This is needed because streamOff() will then mark the buffers as\n-\t * cancelled.\n-\t */\n-\tfor (auto const request : requestQueue_) {\n-\t\tfor (auto const stream : streams_) {\n-\t\t\tif (!stream->isExternal())\n-\t\t\t\tcontinue;\n-\n-\t\t\tFrameBuffer *buffer = request->findBuffer(stream);\n-\t\t\tif (buffer)\n-\t\t\t\tstream->queueBuffer(buffer);\n-\t\t}\n-\t}\n-\n-\t/* Stop all streams. */\n-\tfor (auto const stream : streams_)\n-\t\tstream->dev()->streamOff();\n-\n \t/*\n \t * All outstanding requests (and associated buffers) must be returned\n-\t * back to the pipeline. The buffers would have been marked as\n-\t * cancelled by the call to streamOff() earlier.\n+\t * back to the pipeline.\n \t */\n \twhile (!requestQueue_.empty()) {\n \t\tRequest *request = requestQueue_.front();\n-\t\t/*\n-\t\t * A request could be partially complete,\n-\t\t * i.e. we have returned some buffers, but still waiting\n-\t\t * for others or waiting for metadata.\n-\t\t */\n-\t\tfor (auto const stream : streams_) {\n-\t\t\tif (!stream->isExternal())\n-\t\t\t\tcontinue;\n \n-\t\t\tFrameBuffer *buffer = request->findBuffer(stream);\n-\t\t\t/*\n-\t\t\t * Has the buffer already been handed back to the\n-\t\t\t * request? If not, do so now.\n-\t\t\t */\n-\t\t\tif (buffer && buffer->request())\n-\t\t\t\tpipe_->completeBuffer(request, buffer);\n+\t\tfor (auto &b : request->buffers()) {\n+\t\t\tFrameBuffer *buffer = b.second;\n+\t\t\tbuffer->cancel();\n+\t\t\tpipe_->completeBuffer(request, buffer);\n \t\t}\n \n \t\tpipe_->completeRequest(request);\n",
    "prefixes": [
        "libcamera-devel"
    ]
}