Patch Detail
Show a patch.
GET /api/patches/17967/?format=api
{ "id": 17967, "url": "https://patchwork.libcamera.org/api/patches/17967/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17967/", "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": "<20221209090050.19441-4-naush@raspberrypi.com>", "date": "2022-12-09T09:00:41", "name": "[libcamera-devel,v4,03/12] pipeline: raspberrypi: Add a pipeline config structure", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "042ecf407d5983ed63eb01cd6b257a411abfdacf", "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/17967/mbox/", "series": [ { "id": 3663, "url": "https://patchwork.libcamera.org/api/series/3663/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3663", "date": "2022-12-09T09:00:38", "name": "Raspberry Pi: Platform configuration and buffer allocation improvements", "version": 4, "mbox": "https://patchwork.libcamera.org/series/3663/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17967/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17967/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 CA265C3284\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 9 Dec 2022 09:01:34 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 42EAB63359;\n\tFri, 9 Dec 2022 10:01:34 +0100 (CET)", "from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com\n\t[IPv6:2a00:1450:4864:20::32b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4CB1063354\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 9 Dec 2022 10:01:31 +0100 (CET)", "by mail-wm1-x32b.google.com with SMTP id\n\tc65-20020a1c3544000000b003cfffd00fc0so5275995wma.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 09 Dec 2022 01:01:31 -0800 (PST)", "from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tbd10-20020a05600c1f0a00b003cf774c31a0sm7773674wmb.16.2022.12.09.01.01.29\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 09 Dec 2022 01:01:29 -0800 (PST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1670576494;\n\tbh=bvVkHJiRMJT6sy5clbtelAObI9I7JqaXleneN4SN/4M=;\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=ddnXIX5t/MfnzWjcwbSs0rrE6YTW0+Cy5UBDzzRP0LaSREKFmX81toK2b8Lor/Wey\n\tfMUUeN7k4yARUMF4bXIalhOx4He3zE5f3UnV6a1kI0SeX5em7C9o3wUMWNEvnMNg6G\n\tK8zO8a2BTwoJSlThTzms8M0/7Wo8U0j7tx6H8/qLuEXEWPvksQt8NBxQO92LixdZ8X\n\tnkDQGeAD5eSmJum011g39Ezz3qSEr1X8lbM8ABeiuldMRLLOsSrMRwJd4LCaASFdV0\n\tRhFrs1Fx1u970LzXD65t8jvB3NhGihJDwoPVW1BomTwkEbbKU47oGUlmTI7Ov7L/rD\n\tOhdSTZPnuWc7w==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=zdIqKZFO5XnrvS7lzwMoLcIDnFJDKdJhRwo2YCjQSZo=;\n\tb=r39S8mmlRUgKRTOIJVAPHd/sDSbc/whV+N0tC6dj+hcUelaz2bvMAjGCaKFOBM8L2x\n\tJIwOkzYutnoofudStvpm8OHrrt+m4d7gRc8lQcvcGR8AahwQ5Vj0m9f1Uj6WvpC8dltf\n\tB5sPeCA5+fr7K6oZZ6HaYBG9KbIAmoDvGw/QVQsNqqn9gUrMQfpotTubY3wglofTBiO5\n\tPQnSBxRA8ujykFDCy4YS/s2XT/nCpktrBnuFk5g4L0+y7pahC2wAdy/bBzUgtFNJwF8J\n\tX1rkIOa8rwE3dQjpMBDdIwa8KTjyMVfbHqHSPcSmXV6IaU1cq0Ropb84/1KZ/KL9I5G7\n\t2Wyw==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"r39S8mml\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=zdIqKZFO5XnrvS7lzwMoLcIDnFJDKdJhRwo2YCjQSZo=;\n\tb=6UhKxnnr/yUVoXP6vwbdjKMxQiLsA+CXk6QN/LoZS7zsRo+xqscx4MZpsvt9ywdJp6\n\tAslrY12590DSAlBN1E0sN5o75A9gUdVsDKIP+P0LaPA2GTDuJmuPcT9/XVfsJwgCJpxX\n\tgzhAM2zjaTsgmSVj2+yW71TYhbxo3iG9SZWbBpmREO9lbpWDr3nVoGQUD35C8zoelifq\n\tgz64wsvLV0jFSqXYNyjG1p+5PFEOLfFFrW3g790yPIYVRf/HZgfKCUGKuL9aglRwdJqx\n\tD5Y2gAedYmVkMlfhgByaj/7Io5RJWtEWOE/jlf5SK2/GDSBl32J2Pg043vb6iOXZdeG1\n\tonXw==", "X-Gm-Message-State": "ANoB5plmu7yCZhS2dnhDJDSOB11PbZPECQQs8jrjr55X1X94ZYOgKKTr\n\tqeZCW8zfZtkie+WZvicTFcMBoZk3POyDCOq3", "X-Google-Smtp-Source": "AA0mqf6F3x8ewWvCo7ZkelgAXgz0+3sDagsQT5cf/tZb61aySkvcuwpbBGfeGim3COYONWime86bQQ==", "X-Received": "by 2002:a7b:c30e:0:b0:3c6:e63d:fcf6 with SMTP id\n\tk14-20020a7bc30e000000b003c6e63dfcf6mr4345931wmj.29.1670576490551; \n\tFri, 09 Dec 2022 01:01:30 -0800 (PST)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 9 Dec 2022 09:00:41 +0000", "Message-Id": "<20221209090050.19441-4-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20221209090050.19441-1-naush@raspberrypi.com>", "References": "<20221209090050.19441-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 03/12] pipeline: raspberrypi: Add a\n\tpipeline config structure", "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": "Add a configuration structure to store platform specific parameters used by\nthe pipeline handler. Currently, these only store Unicam buffer counts,\nreplacing the hardcoded static values in the source code.\n\nIn subsequent commits, more parameters will be added to the configuration\nstructure, and parameters will be read in through a config file.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp | 49 ++++++++++++++++---\n 1 file changed, 42 insertions(+), 7 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 0e0b71945640..f6388d63416b 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -199,6 +199,7 @@ public:\n \n \tint loadIPA(ipa::RPi::IPAInitResult *result);\n \tint configureIPA(const CameraConfiguration *config, ipa::RPi::IPAConfigResult *result);\n+\tint configurePipeline();\n \n \tvoid enumerateVideoDevices(MediaLink *link);\n \n@@ -294,6 +295,21 @@ public:\n \t/* Have internal buffers been allocated? */\n \tbool buffersAllocated_;\n \n+\tstruct Config {\n+\t\t/*\n+\t\t * The minimum number of internal buffers to be allocated for\n+\t\t * the Unicam Image stream.\n+\t\t */\n+\t\tunsigned int minUnicamBuffers;\n+\t\t/*\n+\t\t * The minimum total (internal + external) buffer count used for\n+\t\t * the Unicam Image stream.\n+\t\t */\n+\t\tunsigned int minTotalUnicamBuffers;\n+\t};\n+\n+\tConfig config_;\n+\n private:\n \tvoid checkRequestCompleted();\n \tvoid fillRequestMetadata(const ControlList &bufferControls,\n@@ -1377,6 +1393,12 @@ int PipelineHandlerRPi::registerCamera(MediaDevice *unicam, MediaDevice *isp, Me\n \tstreams.insert(&data->isp_[Isp::Output0]);\n \tstreams.insert(&data->isp_[Isp::Output1]);\n \n+\tint ret = data->configurePipeline();\n+\tif (ret) {\n+\t\tLOG(RPI, Error) << \"Unable to load pipeline handler configuration\";\n+\t\treturn ret;\n+\t}\n+\n \t/* Create and register the camera. */\n \tconst std::string &id = data->sensor_->id();\n \tstd::shared_ptr<Camera> camera =\n@@ -1439,25 +1461,28 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera)\n \tfor (auto const stream : data->streams_) {\n \t\tunsigned int numBuffers;\n \t\t/*\n-\t\t * For Unicam, allocate a minimum of 4 buffers as we want\n-\t\t * to avoid any frame drops.\n+\t\t * For Unicam, allocate a minimum number of buffers for internal\n+\t\t * use as we want to avoid any frame drops.\n \t\t */\n-\t\tconstexpr unsigned int minBuffers = 4;\n+\t\tconst unsigned int minBuffers = data->config_.minTotalUnicamBuffers;\n \t\tif (stream == &data->unicam_[Unicam::Image]) {\n \t\t\t/*\n \t\t\t * If an application has configured a RAW stream, allocate\n \t\t\t * additional buffers to make up the minimum, but ensure\n-\t\t\t * we have at least 2 sets of internal buffers to use to\n-\t\t\t * minimise frame drops.\n+\t\t\t * we have at least minUnicamBuffers of internal buffers\n+\t\t\t * to use to minimise frame drops.\n \t\t\t */\n-\t\t\tnumBuffers = std::max<int>(2, minBuffers - numRawBuffers);\n+\t\t\tnumBuffers = std::max<int>(data->config_.minUnicamBuffers,\n+\t\t\t\t\t\t minBuffers - numRawBuffers);\n \t\t} else if (stream == &data->isp_[Isp::Input]) {\n \t\t\t/*\n \t\t\t * ISP input buffers are imported from Unicam, so follow\n \t\t\t * similar logic as above to count all the RAW buffers\n \t\t\t * available.\n \t\t\t */\n-\t\t\tnumBuffers = numRawBuffers + std::max<int>(2, minBuffers - numRawBuffers);\n+\t\t\tnumBuffers = numRawBuffers +\n+\t\t\t\t std::max<int>(data->config_.minUnicamBuffers,\n+\t\t\t\t\t\t minBuffers - numRawBuffers);\n \n \t\t} else if (stream == &data->unicam_[Unicam::Embedded]) {\n \t\t\t/*\n@@ -1630,6 +1655,16 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::IPA\n \treturn 0;\n }\n \n+int RPiCameraData::configurePipeline()\n+{\n+\tconfig_ = {\n+\t\t.minUnicamBuffers = 2,\n+\t\t.minTotalUnicamBuffers = 4,\n+\t};\n+\n+\treturn 0;\n+}\n+\n /*\n * enumerateVideoDevices() iterates over the Media Controller topology, starting\n * at the sensor and finishing at Unicam. For each sensor, RPiCameraData stores\n", "prefixes": [ "libcamera-devel", "v4", "03/12" ] }