From patchwork Wed Jan 18 08:59:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18130 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 9C03CC3240 for ; Wed, 18 Jan 2023 09:01:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0C7F5625EA; Wed, 18 Jan 2023 10:01:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1674032482; bh=L265xLyiuEuaKv9P5lGhDdWVXIA6ltrNVdeVTVaM2LM=; 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=zkyOaypu3lTYwRZxt1nCwuTZSnCUz8MEifPYPR+FfcboHYubgISNPSo4wgEy8toHA 3TJPcQLuPPt/mtmeddjrUSMGntuuYemiCA3Nmb2e+cJKdeBKWyNgqefADndgPdafxl N2UgEnL0FnycW7+GYzRRFrPlBMpcadTjkdUJiPsXn91k6RP2tQLlDZjDPhhbqpKdW/ qhL8pWF7rqahrAE++2FEdmQB9JE2AJWOBswVuWhuhnTDA5gn/Pj0i/kJi/WkRjvKiG jhFqcNzPryFPIcsmYPMXRP3ksNBZGOYWRxJz8OEEea0yHJRaz+fYNb3PeEKGdlpQ85 PN2G44Thi0Kzw== Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C3FAA625EB for ; Wed, 18 Jan 2023 10:01:18 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="pENFsmiP"; dkim-atps=neutral Received: by mail-wr1-x432.google.com with SMTP id b5so12018907wrn.0 for ; Wed, 18 Jan 2023 01:01:18 -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=8TFxH7E7BdYI52Y2sjOrvKP7oQS4L1/5NWJaxGyGFtw=; b=pENFsmiPp6RixW9LHbNQlpk4YEZy3qKniHm9WiVLYBFuy+mN+OchW9U+w7PB8VuAJk RrTUIpDI/13ioJyd3rOxTg0SYpADEyBIRZfcFiwOL79adu1+a91QH/+UQ+YmaiTwIPQ/ sDSiT/HIGXlfErOvtCuwZGuu12OeFDLwTPUmrKWDKUJpgOsWH40ToxBsa7u8QpyR9aIe 82Z6PnP32eg9bWxKFMPGLcwhNBtHI6tKtrSQHDymZRYitWO7lZPSsZyWbk5JVpt3dywm ji2O2fLabGsZtoMnhYe4w1BzufJ7sshs0TlLS0c6ktQpnK3QdNNAFvCzrUBqr4VYIkpv 2IRw== 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=8TFxH7E7BdYI52Y2sjOrvKP7oQS4L1/5NWJaxGyGFtw=; b=QmGAYMv544tu69HgWyH/elDHTP0vk1JiKa4zxWMM2QznRk820pO8i4NZu0Md4JOKCS GlIKMQybfl4m6Si404XDkXiVvkqj4MgatYO8eqY7rm20ruIz5tnNUC0J434NMYTrv51i o2DkUWuvHxlTN41on6KjZYyfxSbsKu+kDK5G4C17jn5xDEja5bQnSKYE2BKxJz9dCIcQ 2hcKAqeBqQw5M6/il7D4O7W+0Jy18GEM2SbZF1oaEXq/oZ/D8GRtVOK4sEDCdkQffrmP dM8y0h8EbmHXbybD+dSaczXrWnaRF1FaDBhQ/i4a6Y24QIxhnQRgWJNBN5T08BEanjDd PLfg== X-Gm-Message-State: AFqh2koi3Y+fHyLtiMT060dolDGO06Mfhu83N+5Q8kEgVTRpSiHJoqCP ovWeYsswoZ51XqR3mIgNp3vgysCZX5RR2vtOpCI= X-Google-Smtp-Source: AMrXdXsvU8JK+RPyfiUMjzZGgwbi5t9RZ5v2yZyhcZj8U4V/MGydEI5kTR4PRROTf8Czas62nhQ0+Q== X-Received: by 2002:adf:edc2:0:b0:242:4cf5:f385 with SMTP id v2-20020adfedc2000000b002424cf5f385mr5455645wro.34.1674032478160; Wed, 18 Jan 2023 01:01:18 -0800 (PST) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id i6-20020adfe486000000b002423dc3b1a9sm30312464wrm.52.2023.01.18.01.01.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 01:01:17 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Wed, 18 Jan 2023 08:59:45 +0000 Message-Id: <20230118085953.7027-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230118085953.7027-1-naush@raspberrypi.com> References: <20230118085953.7027-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 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 6bf9a669c679..8d325c7a18c5 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1037,21 +1037,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); @@ -1068,6 +1053,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) {