{"id":17951,"url":"https://patchwork.libcamera.org/api/patches/17951/?format=json","web_url":"https://patchwork.libcamera.org/patch/17951/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20221206135459.25521-9-naush@raspberrypi.com>","date":"2022-12-06T13:54:54","name":"[libcamera-devel,v3,08/13] pipeline: raspberrypi: Disable StreamOn for ISP Output0/1 when dropping frames","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"119d8f9cac3d870558806c126354e7b7c42253b2","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17951/mbox/","series":[{"id":3659,"url":"https://patchwork.libcamera.org/api/series/3659/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3659","date":"2022-12-06T13:54:46","name":"Raspberry Pi: Platform configuration and buffer allocation improvements","version":3,"mbox":"https://patchwork.libcamera.org/series/3659/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17951/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17951/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 5844FC3284\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  6 Dec 2022 13:55:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0E80B63354;\n\tTue,  6 Dec 2022 14:55:17 +0100 (CET)","from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com\n\t[IPv6:2a00:1450:4864:20::42e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 216056334F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  6 Dec 2022 14:55:12 +0100 (CET)","by mail-wr1-x42e.google.com with SMTP id m14so23547681wrh.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 06 Dec 2022 05:55:12 -0800 (PST)","from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tq6-20020a05600c2e4600b003c6bd91caa5sm19444059wmf.17.2022.12.06.05.55.10\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 06 Dec 2022 05:55:10 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1670334917;\n\tbh=B4HsZNfcearAUniari2Gs/ZcNXK742dBDnX4nBxg74U=;\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=E+icSZKp/3smkuQA4XoPTZG2h57/KhF7RPf3LLYXB2AtgX1+rYP7+bzN2/rHj7mjW\n\tb3jkWDpz/QgPFH2FdCLfBlGNPRZQ3eQmYodtWgT+JGi6jfYr0qjQzIPGJs8PSe+C09\n\tfn1Q68Ze81qlv0ZuJKttjf7BE1qDphvHQK5ZIEacBps4l4r6xk+utypRMkbUOpPLni\n\tDIuDnGRnaXT8bEXkNHeT1BdCILF8WzegEI58ytuzycIIfUaZSYAjFhsN7Nt5HAchal\n\tu/Af90GBM4iBHzsZOixbp4xboLiStnT4GY5u20KfMWyvkKDWxXe5iNiovYXa3+09y2\n\tRI9hSDwW3YuIg==","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=r/eQrTC4AgrAqf/8TBfn9thxGdHfbJS4YvWmqv3/Dbc=;\n\tb=cX9Y0EIlEHaZHk6BFqOcH+xBzIHFFudsJZ4JbsiCntRRQRcygphFnHUX0t4hw2QPHo\n\tIH08LY3amjQYXBlzzLZKTQdqxRlvI9nuzapQor3atVnbYhYDInF8Of+o7wVwpZSHsSLb\n\tRVOykMQPxQz5Gkcz2ePm5tywoy4j3jRYPrsmxfJZkqH9u6o5zC1a5eTNR3sjGMtishcM\n\ttWphvwW2BAd5hZEHuoBcyhaEIu0QEdPd11Mfb/8T4vzQgpXcSnzqUL/kcTEHRqpEtitP\n\t97ipCP6tbJh85flfXseuHinRPRBXjvSNv6QiLKa8IFcEMhudFQHCrrS2AtHVMxjUpkfu\n\t4BxA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"cX9Y0EIl\"; 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=r/eQrTC4AgrAqf/8TBfn9thxGdHfbJS4YvWmqv3/Dbc=;\n\tb=3G8BA+TdW6wX/qRAgz/hxXXv0Yyc0Hf98hgXqo2hwc7+gHvH6jaxP5cG7UGTSm65/B\n\t/3WIvnQi+9SYRTc4KwFXukLFB17+zSLv+CxEtXuJS+a0MKG81vCeK1CJxn64iyC4Nn7W\n\tLjpirgN59+yflos03KfvZGeuAFddelQtHemtvlSVS8piNQRz3pkA/pPwmR0BmXdMOYpN\n\tG2HttIYFJEgsaOX6tM37Wg7Wa3x6+lkU3pVMv32n/1z+bKbIfOBf3Ow0i/8UV0jHpO2a\n\thRobtzFrKoe74gsMxKrJmKNanc75EXgLyDM6rX9RAcVLVBUbW6IroQ+EN7be5JPDpu6Y\n\trhpg==","X-Gm-Message-State":"ANoB5pkZawqks7AnK+1dr89pV5+4ygI8lyuxWuMf5YJGgEe+gkzGqNFP\n\tIXMlTVjT6xucJIsEW8YVmwQuF8crANSs+1Dt","X-Google-Smtp-Source":"AA0mqf6muklV1AX676jjRQ+XCs4UarhsY31IeRtlW63+k76yHELBXcWjRmNBg/oStDguCxgvign1TA==","X-Received":"by 2002:adf:ee0f:0:b0:242:17c7:d98d with SMTP id\n\ty15-20020adfee0f000000b0024217c7d98dmr23532459wrn.87.1670334911128; \n\tTue, 06 Dec 2022 05:55:11 -0800 (PST)","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  6 Dec 2022 13:54:54 +0000","Message-Id":"<20221206135459.25521-9-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20221206135459.25521-1-naush@raspberrypi.com>","References":"<20221206135459.25521-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 08/13] pipeline: raspberrypi: Disable\n\tStreamOn for ISP Output0/1 when dropping 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":"If the pipeline handler is required to drop startup frames by the IPA, do not\ncall StreamOn on the ISP Output0 and Output1 device nodes from\nPipelineHandlerRPi::start(). This stops the ISP from generating output on those\nchannels giving improved latency, and more crucially does not require internal\nbuffers to be allocated to deal with this condition.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 36 ++++++++++++++++---\n 1 file changed, 32 insertions(+), 4 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 9a316eda6fea..302279ac5e01 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1088,8 +1088,18 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)\n \n \tdata->state_ = RPiCameraData::State::Idle;\n \n-\t/* Start all streams. */\n+\t/*\n+\t * Start all streams with the exception of ISP Output0 and Output1 if\n+\t * we are dropping some start-up frames. This saves a tiny bit of latency\n+\t * and avoids the need for allocating an Output0 buffer only to handle\n+\t * startup drop frame conditions.\n+\t */\n \tfor (auto const stream : data->streams_) {\n+\t\tif (data->dropFrameCount_ &&\n+\t\t    (stream == &data->isp_[Isp::Output0] ||\n+\t\t     stream == &data->isp_[Isp::Output1]))\n+\t\t\tcontinue;\n+\n \t\tret = stream->dev()->streamOn();\n \t\tif (ret) {\n \t\t\tstop(camera);\n@@ -1425,6 +1435,14 @@ int PipelineHandlerRPi::queueAllBuffers(Camera *camera)\n \t\t\tif (ret < 0)\n \t\t\t\treturn ret;\n \t\t} else {\n+\t\t\t/*\n+\t\t\t * We haven't enabled streaming yet for Output0 and Output1\n+\t\t\t * for startup frame drops, so don't queue any buffers.\n+\t\t\t */\n+\t\t\tif (stream == &data->isp_[Isp::Output0] ||\n+\t\t\t    stream == &data->isp_[Isp::Output1])\n+\t\t\t\tcontinue;\n+\n \t\t\t/*\n \t\t\t * For external streams, we must queue up a set of internal\n \t\t\t * buffers to handle the number of drop frames requested by\n@@ -2158,16 +2176,26 @@ void RPiCameraData::checkRequestCompleted()\n \t}\n \n \t/*\n-\t * Make sure we have three outputs completed in the case of a dropped\n-\t * frame.\n+\t * Only the ISP statistics output is generated when we are dropping\n+\t * frames on startup.\n \t */\n \tif (state_ == State::IpaComplete &&\n-\t    ((ispOutputCount_ == 3 && dropFrameCount_) || requestCompleted)) {\n+\t    ((ispOutputCount_ == 1 && dropFrameCount_) || requestCompleted)) {\n \t\tstate_ = State::Idle;\n \t\tif (dropFrameCount_) {\n \t\t\tdropFrameCount_--;\n \t\t\tLOG(RPI, Debug) << \"Dropping frame at the request of the IPA (\"\n \t\t\t\t\t<< dropFrameCount_ << \" left)\";\n+\n+\t\t\t/*\n+\t\t\t * If we have finished dropping startup frames, start\n+\t\t\t * streaming on the ISP Output0 and Output1 nodes for\n+\t\t\t * normal operation.\n+\t\t\t */\n+\t\t\tif (!dropFrameCount_) {\n+\t\t\t\tisp_[Isp::Output0].dev()->streamOn();\n+\t\t\t\tisp_[Isp::Output1].dev()->streamOn();\n+\t\t\t}\n \t\t}\n \t}\n }\n","prefixes":["libcamera-devel","v3","08/13"]}