From patchwork Fri Jan 27 15:43:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18204 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 7084CBDC71 for ; Fri, 27 Jan 2023 15:43:44 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7C41661EF9; Fri, 27 Jan 2023 16:43:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1674834223; bh=z1bIE/e9vXtfIY1SAoNZ7ufuWwQk4rK8DoHrCYJLUls=; 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=x5i2yCr50G0FMNXzDo6UgnQ0bPDNeF81hZfUA19gJvkENJYfZKn+edcmX/DttH4qk qO+n8iGC5SZl7R00BBvWnDtwOrj96qW5Pp48FK4oMIWQY3cMyepYDc3wFjaPH/nezZ ie1gaH6KzM52KiRog2c3Ht4QxAaAhV3XyxnOQ8eTyVnhUhDkC9ld7Vqgf3YzPB5i03 1djwG5xAiYDjG8ytBD/pr9BBctMARf5ahWuactKm5W85uvhwDb0K514qsCRv7uu+Rv A+8nkT9zQ7ekbMUPT+MElriTGIauvXGRAaRkI4uxczfqGTP7liWSFspkyIDkO04iVF 1cBN5FOpmHYzQ== Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 937C9625E6 for ; Fri, 27 Jan 2023 16:43:38 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="myAdBZsx"; dkim-atps=neutral Received: by mail-wm1-x330.google.com with SMTP id f12-20020a7bc8cc000000b003daf6b2f9b9so5679063wml.3 for ; Fri, 27 Jan 2023 07:43:38 -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=ebjZaGnHe6ttVotKHBzk7oVcPheV/bXS8hsRGk0E6Ww=; b=myAdBZsxMr1VwosKcCONkePJupMB+esasWDsaeNf69disqRmhXzXz0jeBl3CzqUXLb QxKqcJphZUBKpmzq+0b3eQR+YODU/cjt92OPNOtzOyOItQzSBR1UZCVvNDcsyG4JTskP T6kUsHnqZk4Za4/yMurjVvFUugFVdENiJmm/XP+um6MMZgN0lkrTzVox6HvX4AFKeehj A8LGlxj4o0VIj0aH9zzEqd3TzMl9Zlmcln4f5XwCpzN32/9D6henURq2ruaC3ho5LGpw EvazNmyo6Cfg1oIFI58AnPVi/X+Qylq3UoThBrsfR4Zzvh2zvX61+JbzbFrlzu5Jv5WS DOsA== 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=ebjZaGnHe6ttVotKHBzk7oVcPheV/bXS8hsRGk0E6Ww=; b=eRCirA38zujlb8oVkZomxbUSCsNxnQNDpvCsfUmw61pW0HKZXvQSgZFsIfqnIqpp6D tMsQGHod9m44Ww8qMAXY72iYjP+KrcucXMVAw8Hh/1TAb8kwglBwQ7eBUTuZ2wCbad6m FfLE05mjljm13M8goa8P1k1UWRbIw0NlcQtaJoVj0CuFhQJs+Cgm5J/0cfoNeFYf5B2z ECfv4aTb1sW8DTDigZlmcqYQiQAe0USHnM9NPckv7axzJH3yKckRbARf+gYER84Y/Yqt dB8PD5TMyn98H54QBdC9LsuN28jVkg/N/4/KEgQaSUnhwfPn5GQxTin/nzq/jWBOOQR3 qrCA== X-Gm-Message-State: AFqh2kpAq/HzRHBxddD1OLNHfCjLS4hKsgWf2PRl0C/T8cYlNzm7nHkk 2Yyo9gXJzooN9H4m/jz9Swqzi4xRVZXqhZbh7r4= X-Google-Smtp-Source: AMrXdXtyozZAJsU8ucpfaOkaHmxtO5BqLuSh4fksNAnsq5Cnh0J9akFlh92iZj1wkuXjZLUDrxtcdg== X-Received: by 2002:a05:600c:a4d:b0:3db:1d6:16f7 with SMTP id c13-20020a05600c0a4d00b003db01d616f7mr37645196wmq.23.1674834217876; Fri, 27 Jan 2023 07:43:37 -0800 (PST) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id h18-20020a05600c30d200b003c21ba7d7d6sm4549566wmn.44.2023.01.27.07.43.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jan 2023 07:43:37 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Fri, 27 Jan 2023 15:43:11 +0000 Message-Id: <20230127154322.29019-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127154322.29019-1-naush@raspberrypi.com> References: <20230127154322.29019-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 04/15] 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 9e959782d310..8aa83aa76ae0 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1041,21 +1041,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); @@ -1072,6 +1057,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) {