From patchwork Tue Nov 29 13:45:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17913 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 D5F69BE08B for ; Tue, 29 Nov 2022 13:45:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9A2196333E; Tue, 29 Nov 2022 14:45:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1669729549; bh=HF0ifAuMwXahZfN9Y84qtX+8Io2LtllLKhr1Mmmd9Xc=; 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=yWFcuxXqWj3s2He457uVt023VyYPh5qngE4uWb9pxaTIAEQhWMsX+sloiU3QqD2zy zQY1LvSKtBy0tw8nMTvmLe5VVEnCdq16AstKEWaa6Tg/aMs4FMYAVoq5R6FlH8tu5z 4QO8RFzNaHbkK9DMUdEe1PF9BlejMVnzYsKiBr3xVbkLOEa5YL39SPIyWiBTKAuMCT 6r/3MUaCFn+1Kvu2sn+VEb/HGv6CWN4NHdHWN4m+4UIo8N3VAhc5s7CrCeEE0IyCtK 8jZL3H2df0mURPh/0mEdAIINclnD15qsceJoGMGr3z3nutFMJDYQ/fazwKEFSHVBA1 5inIDCjwJQ9gA== Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D456363340 for ; Tue, 29 Nov 2022 14:45:42 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="k9Xsz4t+"; dkim-atps=neutral Received: by mail-wr1-x434.google.com with SMTP id h11so14868660wrw.13 for ; Tue, 29 Nov 2022 05:45:42 -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=cUsJZiqpEEbEwFHCx4GPjdPrMvQweo8Nuue7++bQ370=; b=k9Xsz4t+/crxHlT1Im3kfShT4N22MNm71vGIdmzJjMM1GBA6z6iEHNkJae2J3e3nli QvzfC21ehhe644GU6GR5X00flNVuCU7h7UhNLLmsE8E4C/tCRTxxAL/Drj50IaUK3Ums kla035ckUKN5isd5KtPm0DV5oCsQBm9gJ2z0qOVNmjmqZrYBEABQ9XqdWz5Q4dq7vTAO EfEXNZffFBwHrCfOERASjPcB7RkePoyY39uzXdF8MmEFoBFe4NnED+AuffDncBQ5aK1J jZL/CvgBEPs1BuQ6qi5SI+XcsdlpYpiCIO3O4RpaXJQshCjbzXDmFu/q6v+2+RacM9AP 2h7g== 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=cUsJZiqpEEbEwFHCx4GPjdPrMvQweo8Nuue7++bQ370=; b=EF5PBgQdJa50VD6O7S8cuqM2cfCOpi1Oog9LoCLHchdlrKp79Nut3dCuphJp4PY8s0 vJIslCj7ioMxOGkU1Ai6d6SspvspMExlEUP/t4UUg+Gn5h8Uyouzq3JkXgFKOQKHg8Bu vpAtaWI0XGM2asez5zStyXWVoloBnXrhmrN9oQscvvvWEhZ5Eir/Hk+v9ElV3eAfkBrh VYSYZ5tOlGlI2fxU6eH3nOCqTi8VBCyXM1FTZYnMaBhlxwHN6ER/4nVSnAaDxBmIs5Vo q8onHpJGwlWF3HsBWgyCEsbfA5JtJln7qkThUQY6tJ4Svx9en/XS1fN8evtecGzy/V0b uLXA== X-Gm-Message-State: ANoB5pmqxqaxArP913JlZo+u1hBOqKipeRsTWWIWgLI5/pukvEPVT6jp p6csGzyRjAkB4Sb41VGTvate6GwZaPMldw== X-Google-Smtp-Source: AA0mqf4UzllLXArxLPcJoL+DA7SZkFSJIGENoBTggaNo8qkW+jKQspuT+/tELccZVKmIr91lqCsLow== X-Received: by 2002:adf:ed8e:0:b0:241:d7ce:4395 with SMTP id c14-20020adfed8e000000b00241d7ce4395mr26300110wro.553.1669729542072; Tue, 29 Nov 2022 05:45:42 -0800 (PST) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id n8-20020a05600c3b8800b003cfbbd54178sm3565636wms.2.2022.11.29.05.45.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Nov 2022 05:45:41 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Tue, 29 Nov 2022 13:45:30 +0000 Message-Id: <20221129134534.2933-7-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 Subject: [libcamera-devel] [PATCH v2 06/10] 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. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Laurent Pinchart --- .../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 86eb43a3a3c5..742521927780 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1044,21 +1044,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); @@ -1075,6 +1060,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) {