From patchwork Fri Oct 14 13:18: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: 17602 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 3A7D6C3285 for ; Fri, 14 Oct 2022 13:19:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D2E6262DDC; Fri, 14 Oct 2022 15:19:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1665753542; bh=o6vkO44sTYo09jqM8FE/PBg/ldHf52mz0DXOsl9R4Lc=; 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=FykogZo8aA7Oi7LMdib9hrQsyRmeMswGRZ7Qw38jFi6wA8PmipG4JUfDAtVHH0+dt CsYizI7u28PsZbbbEoh4SLpOgHjkdzCY3PbfnzrlPpO+G2nbt/457f4vOBaDNYEP9Y yGlYc6yiKtLWkuJIaroi9UT1gSDRQc6bpWbQ2DXH+B0y6E9XZvWT/BoKmc/3nBxjGl SDm2rylScAeBPoNg3FH9LTkRsOdccwvwZRSrTAK9QEpv4X2oLUOhAAMUFjoO02bFdT /h1Ip1rPHkre/saDtIQIStjjPWvQMfl0BXZi/hl/bHYCBfsgfONiodVsR0ELvEFu/k 43eGgk/+XgbrA== Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B700962DB8 for ; Fri, 14 Oct 2022 15:18:56 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="msQGbA2q"; dkim-atps=neutral Received: by mail-wr1-x42c.google.com with SMTP id a3so7614218wrt.0 for ; Fri, 14 Oct 2022 06:18:56 -0700 (PDT) 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=lxqK9ryVYJYYkTjSeTRaI0AsUv563issP0mEV9l+D1I=; b=msQGbA2qUAFct6K8hxjD2tuaMT17RbeKilvGy1/L/TE7m4bNY8zLgMPpm60UrC0po5 8clWlk6hqzOyO1D1Z/XGkPRPbq/YjCq/H0mo9JsQTYT1JQJFRpDLwxe2wCWC2YIjILoJ zJy6YDbSOjQttua+dIEqYYio5dwA6gnG7lx7sG8M5CJt01e9OdpUiXHvtZkT8pdlBB9I 525mTvqMav+CKuQ037JfbwDePEtw++TjiJqvH5MBudM9hL3f6aqFeInKAJIL+GQCma3I bbOTl9YCcHThb3aOfff4aVc4Aji72haMZCHYtLiQLqEY4tz1eeGyh5XcZ/O6qSF1tyE3 JWXQ== 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=lxqK9ryVYJYYkTjSeTRaI0AsUv563issP0mEV9l+D1I=; b=zLHfGbrKhLnIDi9iAIGAveaW61he8OSUDrv+1O2LETstmTDYTjySVGpi6qNFE3FvOW Br8ZaUvIJsP7fVNGA2FBW4lkzGnbAMTEfcOf1Sr6Sbd0jjxKpugzcdBbpIxKvA5bHaO4 qKf8HHPmTHLUGtTYAuJO4n12zeBssWfnFS7F9k7Pp9hbb9nXV8wYOZUkB+PsortNgL9w MedlaiiKQD+PXeXD6/iRCTpxEAl8T+Y+hQMwiieiMxwchCrsBATCXnsS2XGu+LAAMom8 fq8xxRyLgpVdtiC5GcmTT0jm0jGZ/t3IbfXqE9Hm6G9HsLSCdq//hy6BQOpPRGuUHqxb ab4A== X-Gm-Message-State: ACrzQf2rZILA/I7bbn2gfuymtRjK0bFdKVsm+khfCzEA4WoTix+tjkW4 9L08yYz4MjwKBeooI64BO6YN3oR0GaQYZQ== X-Google-Smtp-Source: AMsMyM7fWxEMz4Df4F0StJml//8dtQ8ZUWDdZm+p77DCgIZSh2i8St1xrYIpSAmRY40XI87BhSS9jg== X-Received: by 2002:a05:6000:184e:b0:22e:4612:496d with SMTP id c14-20020a056000184e00b0022e4612496dmr3431400wri.91.1665753536214; Fri, 14 Oct 2022 06:18:56 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id g17-20020a05600c001100b003c6bbe910fdsm8282458wmc.9.2022.10.14.06.18.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 06:18:55 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 14 Oct 2022 14:18:42 +0100 Message-Id: <20221014131846.27169-7-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221014131846.27169-1-naush@raspberrypi.com> References: <20221014131846.27169-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 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 --- .../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 fc674e4f5bdd..2aba0430c02e 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1030,21 +1030,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); @@ -1061,6 +1046,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) {