Patch Detail
Show a patch.
GET /api/patches/15501/?format=api
{ "id": 15501, "url": "https://patchwork.libcamera.org/api/patches/15501/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15501/", "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": "<20220322092257.2713521-5-naush@raspberrypi.com>", "date": "2022-03-22T09:22:53", "name": "[libcamera-devel,v4,4/8] pipeline: raspberrypi: Repurpose RPi::Stream::reset()", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "2d6c6cc923f4a3395263733a081619094305e9bc", "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/15501/mbox/", "series": [ { "id": 2982, "url": "https://patchwork.libcamera.org/api/series/2982/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2982", "date": "2022-03-22T09:22:49", "name": "Raspberry Pi: Efficient start/stop/start sequences", "version": 4, "mbox": "https://patchwork.libcamera.org/series/2982/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15501/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15501/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 39DC1BD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Mar 2022 09:23:08 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 93E01610F8;\n\tTue, 22 Mar 2022 10:23:07 +0100 (CET)", "from mail-wm1-x330.google.com (mail-wm1-x330.google.com\n\t[IPv6:2a00:1450:4864:20::330])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 02085604E9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Mar 2022 10:23:04 +0100 (CET)", "by mail-wm1-x330.google.com with SMTP id\n\tj13-20020a05600c1c0d00b0038c8f94aac2so1016316wms.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Mar 2022 02:23:03 -0700 (PDT)", "from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:9e9a:99af:e5a6:319b])\n\tby smtp.gmail.com with ESMTPSA id\n\tr14-20020a05600c35ce00b0038c9f469979sm1471695wmq.40.2022.03.22.02.23.02\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 22 Mar 2022 02:23:02 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647940987;\n\tbh=LAyJvKIGT2q0yec59HHtU1koPIGLOBZBSrRmPJWFo0Y=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=qmZAH7cu1K29ToSzzGqTRa3Tbmf23kM6QdqKl9vlT3TDWhx8TXsvWmxLVQx66t8F7\n\tEMnvVIr0m89oKxZgW5hRmRxIQEO1ufun92t4TQuDZftFX3jhKa4S+hScPTPAVJVu8d\n\tNIIcJ4LzDnCOjAIU4MA05DfzBGDPD/Q9Cipt1mmGjbrwJ1TzhkHo/JTpKv0Q27UT/3\n\tSCn5DA/N7nTxGprqWP4a0siOCODU22sM7Odqv3GOqCHHalHiswzSwpF1zWKnWCK8Rl\n\tkIw9xSmzNEHLn0PrVDBt8DOK5b+xe3Ldgp1Wn7lSPhzsWrVfh2G2YR5rcnqyMM4hBq\n\tbUHZrnZdnh3rg==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=y+AU3uHdQY363TBVi7RlIPz9CMOUvtyCfstDvCKShdo=;\n\tb=SH+6Sp3OZ+BxwKDy2RkHKHNyPCrUBuX2qcl/TZghRS5irAogZIok7KtlPA6Zwras5z\n\t3TSZ4eiBLZUx0VBclt6K8GaqFDlFSwlhYtxyA9cf910h4Wv9DOwTsY9CxT4Eu97kvoAH\n\tVlRlSAA4HOOZhdQYneUOfzrQw9TaVf3SyLWv6oThfsrYTBW7tVzPIQszB8MP5JKeKq+D\n\trxyAUyY/Kt4kLiuoIilW9PbfNHykS5ruNfHkj8Kxe3Nd90/7umCMOwnwcvRQS/zfJBSH\n\tfvOoqhi/vz/2DPku7/WFGtZDXAXzOR0mk/Eu6Zm6vLGluQL0sOzNQXh7MFoYpppb6I1J\n\tB0ew==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"SH+6Sp3O\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\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=y+AU3uHdQY363TBVi7RlIPz9CMOUvtyCfstDvCKShdo=;\n\tb=vkCqPe2hQbMy1L5lD6Z02XMmH6BwThDq8FqfGUZnfJ3PgDcZ1BsSzvqqc9Uh3Ipz+E\n\twJuYi78gF1MElVIeNey4zwti9Ywbsb/rR9w3Vag9ICKxpWD4F7siZGdRbnWRHMiRmOuE\n\tDgJFEGlWYWYuz9y2XhsKQpjhfncewZJo9ZYumL0wn5vVFjcrqrvMIhPbfxh7aSR/MM0x\n\tMXQTysjFtpv41WA/Dl3Y7aNaENaAqhbD0wEslPC3wO3yO0K7BP17IqTGQLQIdaFxcwU1\n\tkIQ32DC/TvSUfAUgGmpJOnqgB+R9i8uPfu5beikcuLQSozLzbyuS8mDcxoraOQhIy5Wu\n\tAGUg==", "X-Gm-Message-State": "AOAM531dePAmYyPSowKKoDneW4fArfiODhCCe4ehilkQA2qrfaQQJ/f8\n\tA2KG3U8yAGFSDiqqkVfZxPdFPvjLsI8bUQ==", "X-Google-Smtp-Source": "ABdhPJwXtFDPMmjLgtK0rd3ynoC42dsmVZu5vaM3URRafdnQg3WjgiWysuXe9/l6U6IGpkzxRxHjQg==", "X-Received": "by 2002:a1c:f415:0:b0:37f:ab4d:1df2 with SMTP id\n\tz21-20020a1cf415000000b0037fab4d1df2mr2746893wma.75.1647940983474; \n\tTue, 22 Mar 2022 02:23:03 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 22 Mar 2022 09:22:53 +0000", "Message-Id": "<20220322092257.2713521-5-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20220322092257.2713521-1-naush@raspberrypi.com>", "References": "<20220322092257.2713521-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 4/8] pipeline: raspberrypi: Repurpose\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>,\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>", "From": "Naushir Patuck via libcamera-devel\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>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 5 ++++-\n src/libcamera/pipeline/raspberrypi/rpi_stream.cpp | 13 ++++++-------\n src/libcamera/pipeline/raspberrypi/rpi_stream.h | 2 +-\n 3 files changed, 11 insertions(+), 9 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 92043962494b..8fd79be67988 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -693,7 +693,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n \t/* Start by freeing all buffers and reset the Unicam and ISP stream states. */\n \tdata->freeBuffers();\n \tfor (auto const stream : data->streams_)\n-\t\tstream->reset();\n+\t\tstream->setExternal(false);\n \n \tBayerFormat::Packing packing = BayerFormat::Packing::CSI2;\n \tSize maxSize, sensorSize;\n@@ -991,6 +991,9 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)\n \tRPiCameraData *data = cameraData(camera);\n \tint ret;\n \n+\tfor (auto const stream : data->streams_)\n+\t\tstream->resetBuffers();\n+\n \tif (!data->buffersAllocated_) {\n \t\t/* Allocate buffers for internal pipeline usage. */\n \t\tret = prepareBuffers(camera);\ndiff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp\nindex f446e1ce66c7..7a93efaa29da 100644\n--- a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp\n@@ -26,10 +26,12 @@ std::string Stream::name() const\n \treturn name_;\n }\n \n-void Stream::reset()\n+void Stream::resetBuffers()\n {\n-\texternal_ = false;\n-\tclearBuffers();\n+\t/* Add all internal buffers to the queue of usable buffers. */\n+\tavailableBuffers_ = {};\n+\tfor (auto const &buffer : internalBuffers_)\n+\t\tavailableBuffers_.push(buffer.get());\n }\n \n void Stream::setExternal(bool external)\n@@ -97,10 +99,7 @@ int Stream::prepareBuffers(unsigned int count)\n \n \t\t\t/* Add these exported buffers to the internal/external buffer list. */\n \t\t\tsetExportedBuffers(&internalBuffers_);\n-\n-\t\t\t/* Add these buffers to the queue of internal usable buffers. */\n-\t\t\tfor (auto const &buffer : internalBuffers_)\n-\t\t\t\tavailableBuffers_.push(buffer.get());\n+\t\t\tresetBuffers();\n \t\t}\n \n \t\t/* We must import all internal/external exported buffers. */\ndiff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.h b/src/libcamera/pipeline/raspberrypi/rpi_stream.h\nindex d6f49d34f8c8..c37f7e82eef6 100644\n--- a/src/libcamera/pipeline/raspberrypi/rpi_stream.h\n+++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.h\n@@ -45,7 +45,7 @@ public:\n \tV4L2VideoDevice *dev() const;\n \tstd::string name() const;\n \tbool isImporter() const;\n-\tvoid reset();\n+\tvoid resetBuffers();\n \n \tvoid setExternal(bool external);\n \tbool isExternal() const;\n", "prefixes": [ "libcamera-devel", "v4", "4/8" ] }