Patch Detail
Show a patch.
GET /api/patches/15474/?format=api
{ "id": 15474, "url": "https://patchwork.libcamera.org/api/patches/15474/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15474/", "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": "<20220317140827.1835029-5-naush@raspberrypi.com>", "date": "2022-03-17T14:08:25", "name": "[libcamera-devel,v2,4/6] pipeline: raspberrypi: Repurpose RPi::Stream::reset()", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "cb04a7e57e2a8af35d46408a5f509e50798da900", "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/15474/mbox/", "series": [ { "id": 2972, "url": "https://patchwork.libcamera.org/api/series/2972/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2972", "date": "2022-03-17T14:08:21", "name": "Raspberry Pi: Efficient start/stop/start sequences", "version": 2, "mbox": "https://patchwork.libcamera.org/series/2972/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15474/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15474/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 EDED8C3263\r\n\tfor <parsemail@patchwork.libcamera.org>;\r\n\tThu, 17 Mar 2022 14:08:39 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\r\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 77382604E8;\r\n\tThu, 17 Mar 2022 15:08:39 +0100 (CET)", "from mail-wm1-x331.google.com (mail-wm1-x331.google.com\r\n\t[IPv6:2a00:1450:4864:20::331])\r\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6E82A610F8\r\n\tfor <libcamera-devel@lists.libcamera.org>;\r\n\tThu, 17 Mar 2022 15:08:36 +0100 (CET)", "by mail-wm1-x331.google.com with SMTP id\r\n\t7-20020a05600c228700b00385fd860f49so3262812wmf.0\r\n\tfor <libcamera-devel@lists.libcamera.org>;\r\n\tThu, 17 Mar 2022 07:08:36 -0700 (PDT)", "from naush-laptop.pitowers.org\r\n\t([2a00:1098:3142:14:371b:8e01:111f:5322])\r\n\tby smtp.gmail.com with ESMTPSA id\r\n\tz5-20020a05600c0a0500b0037fa93193a8sm5287831wmp.44.2022.03.17.07.08.34\r\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\r\n\tThu, 17 Mar 2022 07:08:35 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\r\n\ts=mail; t=1647526119;\r\n\tbh=hmW0dmL2Wn0CwrkkMd1DI57vr+ZJMXzXlvy1PzDbD2M=;\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=VU7SDRnYwnINcmLUPw9O34c915MF35hvMcRwjPvx35W7eE2xELFU3LklCIcfGnu08\r\n\tzHfltfcPx8FJoZWcFn19nbE4MCe7A5BCmV1yIMzpZMWLl/TxNgQPuUBBh6LLCbUjeq\r\n\tJoUpKhqisWPBcv7/MqUehK2dI6tbmkXCQZosLDFnSqnO0lMkl39suvY1BnBSq4IrYJ\r\n\tj4cXp7eNM8eXkPZjrgRFEtsjR5X+A8MOvgG4x3NKMQdanXgyGSBKGSbRo/qaD7nprq\r\n\t5PtLLc+D1w7Y2Rp4C8hbde6JgCOZPX6H+5wuV8eu3N+CX1asiRyN+wMwxOn6BiVESj\r\n\t4/gYOKC3TiruA==", "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=uTP8kcdMePVoTNBWCwW1qpevafEXXGJwaf+aCHPyhj0=;\r\n\tb=tPeplFVy3Dm0HbpxESiFay7gTZm1DVaO00pIaL3H1vMjpfe9voFgaiN4JQx8M7NcC4\r\n\tLZ/gE8AkexvTKgKug710HxU3uxrbeVu9Khtly6FTe5MLzUlPrsjidRKPKSFfS/raMUnE\r\n\ti53jwmfxqm+Z0q6iLAtVFQVa2qzmU9sX5Q/3VRdwjLKnSRiWRndc7Ns2gD0Qa0hxj1ya\r\n\tXA4+ADBSYpnN3Z1+rU3kK8iywbRCht8st60DWPWK//1jlmuhjxKK3WsCnJR3AgxxgVu1\r\n\tW2I6ZMbUP8p2IJOzFyh63sE5/2gVV7eBAxBMCDwnUTgPDUcgCF7efcD4BvoJAae/ueYq\r\n\tw3fQ==" ], "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=\"tPeplFVy\"; 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=uTP8kcdMePVoTNBWCwW1qpevafEXXGJwaf+aCHPyhj0=;\r\n\tb=2AzuaWkMNYjtAxEgZxh7y2FMS9NctH1lipz40ndg9mwMG5ady8N30PO4nduF7Z3hBd\r\n\tb/unR7UaAx0MF9g1R+ELb2e3F1qmdss+EMXPJwp86O+ijZOvWZvHvemagST9Ly1gZ2I2\r\n\t+4jbIjoXOpt6N1XwGb4lZR/Q9Y1BZw6Si1ITYfeC/5FR9hGzXiWqKS/3L4BXZtUpXyW9\r\n\tfq/M6FkLG3NNwdPi6/hnUEvidsVRvLX+M0h5xUl6z98H3wdOd+D2ER6rKTuRmD8/ojwp\r\n\t9MW9pcn3uNj092QvVu+ZbPGoDyh7zN8BCpnLo0qbOAc2GQe/Ba/VYuTzbfITXbfrtHPX\r\n\tzT5A==", "X-Gm-Message-State": "AOAM533wvm5A6o/hV4akHQCo4RwOyEal2krzIdTEL0oQcalAP+AebyJH\r\n\tg4trFYDXUjJEJfcyaYU/okJXciS1RzcMCg==", "X-Google-Smtp-Source": "ABdhPJxHq7Cq670cMcskQR2Hmxa0NyPC+qGQLOAFUNN0E39WdSYXqo8BN0MXjsmhdzjl95uX8mvWSA==", "X-Received": "by 2002:a1c:f018:0:b0:37b:c13c:3128 with SMTP id\r\n\ta24-20020a1cf018000000b0037bc13c3128mr11577599wmb.157.1647526115869; \r\n\tThu, 17 Mar 2022 07:08:35 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 17 Mar 2022 14:08:25 +0000", "Message-Id": "<20220317140827.1835029-5-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20220317140827.1835029-1-naush@raspberrypi.com>", "References": "<20220317140827.1835029-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 4/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. As such, rename the function to RPi::Stream::resetbuffers()\nThis resetbuffers() is now called from PipelineHandlerRPi::start(), allowing the\npipeline handler to correctly deal with start()/stop()/start() sequences and\nreusing the buffers allocated on the first start().\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nTested-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 7 +++++--\n src/libcamera/pipeline/raspberrypi/rpi_stream.cpp | 13 ++++++-------\n src/libcamera/pipeline/raspberrypi/rpi_stream.h | 2 +-\n 3 files changed, 12 insertions(+), 10 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\r\nindex 082273828894..d3212b193ced 100644\r\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\r\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\r\n@@ -693,7 +693,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\r\n \t/* Start by freeing all buffers and reset 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@@ -991,6 +991,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->resetBuffers();\r\n+\r\n \tif (data->reallocate_) {\r\n \t\t/* Allocate buffers for internal pipeline usage. */\r\n \t\tret = prepareBuffers(camera);\r\n@@ -1031,7 +1034,7 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)\r\n \tdata->unicam_[Unicam::Image].dev()->setFrameStartEnabled(true);\r\n \r\n \t/*\r\n-\t * Reset the delayed controls with the gain and exposure values set by\r\n+\t * resetBuffers the delayed controls with the gain and exposure values set by\r\n \t * the IPA.\r\n \t */\r\n \tdata->delayedCtrls_->reset();\r\ndiff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp\r\nindex f446e1ce66c7..7a93efaa29da 100644\r\n--- a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp\r\n+++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp\r\n@@ -26,10 +26,12 @@ std::string Stream::name() const\r\n \treturn name_;\r\n }\r\n \r\n-void Stream::reset()\r\n+void Stream::resetBuffers()\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\tresetBuffers();\r\n \t\t}\r\n \r\n \t\t/* We must import all internal/external exported buffers. */\r\ndiff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.h b/src/libcamera/pipeline/raspberrypi/rpi_stream.h\r\nindex d6f49d34f8c8..c37f7e82eef6 100644\r\n--- a/src/libcamera/pipeline/raspberrypi/rpi_stream.h\r\n+++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.h\r\n@@ -45,7 +45,7 @@ public:\r\n \tV4L2VideoDevice *dev() const;\r\n \tstd::string name() const;\r\n \tbool isImporter() const;\r\n-\tvoid reset();\r\n+\tvoid resetBuffers();\r\n \r\n \tvoid setExternal(bool external);\r\n \tbool isExternal() const;", "prefixes": [ "libcamera-devel", "v2", "4/6" ] }