{"id":17914,"url":"https://patchwork.libcamera.org/api/1.1/patches/17914/?format=json","web_url":"https://patchwork.libcamera.org/patch/17914/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20221129134534.2933-8-naush@raspberrypi.com>","date":"2022-11-29T13:45:31","name":"[libcamera-devel,v2,07/10] pipeline: raspberrypi: Add a parameter to disable startup drop frames","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"314edea8d7dd85d2b6ab5b0b44e1fca3b0e7efd3","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17914/mbox/","series":[{"id":3647,"url":"https://patchwork.libcamera.org/api/1.1/series/3647/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3647","date":"2022-11-29T13:45:24","name":"Raspberry Pi: Platform configuration and buffer allocation improvements","version":2,"mbox":"https://patchwork.libcamera.org/series/3647/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17914/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17914/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 7EC4DC3286\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 29 Nov 2022 13:45:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3F5E763348;\n\tTue, 29 Nov 2022 14:45:50 +0100 (CET)","from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com\n\t[IPv6:2a00:1450:4864:20::42d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 650CA63349\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 29 Nov 2022 14:45:43 +0100 (CET)","by mail-wr1-x42d.google.com with SMTP id x17so22144311wrn.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 29 Nov 2022 05:45:43 -0800 (PST)","from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tn8-20020a05600c3b8800b003cfbbd54178sm3565636wms.2.2022.11.29.05.45.42\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 29 Nov 2022 05:45:42 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669729550;\n\tbh=xiZKOmMKgh4C0BiQ8C7Rx95IlKX9+MUIw2e5+Hw+o4I=;\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=SMdqRRTfFQhfYbELezwVbRSTU28gNpdy5iYn3UlzcM0Ut0j/nQeUtor0erkepH+jb\n\tW5R82LoCVH8XzU40Kg/obhfGINzO6QdSHTfvX3g6wMzNfy+fZzfzCATdwrJxFzy/cU\n\tuPhC7jjT9SeteTiF4eA1SLqrSJkGUHSL7W1v/OFGkAVcQitEMY/Xpt8TfQEbDNct3h\n\tlZ50nloKe8jSX0W4l+ABB7GZ91ejYU/mU9MvPf9M6ar108IzucMNROisRuBhoKcyop\n\tUcAnx6s4HI9o/q7AU51RXBTvw6M68nrEbEZdmYBGt3xaQ++/7+jtJ47Y7Gpo+tnjGs\n\t81cViQ2sY1jRw==","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=0JEGK22eBqrjF4esosBG7CRFyk4lPiCqUBabBHzNiq0=;\n\tb=DKkjlUnq2Tr3oePdX2JuR74hGcSR9SKcrUHduqKsithxqWE3K/FtpeyPe42vTveX4f\n\tr38YtPUC1IYUWAtNlS5lKsBSTzliF1XcYY42XjyPtk0KHJOkx3hETlr2cQojIDhZBLeK\n\tU2vcrl1e5PwcuXAm9CuVbFVUticwQH+gnh6WBolNtcP8Oqga8bDThOOnKg3l6dCi9Q26\n\teg0/6CBoKkaJUjbCEKkniASdwWPLjitS+7QO/xRRvUfFT/rXHCq6oZyXz8ZFQmMIffJP\n\tUq7c3to8M58Y5RogtFKyGF2agO394Nk2WzuuwCdEY0hkuo9cNhsyFD3SkizwksPwRBxS\n\txtqg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"DKkjlUnq\"; 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=0JEGK22eBqrjF4esosBG7CRFyk4lPiCqUBabBHzNiq0=;\n\tb=wQ794QyI0lVuxOmmGjyhJmaYoMa4T+7nvU9rNi5VNXCJA/i2a7lgn5lstztUcaX2ZW\n\tKkFoCEtNgbgQfbHu0C5PtBa1jFjdTnZIQ8cYyk8qqNs44APV1sWgJkFgmhH0iqK7QdKG\n\t4GlB6W1fDLuo1gxEpz08S+0JdzOr73K7nvUOz6p5RTC7Iji7qB85UeodEthMRWIvu92r\n\t4T5GwZFWf3tfe9A2u/HFK8L+Mr2UX+QuztFB4CLTS2RmaGCrJdo69l6G3Jv4VzorfmUA\n\t3l4K+kQnRY+Xr7iOVs57plIRtDpXUPVnRzO+k8EXuKgETlQ77bhzaFW1BaLLsjpkuWQJ\n\trUgQ==","X-Gm-Message-State":"ANoB5pkJxsxAQwviDLVkpbRNEUifTkq3xkWoVkQfIXQy+rQ4w5EOQ47p\n\tTVFVKYHzqm9ASLenb8hJtT051VQ7c+Eg9Q==","X-Google-Smtp-Source":"AA0mqf6RRYAoCmdunkfZsiEZOJHCdIUh1jPG2vb/9P8823Kza5DrJ85LSTdhsLHOrViZvLVj7cCQkQ==","X-Received":"by 2002:adf:f8c4:0:b0:242:82f:88c8 with SMTP id\n\tf4-20020adff8c4000000b00242082f88c8mr12400365wrq.151.1669729542767; \n\tTue, 29 Nov 2022 05:45:42 -0800 (PST)","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 29 Nov 2022 13:45:31 +0000","Message-Id":"<20221129134534.2933-8-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20221129134534.2933-1-naush@raspberrypi.com>","References":"<20221129134534.2933-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 07/10] pipeline: raspberrypi: Add a\n\tparameter to disable startup drop frames","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 new pipeline config parameter \"disable_startup_frame_drops\" to disable\nany startup drop frames, overriding the IPA request.\n\nWhen this parameter is set, it allows the pipeline handler to run with no\ninternally allocated Unicam buffers (\"min_unicam_buffers\").\n\nAdd a validation to ensure if \"disable_startup_frame_drops\" is false, at least\none internal Unicam buffer is allocated, possibly overriding the\n\"min_unicam_buffers\" parameter.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n .../pipeline/raspberrypi/data/default.json    |  7 +++++--\n .../pipeline/raspberrypi/raspberrypi.cpp      | 19 ++++++++++++++++++-\n 2 files changed, 23 insertions(+), 3 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/raspberrypi/data/default.json b/src/libcamera/pipeline/raspberrypi/data/default.json\nindex a7ea735c87f4..707414bcc5c5 100644\n--- a/src/libcamera/pipeline/raspberrypi/data/default.json\n+++ b/src/libcamera/pipeline/raspberrypi/data/default.json\n@@ -5,7 +5,7 @@\n         \"pipeline_handler\":\n         {\n                 # The minimum number of internal buffers to be allocated for Unicam.\n-                # This value must be greater than 0, but less than or equal to min_total_unicam_buffers.\n+                # This value must less than or equal to min_total_unicam_buffers.\n                 \"min_unicam_buffers\": 2,\n \n                 # The minimum total (internal + external) buffer count used for Unicam.\n@@ -15,6 +15,9 @@\n                 \"min_total_unicam_buffers\": 4,\n                 \n                 # The number of internal buffers used for ISP Output0.\n-                \"num_output0_buffers\": 1\n+                \"num_output0_buffers\": 1,\n+\n+                # Override any request from the IPA to drop a number of startup frames.\n+                \"disable_startup_frame_drops\": false\n         }\n }\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 742521927780..ef49d32037af 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -312,6 +312,11 @@ public:\n \t\t * stream.\n \t\t */\n \t\tunsigned int numOutput0Buffers;\n+\t\t/*\n+\t\t * Override any request from the IPA to drop a number of startup\n+\t\t * frames.\n+\t\t */\n+\t\tbool disableStartupFrameDrops;\n \t};\n \n \tConfig config_;\n@@ -1058,7 +1063,7 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)\n \t\tdata->setSensorControls(startConfig.controls);\n \n \t/* Configure the number of dropped frames required on startup. */\n-\tdata->dropFrameCount_ = startConfig.dropFrameCount;\n+\tdata->dropFrameCount_ = data->config_.disableStartupFrameDrops ? 0 : startConfig.dropFrameCount;\n \n \tfor (auto const stream : data->streams_)\n \t\tstream->resetBuffers();\n@@ -1451,6 +1456,7 @@ int PipelineHandlerRPi::configurePipelineHandler(RPiCameraData *data)\n \t\t.minUnicamBuffers = 2,\n \t\t.minTotalUnicamBuffers = 4,\n \t\t.numOutput0Buffers = 1,\n+\t\t.disableStartupFrameDrops = false,\n \t};\n \n \tchar const *configFromEnv = utils::secure_getenv(\"LIBCAMERA_RPI_CONFIG_FILE\");\n@@ -1485,6 +1491,8 @@ int PipelineHandlerRPi::configurePipelineHandler(RPiCameraData *data)\n \t\tphConfig[\"min_total_unicam_buffers\"].get<unsigned int>(config.minTotalUnicamBuffers);\n \tconfig.numOutput0Buffers =\n \t\tphConfig[\"num_output0_buffers\"].get<unsigned int>(config.numOutput0Buffers);\n+\tconfig.disableStartupFrameDrops =\n+\t\tphConfig[\"disable_startup_frame_drops\"].get<bool>(config.disableStartupFrameDrops);\n \n \tif (config.minTotalUnicamBuffers < config.minUnicamBuffers) {\n \t\tLOG(RPI, Error) << \"Invalid configuration: min_total_unicam_buffers must be >= min_unicam_buffers!\";\n@@ -1569,6 +1577,15 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera)\n \t\t\t */\n \t\t\tnumBuffers = std::max<int>(data->config_.minUnicamBuffers,\n \t\t\t\t\t\t   minBuffers - numRawBuffers);\n+\n+\t\t\tif (numBuffers == 0 && data->dropFrameCount_) {\n+\t\t\t\tLOG(RPI, Warning)\n+\t\t\t\t\t<< \"Configured with no Unicam buffers,\"\n+\t\t\t\t\t   \" but the IPA requested startup frame drops.\"\n+\t\t\t\t\t   \" Increasing to one buffer.\";\n+\t\t\t\tnumBuffers = 1;\n+\t\t\t}\n+\n \t\t\tdata->numUnicamBuffers = numBuffers;\n \t\t} else if (stream == &data->isp_[Isp::Input]) {\n \t\t\t/*\n","prefixes":["libcamera-devel","v2","07/10"]}