From patchwork Tue Dec 6 13:54:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17951 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 5844FC3284 for ; Tue, 6 Dec 2022 13:55:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0E80B63354; Tue, 6 Dec 2022 14:55:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1670334917; bh=B4HsZNfcearAUniari2Gs/ZcNXK742dBDnX4nBxg74U=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=E+icSZKp/3smkuQA4XoPTZG2h57/KhF7RPf3LLYXB2AtgX1+rYP7+bzN2/rHj7mjW b3jkWDpz/QgPFH2FdCLfBlGNPRZQ3eQmYodtWgT+JGi6jfYr0qjQzIPGJs8PSe+C09 fn1Q68Ze81qlv0ZuJKttjf7BE1qDphvHQK5ZIEacBps4l4r6xk+utypRMkbUOpPLni DIuDnGRnaXT8bEXkNHeT1BdCILF8WzegEI58ytuzycIIfUaZSYAjFhsN7Nt5HAchal u/Af90GBM4iBHzsZOixbp4xboLiStnT4GY5u20KfMWyvkKDWxXe5iNiovYXa3+09y2 RI9hSDwW3YuIg== Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 216056334F for ; Tue, 6 Dec 2022 14:55:12 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="cX9Y0EIl"; dkim-atps=neutral Received: by mail-wr1-x42e.google.com with SMTP id m14so23547681wrh.7 for ; Tue, 06 Dec 2022 05:55:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r/eQrTC4AgrAqf/8TBfn9thxGdHfbJS4YvWmqv3/Dbc=; b=cX9Y0EIlEHaZHk6BFqOcH+xBzIHFFudsJZ4JbsiCntRRQRcygphFnHUX0t4hw2QPHo IH08LY3amjQYXBlzzLZKTQdqxRlvI9nuzapQor3atVnbYhYDInF8Of+o7wVwpZSHsSLb RVOykMQPxQz5Gkcz2ePm5tywoy4j3jRYPrsmxfJZkqH9u6o5zC1a5eTNR3sjGMtishcM tWphvwW2BAd5hZEHuoBcyhaEIu0QEdPd11Mfb/8T4vzQgpXcSnzqUL/kcTEHRqpEtitP 97ipCP6tbJh85flfXseuHinRPRBXjvSNv6QiLKa8IFcEMhudFQHCrrS2AtHVMxjUpkfu 4BxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r/eQrTC4AgrAqf/8TBfn9thxGdHfbJS4YvWmqv3/Dbc=; b=3G8BA+TdW6wX/qRAgz/hxXXv0Yyc0Hf98hgXqo2hwc7+gHvH6jaxP5cG7UGTSm65/B /3WIvnQi+9SYRTc4KwFXukLFB17+zSLv+CxEtXuJS+a0MKG81vCeK1CJxn64iyC4Nn7W LjpirgN59+yflos03KfvZGeuAFddelQtHemtvlSVS8piNQRz3pkA/pPwmR0BmXdMOYpN G2HttIYFJEgsaOX6tM37Wg7Wa3x6+lkU3pVMv32n/1z+bKbIfOBf3Ow0i/8UV0jHpO2a hRobtzFrKoe74gsMxKrJmKNanc75EXgLyDM6rX9RAcVLVBUbW6IroQ+EN7be5JPDpu6Y rhpg== X-Gm-Message-State: ANoB5pkZawqks7AnK+1dr89pV5+4ygI8lyuxWuMf5YJGgEe+gkzGqNFP IXMlTVjT6xucJIsEW8YVmwQuF8crANSs+1Dt X-Google-Smtp-Source: AA0mqf6muklV1AX676jjRQ+XCs4UarhsY31IeRtlW63+k76yHELBXcWjRmNBg/oStDguCxgvign1TA== X-Received: by 2002:adf:ee0f:0:b0:242:17c7:d98d with SMTP id y15-20020adfee0f000000b0024217c7d98dmr23532459wrn.87.1670334911128; Tue, 06 Dec 2022 05:55:11 -0800 (PST) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id q6-20020a05600c2e4600b003c6bd91caa5sm19444059wmf.17.2022.12.06.05.55.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 05:55:10 -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 Subject: [libcamera-devel] [PATCH v3 08/13] pipeline: raspberrypi: Disable StreamOn for ISP Output0/1 when dropping frames X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" If the pipeline handler is required to drop startup frames by the IPA, do not call StreamOn on the ISP Output0 and Output1 device nodes from PipelineHandlerRPi::start(). This stops the ISP from generating output on those channels giving improved latency, and more crucially does not require internal buffers to be allocated to deal with this condition. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman --- .../pipeline/raspberrypi/raspberrypi.cpp | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 9a316eda6fea..302279ac5e01 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1088,8 +1088,18 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls) data->state_ = RPiCameraData::State::Idle; - /* Start all streams. */ + /* + * Start all streams with the exception of ISP Output0 and Output1 if + * we are dropping some start-up frames. This saves a tiny bit of latency + * and avoids the need for allocating an Output0 buffer only to handle + * startup drop frame conditions. + */ for (auto const stream : data->streams_) { + if (data->dropFrameCount_ && + (stream == &data->isp_[Isp::Output0] || + stream == &data->isp_[Isp::Output1])) + continue; + ret = stream->dev()->streamOn(); if (ret) { stop(camera); @@ -1425,6 +1435,14 @@ int PipelineHandlerRPi::queueAllBuffers(Camera *camera) if (ret < 0) return ret; } else { + /* + * We haven't enabled streaming yet for Output0 and Output1 + * for startup frame drops, so don't queue any buffers. + */ + if (stream == &data->isp_[Isp::Output0] || + stream == &data->isp_[Isp::Output1]) + continue; + /* * For external streams, we must queue up a set of internal * buffers to handle the number of drop frames requested by @@ -2158,16 +2176,26 @@ void RPiCameraData::checkRequestCompleted() } /* - * Make sure we have three outputs completed in the case of a dropped - * frame. + * Only the ISP statistics output is generated when we are dropping + * frames on startup. */ if (state_ == State::IpaComplete && - ((ispOutputCount_ == 3 && dropFrameCount_) || requestCompleted)) { + ((ispOutputCount_ == 1 && dropFrameCount_) || requestCompleted)) { state_ = State::Idle; if (dropFrameCount_) { dropFrameCount_--; LOG(RPI, Debug) << "Dropping frame at the request of the IPA (" << dropFrameCount_ << " left)"; + + /* + * If we have finished dropping startup frames, start + * streaming on the ISP Output0 and Output1 nodes for + * normal operation. + */ + if (!dropFrameCount_) { + isp_[Isp::Output0].dev()->streamOn(); + isp_[Isp::Output1].dev()->streamOn(); + } } } }