From patchwork Tue Dec 6 13:54:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17947 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 DE0C7BE08B for ; Tue, 6 Dec 2022 13:55:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5F4B063350; Tue, 6 Dec 2022 14:55:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1670334912; 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=bnQKx1lrsLKJsxzq0KLRShk0BaDTM27TEhTxVZSAArccxOtpU5CKzjwq9WNOMt1OE SLA17QtOYZX8Fz4F6WKDqJj3gIwkJKDQYtzOfHFw+XgMeVG4H3ejoth9Nw6PvtJCXI j8pFq8uTg1EZuzegfiG9B0T8U3kR1uxYFhqcddf6VDxRJm++Zx6Swx6KafAfn/K9M9 zvywpM/QuwrO3scqIE5BgNEYNUuDWQjt07mKhrAjuEuiE3tpVJA5wDibLO7bF1z8cI oce+xMMtCrE9nWRg3dM9ZtiJL9z2rlDsCEtQD8GOy9ZQp2lvNJLBKjdflmMj1HfkdA tmbX4G2V825wA== Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AC78163346 for ; Tue, 6 Dec 2022 14:55:08 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="YPhG6K2U"; dkim-atps=neutral Received: by mail-wm1-x32f.google.com with SMTP id h8-20020a1c2108000000b003d1efd60b65so854359wmh.0 for ; Tue, 06 Dec 2022 05:55:08 -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=YPhG6K2UBHSzUFotlPFnMMcVD6rAYFfJUXj2perq1d//oBfT0kFOieli71dnLgfgRS EwAxCqMbLJgz4KvKR3heksKZcodOzv1GnG2AzsjbdheEpRgWvkf+YH/C900P6GMZ0Y15 u2FanKtwYDOSRUVkymjopvUATkLWxlhVlN/2V8OM3PA00H5c3vnOs906UwJL2RcVjyow fo2nllGl4ZdueV8hhJX1w1IUSO4vy/zai+9dR6dkFcJpq31xhZ+cTKq1xGv1V/wwyhAs X/oDwuA5KBq5j5OpRwVtwqBe94JJtDoAiqaoRqQeHMgIY3KhVaxxULpwTkPOhME+e+7D bpfA== 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=Ft21C8D2+j5/ATaHy1shhtzYtABk2kcNPAmFEQ/u1Nq2wnhHKZvvdXUvVhkwj/3r1a mKg/gfk+zfGN+C/WehecsVYmjYYj0HxFevEnYxaZW5KJ0dpGIKxIsUEcVytA3zZRaMso p8c764Ig4TXbK6Ako3+lZkRZcOC7P6E8sQo0/JodM6NG4SsV4xygC/95Pvh7vR65ugWX H/1W+nwITQO8NCd8SmxPvevJ5RyBTTLg/J6RATcXh5VnnKv9w1Asw6btjENz9J46xckL +Lnk/Oouy2ICH85bGSINGaxpeePRXdgcF0c9srkT8FEKnKCtaR0HAwgy5R6CT87lWvaU eA8A== X-Gm-Message-State: ANoB5plLkQvfdnsLaq036jtuP7Tlop/RozKHn1jK8Q8YoQRqL2uSQUdu aoLkfujHXcTb+Lf062L5GEqYFt4i+ftKGAG6 X-Google-Smtp-Source: AA0mqf58ysPl71DJ2YVmQxSRTaGYBxSvLzgXla9RqVVvHX0+Ww7F8JsGz0Wl80CHhJfWFRkdhFOzqQ== X-Received: by 2002:a7b:c3d3:0:b0:3d1:cec6:75a8 with SMTP id t19-20020a7bc3d3000000b003d1cec675a8mr5970784wmj.206.1670334908261; Tue, 06 Dec 2022 05:55:08 -0800 (PST) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id q6-20020a05600c2e4600b003c6bd91caa5sm19444059wmf.17.2022.12.06.05.55.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 05:55:07 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Tue, 6 Dec 2022 13:54:50 +0000 Message-Id: <20221206135459.25521-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221206135459.25521-1-naush@raspberrypi.com> References: <20221206135459.25521-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 04/13] 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 --- .../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) {