From patchwork Mon Mar 7 12:46:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 15429 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 448D4BF415 for ; Mon, 7 Mar 2022 12:46:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E32B061188; Mon, 7 Mar 2022 13:46:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1646657204; bh=6MgXuBq9A5ndq932NEyBE2cXkbnHy+qmvaaXMto9RgY=; 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=YStwT8rIQMschB9lngTvWnJx7qyvOtT+eFkum81/VU4VH/N1c3Zbd0QsC0AcNxIn1 +Llk/dcYdI3EPm6gV2nYVN0ba6dBMFvCDWJXZSTE6w7k33x13qzJ+BENbersD9u9kw Cgvl5ggXTcHwN11TCLxkK7Nzr8FgHNvO4v9k01i8N/vk2lmHrJv/Nb+RaraIH9uY4P 1FsaympICs8IUmIio0mBdt2AoOynNj5oepcnQKXfCmZTYDkJ0VnL5M2tp5dsIKToX9 uRjfPYhdO1Qku50pAJAlQz/U/G1TcvTB/9KkOB8B3MFmXGD0ALZK7waX2ixSzDYq/G kOBjE1aTyMA+A== Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 120DB61188 for ; Mon, 7 Mar 2022 13:46:42 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="XTgw/cZz"; dkim-atps=neutral Received: by mail-wm1-x333.google.com with SMTP id n33-20020a05600c3ba100b003832caf7f3aso6574792wms.0 for ; Mon, 07 Mar 2022 04:46:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FwE3is+453vYZw7fiwo7M2TBoZaBxbvn3vvjqH/LPPA=; b=XTgw/cZzOJfhCziGhFlRnazkHr1DwSpYgM/pSzyDVV/+wUM4uoarDHqcRkIS+44zO+ bWCIh0iufvkIh54eRjuAqsDgbSYdy0QOKL+ZJAmlhTMpU5gfyHTW1oeHSnok/FCuO7xE hUdINGht/H/FJom2Yu/S8s79Um7oph3vDdvIC5cNPQwibFZ+klF7Mw8maD6Ug6ZUoZIP ypM1VqoHzmd8jUGS/1htueeatAn9WPsOTV81qACcJXGFUW9mvuRoe0e6dOvvkSEAsUXg aol+lF6qixrWwN/NLuSKz4QZrqgp8up2agwpd9RZLURF+K0jFbucMkK/RB4MHI6V2se/ VCuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FwE3is+453vYZw7fiwo7M2TBoZaBxbvn3vvjqH/LPPA=; b=mPe9axvR7Z9IxBYr/DSxK/zCMRJ1zSbbsaFCok3g9m1NGh8vH3Q2myQZ/pnji++Lh7 gj8RgStcwdpBzoA36ppTCnm1RWMfLJ9AwYGhrQjaUoJUZHRQrP2d/6RbDaRn/ZvowIZ/ V30rdqDC/or2oYtvelW23QzfuLuUzwxMCn2TMU+b7+JaLAJzLJjr0/qhIP2OzCK2N6j9 H8s5zttmeLnFRYokquBfSNRurwoKJRm5+bQ3QEhR81H1a6XVQ93cOR7OSLGBnCEYrH2I uiIT2kG+y0TqEi8Wo2DXi5k6PoRt2fgD606TmXMUprcW4AYJQ31ZeyA72+lbeD+GLM49 e3ww== X-Gm-Message-State: AOAM530KC0j+txggl+FqdDtihn5VCZjGaycurbOdYCblR7Vc6bl1N9XN d9V4eFOZwbGGlxUqS84z+xR77z8zbHVUnw== X-Google-Smtp-Source: ABdhPJwrUWK2VfOYlNyb/PwqsFEpFRS5QIuKNuBMqlVbsig02OwCrZCALIeENg/7AUau04GKA3pLpw== X-Received: by 2002:a05:600c:3009:b0:381:194a:8cb5 with SMTP id j9-20020a05600c300900b00381194a8cb5mr8774892wmh.43.1646657201552; Mon, 07 Mar 2022 04:46:41 -0800 (PST) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:c644:e9b3:de0b:54c5]) by smtp.gmail.com with ESMTPSA id z6-20020a1cf406000000b0037c4e2d3baesm19759582wma.19.2022.03.07.04.46.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 04:46:40 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Mon, 7 Mar 2022 12:46:31 +0000 Message-Id: <20220307124633.115452-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307124633.115452-1-naush@raspberrypi.com> References: <20220307124633.115452-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 4/6] pipeline: raspberrypi: Add a reconfigured flag 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" Add a flag to indicate a call to PipelineHandlerRPi::configure() has taken place. This flag signals that buffer allocations need to be done on the next call to PipelineHandlerRPi::start(). Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Tested-by: David Plowman --- .../pipeline/raspberrypi/raspberrypi.cpp | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 8bb9fc429912..b17ffa235ac7 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -185,7 +185,7 @@ public: RPiCameraData(PipelineHandler *pipe) : Camera::Private(pipe), state_(State::Stopped), supportsFlips_(false), flipsAlterBayerOrder_(false), - dropFrameCount_(0), ispOutputCount_(0) + dropFrameCount_(0), reconfigured_(true), ispOutputCount_(0) { } @@ -284,6 +284,9 @@ public: */ std::optional notifyGainsUnity_; + /* Has this camera been reconfigured? */ + bool reconfigured_; + private: void checkRequestCompleted(); void fillRequestMetadata(const ControlList &bufferControls, @@ -961,6 +964,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config) << " on pad " << sinkPad->index(); } + data->reconfigured_ = true; return ret; } @@ -981,12 +985,15 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls) RPiCameraData *data = cameraData(camera); int ret; - /* Allocate buffers for internal pipeline usage. */ - ret = prepareBuffers(camera); - if (ret) { - LOG(RPI, Error) << "Failed to allocate buffers"; - stop(camera); - return ret; + if (data->reconfigured_) { + /* Allocate buffers for internal pipeline usage. */ + ret = prepareBuffers(camera); + if (ret) { + LOG(RPI, Error) << "Failed to allocate buffers"; + stop(camera); + return ret; + } + data->reconfigured_ = false; } /* Check if a ScalerCrop control was specified. */