From patchwork Fri Oct 14 13:18:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17601 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 B0A62C3286 for ; Fri, 14 Oct 2022 13:19:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5E42A62DD1; Fri, 14 Oct 2022 15:19:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1665753541; bh=Z09FsJ1eeq8/QE9utbzWP8pRJbtszBu1HTsfzhspEU8=; 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=fyp7x+rREq1wEQa895Ix0ZX//2SG4RR/zkdLeUKTPUJI2Iua3StxiZkItykOCX08Y KtnLIbd7kESaH28B5JJ5Mjjr9dCxfbFFY+uH3FJjzYBtLp/gAtCKCZVS5dQSXL+CMo 95fFLzoaCjuLAV/x+pGF8jzyd4mNt8zyCgK4lKsKqswKMrYjIEiZMGWAJWYfB2h2ya vei2dbEC683R/rgJYRwuMpkFYqQXE+yzA9PMBe9yB/ps7RFeiryDnpAuVSjHGebo/B nnvzuG95Kc8socAVzIJXTkarWLcTNGBJZtWCB2uAJock9jnuwmXmRkJOYZWjHFAAJt D3u4x6MkwTLYw== Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1D86F62DBC for ; Fri, 14 Oct 2022 15:18:56 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="mq+hM1ZE"; dkim-atps=neutral Received: by mail-wm1-x32e.google.com with SMTP id o20-20020a05600c4fd400b003b4a516c479so3506547wmq.1 for ; Fri, 14 Oct 2022 06:18:56 -0700 (PDT) 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=JxiJ0YIUaJLrBxVyStnydR+o/sXghSBmFy3EK7DLEUo=; b=mq+hM1ZEBTkBBT0hqJZpYrbBpctJEZDWlMGoKbZA9X7Gqane1IF4p9h2qZfa+P540N HhimNLB68itazPznfUxg42kyGivsg4Q7SAio7ceKgb9LTHGV0Fctfk5DQfM48wFUwQgK PayzEIidgGcOr4H8F26oFX6hesOWgfri/JIFrsz+3JqHVN8Fwecb5yeegE7JNvOmGjqA 56hnuPXkT0SPhHJbjWfSVfEMs/IwvZB2fURcWHG0UNWqdPCP6IcxitGkyOiK/462JeCa REB2fSO5m96fzHAPpnaxqfmjOhzNONbsAIFVTGP+ikh77v2qfyx7AKd4ePo/I+5el3MY biPg== 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=JxiJ0YIUaJLrBxVyStnydR+o/sXghSBmFy3EK7DLEUo=; b=kA2O+O6krNt88cU0AlV5MqRpSC2EKzgAWmzGsy8l3p6wiD6zwMOhy4BdJLZ/crnXd2 wBSYpkBPBj3b/qxIVc8/BmmKUyvwty7VKtWt18ayveyJ9DaCQYLOWEi3stW+SNfCQ4E1 Gd2KSyMEqQeqRM2995rcr7mspoZjv/sjAsLxzO5o8gH4JBGF51f/XbYyIy+F91ZG2mgv dgs7Pncp4AVvpuoyuFg2shacgewIDoqx70p1o23lk/pXDkSJIz8bwPrJ8vGwPX60WaH4 jaoz0GYu7BLGvPb8h+LefPqww12ptFBlH1jza3ukdoa5h0TLaHZuSP1ZgNh95fZz9h0j R1Vw== X-Gm-Message-State: ACrzQf2iD48S0gv6M2B0IwjQFnEyS4du1dyJAtpveZpMKAA2mN1uhFJt mUvN8j0ZaUhncJkiKlPfr7SqAkUXMTwgJQ== X-Google-Smtp-Source: AMsMyM5vIkOgqEfFx7ccvQsz5PfgpXs2HTFsHXk7eQ4OsFQ/4c39Dr6eTlBZvS2Zdl4xRnZ5l7W4uQ== X-Received: by 2002:a7b:cb41:0:b0:3b3:34d6:189f with SMTP id v1-20020a7bcb41000000b003b334d6189fmr10476579wmj.6.1665753535483; Fri, 14 Oct 2022 06:18:55 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id g17-20020a05600c001100b003c6bbe910fdsm8282458wmc.9.2022.10.14.06.18.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 06:18:55 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 14 Oct 2022 14:18:41 +0100 Message-Id: <20221014131846.27169-6-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221014131846.27169-1-naush@raspberrypi.com> References: <20221014131846.27169-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 05/10] 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 improving 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/data/default.json | 2 +- .../pipeline/raspberrypi/raspberrypi.cpp | 35 ++++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/data/default.json b/src/libcamera/pipeline/raspberrypi/data/default.json index d709e31850af..a7ea735c87f4 100644 --- a/src/libcamera/pipeline/raspberrypi/data/default.json +++ b/src/libcamera/pipeline/raspberrypi/data/default.json @@ -14,7 +14,7 @@ # min_total_unicam_buffers - external buffer count) "min_total_unicam_buffers": 4, - # The number of internal buffers used for ISP Output0. This must be set to 1. + # The number of internal buffers used for ISP Output0. "num_output0_buffers": 1 } } diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index bac7a66ba900..fc674e4f5bdd 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1080,8 +1080,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); @@ -1474,6 +1484,13 @@ int PipelineHandlerRPi::queueAllBuffers(Camera *camera) if (ret < 0) return ret; } else { + /* + * We don't enable streaming 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 @@ -2143,16 +2160,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 ahve 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(); + } } } }