Show a patch.

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

{
    "id": 15430,
    "url": "https://patchwork.libcamera.org/api/patches/15430/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15430/",
    "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": "<20220307124633.115452-6-naush@raspberrypi.com>",
    "date": "2022-03-07T12:46:32",
    "name": "[libcamera-devel,v1,5/6] pipeline: raspberrypi: Repurpose RPi::Stream::reset()",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d487e29b9b6a7cef608400a4c48d9186272f6853",
    "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/15430/mbox/",
    "series": [
        {
            "id": 2954,
            "url": "https://patchwork.libcamera.org/api/series/2954/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2954",
            "date": "2022-03-07T12:46:27",
            "name": "Raspberry Pi: Efficient start/stop/start sequences",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2954/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15430/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15430/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\r\n\t[92.243.16.209])\r\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id B3F4FBF415\r\n\tfor <parsemail@patchwork.libcamera.org>;\r\n\tMon,  7 Mar 2022 12:46:46 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\r\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7340B611AA;\r\n\tMon,  7 Mar 2022 13:46:46 +0100 (CET)",
            "from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com\r\n\t[IPv6:2a00:1450:4864:20::42d])\r\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DCC9361187\r\n\tfor <libcamera-devel@lists.libcamera.org>;\r\n\tMon,  7 Mar 2022 13:46:42 +0100 (CET)",
            "by mail-wr1-x42d.google.com with SMTP id p9so23068375wra.12\r\n\tfor <libcamera-devel@lists.libcamera.org>;\r\n\tMon, 07 Mar 2022 04:46:42 -0800 (PST)",
            "from naush-laptop.pitowers.org\r\n\t([2a00:1098:3142:14:c644:e9b3:de0b:54c5])\r\n\tby smtp.gmail.com with ESMTPSA id\r\n\tz6-20020a1cf406000000b0037c4e2d3baesm19759582wma.19.2022.03.07.04.46.41\r\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\r\n\tMon, 07 Mar 2022 04:46:41 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\r\n\ts=mail; t=1646657206;\r\n\tbh=89vP4h/0JGP1S0biwi5aT70xvGgC0Q2ql9qcMP/BapY=;\r\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\r\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\r\n\tFrom;\r\n\tb=h8OxAXJwRq67UePrkE4bBHAiqVMKdhM2eQ6qvogfTJ79oiMnxSXsZQfAils37JpGU\r\n\t3sSOJwKO24cOImlxr6wbPpCS3BhJX6mEoaEDlDlTQyCmk4W0LztLNLvFHH3aJeh/1V\r\n\tLuKGN/oUKHJJGjsdxbNITpg0Yf9UU1tipqFJuGBueO94cS7UPMxv3FvP8zR2c8CSAr\r\n\tgc5NQCd4j0H0ltJfjRqZJf62Mj5njYAibfA3aI57BAiVX4uY/c8E/x3deS9Up2V0yo\r\n\tXybJgnQHSXKqGM1c54ikaFVyLO2cC78ztemPgJcYWygmSKwHXGySbeFnaSx/ZKN3Zr\r\n\tvoWxc+LT1kYrQ==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\r\n\td=raspberrypi.com; s=google;\r\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\r\n\t:mime-version:content-transfer-encoding;\r\n\tbh=Bnmw6O5W7PZnoxsUF508AY4VM/IN+j4579ahBbZHVc4=;\r\n\tb=X7sGvniJQC59sOcX5aWGyi89Nu7r4sryVVMxgqb0K3flEntjvDwBsSDd9avP7emSLT\r\n\t3+JEDwrASHeruiViHvp9FsrrLpDbBPZgRSuoQMKpisfpdj+rKA0iSOLfhN3TcJEHQ+fV\r\n\tw3zpxqy3khFq4Gs+vUgxCMWOv0dMJGDqapWXr44mSh+A7ZycSMmRUZPOPFGZTUp8vMvF\r\n\tFdYxbSTKMB4nwDFJiRa3Qv1z9OuTLXZXvT1t7HbhVJ1gx1AdEn8AvZzFq1aJJCNF5Dp6\r\n\tjBlppHrfba6ta2x90VLKdULmHtjgwxWMIi+DC7O8Xz45zOdDjoli+sInfBPyuhSEtdDU\r\n\t5maA=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \r\n\tunprotected) header.d=raspberrypi.com\r\n\theader.i=@raspberrypi.com\r\n\theader.b=\"X7sGvniJ\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\r\n\td=1e100.net; s=20210112;\r\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r\n\t:references:mime-version:content-transfer-encoding;\r\n\tbh=Bnmw6O5W7PZnoxsUF508AY4VM/IN+j4579ahBbZHVc4=;\r\n\tb=MN0fph7RRN2/4tnfE1hHO2tpvBLnWE4RDAjJL1ssmGD4LLVi30DEYBZEJuh6e/FIrL\r\n\t4qKoTAlmMF7A3rKRguvQkiXd6ZKcVDpdl7980B+wBdHjPHpSua+Zeo6Jl9LrTMS+ukGB\r\n\tNXOIeb2RGV+UQzBa449Quabf8lkyJ99sllLMT5zFxqvhfPJrsWidh0HS1nlHT/LHMA5V\r\n\t62h2dUOp7UH+BRFuo84jvWJrsELAxzxhv3iCN2b2dvYf1sP8i/K8FOHqTdsp0O8p5xTM\r\n\tgbaMTDvqzl1C0TFttD4wx4FiEkiTXHHHR2p1ZfaequEDiXSup0JF3FO5HrbSQMawCyon\r\n\t8FjA==",
        "X-Gm-Message-State": "AOAM533YHcmT0ucYuaspiCvvFNqXtM8y6QGq5sCGzVRibv93uXFB67vD\r\n\tVFYRGvj653ACnmZkdci0QbASR15jLR1QYg==",
        "X-Google-Smtp-Source": "ABdhPJzMzJSUhF8aji/7BJMx93k19GwQSj9pfAaGoeIVLu2gjPM+Ix3Jxil3zwtidUp+j+IW8tulIg==",
        "X-Received": "by 2002:adf:f48e:0:b0:1f0:636a:1bbd with SMTP id\r\n\tl14-20020adff48e000000b001f0636a1bbdmr8472956wro.580.1646657202339; \r\n\tMon, 07 Mar 2022 04:46:42 -0800 (PST)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon,  7 Mar 2022 12:46:32 +0000",
        "Message-Id": "<20220307124633.115452-6-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20220307124633.115452-1-naush@raspberrypi.com>",
        "References": "<20220307124633.115452-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v1 5/6] pipeline: raspberrypi: Repurpose\r\n\tRPi::Stream::reset()",
        "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>,\r\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>,\r\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "From": "Naushir Patuck via libcamera-devel\r\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Naushir Patuck <naush@raspberrypi.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The original use of RPi::Stream::reset() was to clear the external flag state\nand free/clear out the framebuffers for the stream. However, the latter is now\ndone through PipelineHandlerRPi::configure(). Rework\nPipelineHandlerRPi::configure() to call RPi::Stream::setExternal() instead of\nRPi::Stream::reset() to achieve the same thing.\n\nRepurpose RPi::Stream::reset() to instead reset the state of the buffer handling\nlogic, where all internally allocated buffers are put back into the queue of\navailable buffers. This reset() is now called from PipelineHandlerRPi::start(),\nallowing the pipeline handler to correctly deal with start()/stop()/start()\nsequences and reusing the buffers allocated on the first start().\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/libcamera/pipeline/raspberrypi/raspberrypi.cpp |  5 ++++-\n src/libcamera/pipeline/raspberrypi/rpi_stream.cpp  | 11 +++++------\n 2 files changed, 9 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\r\nindex b17ffa235ac7..193361686d3c 100644\r\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\r\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\r\n@@ -692,7 +692,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\r\n \t/* Start by freeing all buffers and resetting the Unicam and ISP stream states. */\r\n \tdata->freeBuffers();\r\n \tfor (auto const stream : data->streams_)\r\n-\t\tstream->reset();\r\n+\t\tstream->setExternal(false);\r\n \r\n \tBayerFormat::Packing packing = BayerFormat::Packing::CSI2;\r\n \tSize maxSize, sensorSize;\r\n@@ -985,6 +985,9 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)\r\n \tRPiCameraData *data = cameraData(camera);\r\n \tint ret;\r\n \r\n+\tfor (auto const stream : data->streams_)\r\n+\t\tstream->reset();\r\n+\r\n \tif (data->reconfigured_) {\r\n \t\t/* Allocate buffers for internal pipeline usage. */\r\n \t\tret = prepareBuffers(camera);\r\ndiff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp\r\nindex f446e1ce66c7..0840ec4f54a0 100644\r\n--- a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp\r\n+++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp\r\n@@ -28,8 +28,10 @@ std::string Stream::name() const\r\n \r\n void Stream::reset()\r\n {\r\n-\texternal_ = false;\r\n-\tclearBuffers();\r\n+\t/* Add all internal buffers to the queue of usable buffers. */\r\n+\tavailableBuffers_ = {};\r\n+\tfor (auto const &buffer : internalBuffers_)\r\n+\t\tavailableBuffers_.push(buffer.get());\r\n }\r\n \r\n void Stream::setExternal(bool external)\r\n@@ -97,10 +99,7 @@ int Stream::prepareBuffers(unsigned int count)\r\n \r\n \t\t\t/* Add these exported buffers to the internal/external buffer list. */\r\n \t\t\tsetExportedBuffers(&internalBuffers_);\r\n-\r\n-\t\t\t/* Add these buffers to the queue of internal usable buffers. */\r\n-\t\t\tfor (auto const &buffer : internalBuffers_)\r\n-\t\t\t\tavailableBuffers_.push(buffer.get());\r\n+\t\t\treset();\r\n \t\t}\r\n \r\n \t\t/* We must import all internal/external exported buffers. */",
    "prefixes": [
        "libcamera-devel",
        "v1",
        "5/6"
    ]
}