From patchwork Fri Dec 9 09:00:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17968 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 30574BDE6B for ; Fri, 9 Dec 2022 09:01:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DE4F463361; Fri, 9 Dec 2022 10:01:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1670576495; bh=8HTIPDT/NLnYs2wOJmUDMwsBHq8KUzzKjYDz7CKniHo=; 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=bv2/98MrTdBVCh4xAvWBXqVUapPgBkqAb3FFJ0rOFsFykC3kC14W7n8Y6LGdSe4XA zf+hS/jXFn6SP+Ntd/UtVdQKDpaMxxCSlq9E5EflnLIAYasQYlTESyCYwkz6AwoSe8 KjU4XRTYPwSzp4nYJTA26rVdNt/ggo51CSwsW6tgJLnsTKJbLz1dr8XFx+b65pb+gB 2v5f6+R87iU+3HQ9LumJTd2BvQZ+RSzhsQa0oTRdZMVbICfGY4cZoRN3a8+N+7lRCn pVyNe/K4wYRtWF1bG5/7uT7tH4W49tXSWu+FoAUUTNT3xq0WFHDdwDNm7lyaJWmgs4 2U72H8Zs1whaA== Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EFFA561F1E for ; Fri, 9 Dec 2022 10:01:31 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="gDXNQZK6"; dkim-atps=neutral Received: by mail-wm1-x32c.google.com with SMTP id o15so2728476wmr.4 for ; Fri, 09 Dec 2022 01:01:31 -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=5Z11VugKNVYk4NrBATUQ29zE9EItJoR8a0aD1H32Zho=; b=gDXNQZK65MuyLFyDHzPTRa01p6gQbkpp+zAlHRxSTqoUYn7VQhOkZjTtJiFhW4VEy6 zumbqzirh68dV0Np5HjrEcPdysI7/OC2PxYoWCDYq2wfE4jPf9UfDmFlEtZc0Lo3nuPU CZXfbdwQrJrvFS2j6QyIdSnjHV4WIPTO8ngTlK6Glh3EnMInXw1K7dF/LeGZQVVPntGH qYVnKNb065IIr/f2K3WAHMdGUn5pezDNgK5HFWBOO+MeedGT/NgkMLkIH8yjDYqAGs6+ +VlAtGBNF8WABAXokSLTI7RtCt+VIVjluzs/uFyTZohplSMJF81OoyUCwQ8VxrTtuaDy A6rw== 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=5Z11VugKNVYk4NrBATUQ29zE9EItJoR8a0aD1H32Zho=; b=zgxKX2wtc3l/Lj4OjaZD0x1M7NjaUSU/aKWezvxdgzQMXwI4aDTvhplNz23gA8GrEt WWeKnJA16f1kynOEJWhMmlEqn6e/cEc6sLrPww/uERnbEWhDCOO17uc/0dHdaELbHmv7 UKWMR5xfbLVJtllxdHZUFfwi1PzKXfHt9KClM1fEyXIraNEt/O1Mc5hDeHCktZpMHyB3 iA17tWrmd35HEFcW4FwKd/lNFTEWBUFU03Mu19zkfHcoIKv1N30cPuF3X7jmEa5oKA0E BxfqKsyoKk5jXUioIoSOc8+JtkSYyBpK7Aa8if1WVFsJyNwJ6XWbeNCUfwqbk9AhB9B3 6NRA== X-Gm-Message-State: ANoB5pn7PkuZIKtk/bI1EvgOWYuyXXe2QpDhDN+MWw22CxRD7EhipD/u bjF9jE2In82pFtb1M073VzIBJQL/nQo0P0GT X-Google-Smtp-Source: AA0mqf4QQh03oLLkQihaofdDovzXEUycOMPRDae3mIavTJr3oAHe8HZFolwEkyGrQeoEPFfzlZkCSg== X-Received: by 2002:a05:600c:1da3:b0:3d1:ebdf:d58b with SMTP id p35-20020a05600c1da300b003d1ebdfd58bmr4280386wms.5.1670576491408; Fri, 09 Dec 2022 01:01:31 -0800 (PST) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id bd10-20020a05600c1f0a00b003cf774c31a0sm7773674wmb.16.2022.12.09.01.01.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 01:01:30 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Fri, 9 Dec 2022 09:00:42 +0000 Message-Id: <20221209090050.19441-5-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 Subject: [libcamera-devel] [PATCH v4 04/12] pipeline: raspberrypi: Reorder startup drop frame initialisation 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" Reorder the code such that the IPA requested startup drop frames count is available before the pipeline handler allocates any stream buffers. This will be used in a subsequent change to stop Unicam buffer allocations if there are no startup drop frames required and the application has configured a raw stream and always provides buffers for it. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- .../pipeline/raspberrypi/raspberrypi.cpp | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index f6388d63416b..c5a489fc7581 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1036,21 +1036,6 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls) RPiCameraData *data = cameraData(camera); int ret; - for (auto const stream : data->streams_) - stream->resetBuffers(); - - if (!data->buffersAllocated_) { - /* Allocate buffers for internal pipeline usage. */ - ret = prepareBuffers(camera); - if (ret) { - LOG(RPI, Error) << "Failed to allocate buffers"; - data->freeBuffers(); - stop(camera); - return ret; - } - data->buffersAllocated_ = true; - } - /* Check if a ScalerCrop control was specified. */ if (controls) data->applyScalerCrop(*controls); @@ -1067,6 +1052,21 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls) /* Configure the number of dropped frames required on startup. */ data->dropFrameCount_ = startConfig.dropFrameCount; + for (auto const stream : data->streams_) + stream->resetBuffers(); + + if (!data->buffersAllocated_) { + /* Allocate buffers for internal pipeline usage. */ + ret = prepareBuffers(camera); + if (ret) { + LOG(RPI, Error) << "Failed to allocate buffers"; + data->freeBuffers(); + stop(camera); + return ret; + } + data->buffersAllocated_ = true; + } + /* We need to set the dropFrameCount_ before queueing buffers. */ ret = queueAllBuffers(camera); if (ret) {