From patchwork Sat Mar 13 10:27:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11574 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 4C492BD80C for ; Sat, 13 Mar 2021 10:27:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E25A168C6C; Sat, 13 Mar 2021 11:27:48 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="SjoeGLZO"; dkim-atps=neutral Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 35ADC602E3 for ; Sat, 13 Mar 2021 11:27:48 +0100 (CET) Received: by mail-wm1-x332.google.com with SMTP id r15-20020a05600c35cfb029010e639ca09eso17258787wmq.1 for ; Sat, 13 Mar 2021 02:27:48 -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=M+FmiV1+Z+NI3asFb2J1an453JDSYe2mOftFh6wRtHU=; b=SjoeGLZOGOt8g6nVByTNGe+XqeK29RvlNpp8eVkajpi+cTN7MNkfpNVLjyHtJAUxAz KGMQo+hUuBtbAxMVLTYOyCeF1tylJJPOc5mLchFPmwT2vxQNZ+b4O488Cxip4Qw+4seW ZBzs7AbMM2yy7YCFfwH9GW8Zj6MXGOkEnCWaF01zqErtEZHv+LddQltKJ0bfZ2AJ6k9b 8oi5Z3qESR/lk0pvTVW4i5pfrtRx1dTTSJDK75P0sfoXitUyZWUKk+zqbyexpS2GE4i7 sIdm7//svmNJ9TqYtUhazD1tbjTcntDPFuPYyUCqTmSf4FG/oT6iUutFPdy+kLPi2IUm zEBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M+FmiV1+Z+NI3asFb2J1an453JDSYe2mOftFh6wRtHU=; b=Gv/COPsfqfHJjtd+F+YZiPfrlWGrsORszvBiPorg2vMQ8BXaaugtSrWM0oOLYY04/4 dYiZf7nL/uCNfY5ysgFl+XNf9vxbr7KQ/XdS8uFSFadLneV31j1UqhXUnay/eDtBAaLS QDkN4+GD0E5Tvut3OP3umVWAER9P4w0L49GCflFJdx5VuEAJg+o44XfrjPeQ4H0UnuxT DFiHEMA6l2SV6vjysAzCff5+NVDbJ+MN5mmyBjbOzn1XcT+0ljDUQ1BcEH3PO8IdGF2l dIkqI4IqaiuqftBw2BgbQe6wcqr+AZQ8svD0GGUH6E/srZtGklm3yVzG0c4ldx6q6rrn sXfg== X-Gm-Message-State: AOAM5337ZMgy2FRKw0i07FMX5cH1yKpjq/Hi6+WcpPO5CEKmamsElnvD d7BthwMKmvVfn0jImYqJVFs2oNcXnKvdrA== X-Google-Smtp-Source: ABdhPJy8qprzO55afWvrlyCqA+NHCFh2D2o+L7IMCjLvHSn7BZtudejWSuJhMA+qYCYN4RS8Lydrpw== X-Received: by 2002:a1c:32ca:: with SMTP id y193mr17071556wmy.56.1615631267405; Sat, 13 Mar 2021 02:27:47 -0800 (PST) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id g5sm11760178wrq.30.2021.03.13.02.27.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Mar 2021 02:27:47 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Sat, 13 Mar 2021 10:27:40 +0000 Message-Id: <20210313102741.2890809-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210313102741.2890809-1-naush@raspberrypi.com> References: <20210313102741.2890809-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] pipeline: raspberrypi: Avoid multiple opens of Unicam embedded data node 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" It is possible for the application to call pipeline_handler::configure() multiple times, which would attempt to open the Unicam embedded data node on every call. This would cause a warning message as the node would have already been opened. Avoid this by tracking if the node has previously been opened. Note that this is a temporary fix since the open call for the Unicam embedded data node will be moved from pipeline_handler::configure() to pipeline_handler::match(). Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 41f1cbffa931..9847e926b048 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -138,7 +138,7 @@ class RPiCameraData : public CameraData { public: RPiCameraData(PipelineHandler *pipe) - : CameraData(pipe), state_(State::Stopped), + : CameraData(pipe), embeddedNodeOpened_(false), state_(State::Stopped), supportsFlips_(false), flipsAlterBayerOrder_(false), updateScalerCrop_(true), dropFrameCount_(0), ispOutputCount_(0) { @@ -183,6 +183,7 @@ public: std::unique_ptr delayedCtrls_; bool sensorMetadata_; + bool embeddedNodeOpened_; /* * All the functions in this class are called from a single calling @@ -726,8 +727,13 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config) if (data->sensorMetadata_) { format = {}; format.fourcc = V4L2PixelFormat(V4L2_META_FMT_SENSOR_DATA); + + if (!data->embeddedNodeOpened_) { + data->unicam_[Unicam::Embedded].dev()->open(); + data->embeddedNodeOpened_ = true; + } + LOG(RPI, Debug) << "Setting embedded data format."; - data->unicam_[Unicam::Embedded].dev()->open(); ret = data->unicam_[Unicam::Embedded].dev()->setFormat(&format); if (ret) { LOG(RPI, Error) << "Failed to set format on Unicam embedded: "