From patchwork Fri Mar 20 21:50:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3226 Return-Path: Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8CD6360416 for ; Fri, 20 Mar 2020 22:50:29 +0100 (CET) Received: by mail-pj1-x1031.google.com with SMTP id q16so3860455pje.1 for ; Fri, 20 Mar 2020 14:50:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=2xqTuOMdloT+qXWlxdS3b28u8F5Tfo2P+JAuEC1pNLI=; b=msejUsMoXBtka/rKwxRRt8ENE2TMcN7MT+5jyHOGZFoIZ3g+NVCSlShpWSP/YgN5JV EsnAVScHIkYglezgYIA4IOz4uSGDdWm+ZV3hSJrL+bY692AT37eZTe3SihdzZhsfERQL yAO+uFxYUkzNtzP461oYpdG/lyw4vYcwTi6D4bnHI9sbOe7+uSaUHrzhbU5VVEFooEF0 iGR85KYFibUBDauzMdngN2hSOxgtKWfhO7ilnQkOHcfwfiXznTW+19PTeqy/qdwu9/pY HTeJ5sDOPRig+K90x/NOYCORITNX4+7s1/BuRtcrn+6yhyXLb+8k4JxNyfSpDP1XfvqA CuYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=2xqTuOMdloT+qXWlxdS3b28u8F5Tfo2P+JAuEC1pNLI=; b=ddd8BOWXSCzFJLqsiMkUUquopEBsOOCWW3EtqjaVlWHz667bOrMPBEPWvy9sME0ZZc 5HK0DBB1kWaItCryzAuFIikMZq08W8zP+F6Ul1vgRhUnEzbwfPzEz+B5hmn1Fes9TWLh 12de6elIQ8bubx0JA2Keaaipy+K8welMcVBbs5Uve0+ytovS+U4bT7h25ZXdfNc26yWB r1MdGyqvegAcR7lgCYV0dQ363IkF3+RL/vatXgrnT+r1mo0aih7Vnck37pRHIaDElxH6 NhEAT7YD55E36kLixiFPn7eUmAj/Rqb6N4RqN/DB+FrjpDwE4QQVGaMqZeEKBkpn+1rR SJIw== X-Gm-Message-State: ANhLgQ1Y3nlo//aG2OQ1lVnn7FeFu3e3V+k/OGlUE14JBkw3gnc5hpm8 HiGJlSU0NhF9CsfJLkVM+fr9QVpcmnc= X-Google-Smtp-Source: ADFU+vvd/O8gOhW4k28acyj4a4lCzfJOYf5ZuvvjumML7FbU4vqfn8lqQBuaSRgcMdQaziKatBtTjw== X-Received: by 2002:a17:90b:4d07:: with SMTP id mw7mr11712504pjb.94.1584741027228; Fri, 20 Mar 2020 14:50:27 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.154]) by smtp.gmail.com with ESMTPSA id x190sm6300339pfb.96.2020.03.20.14.50.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Mar 2020 14:50:26 -0700 (PDT) Date: Sat, 21 Mar 2020 03:20:20 +0530 From: Kaaira Gupta To: libcamera-devel@lists.libcamera.org, kieran.bingham@ideasonboard.com, Helen Koike , Vaishali Thakkar Message-ID: <20200320215020.GA26347@kaaira-HP-Pavilion-Notebook> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) Subject: [libcamera-devel] [PATCH LIBCAMERA WIP] libcamera: rkisp1: Use parametered constructor instead of default 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-List-Received-Date: Fri, 20 Mar 2020 21:50:29 -0000 Use of default constructor StreamConfiguration() in deprecated, hence make it private. Make Stream class a friend of StreamConfiguration as it uses the default constructor. Replace default constructor StreamConfiguration() by it's parametered counterpart by using StreamFormats in generateConfiguration() in rkisp1 Signed-off-by: Kaaira Gupta --- WIP: - It fails to build as other pipelines still use default constructor. - Even rkisp1 fails as it uses default constructor in its validate() function. - I have taken care of generateConfiguration() only. include/libcamera/stream.h | 4 ++- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 37 ++++++++++++++++-------- src/libcamera/stream.cpp | 9 ------ 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h index b1441f8..c19aed6 100644 --- a/include/libcamera/stream.h +++ b/include/libcamera/stream.h @@ -37,7 +37,6 @@ private: }; struct StreamConfiguration { - StreamConfiguration(); StreamConfiguration(const StreamFormats &formats); PixelFormat pixelFormat; @@ -52,8 +51,11 @@ struct StreamConfiguration { std::string toString() const; private: + StreamConfiguration(); Stream *stream_; StreamFormats formats_; + + friend class Stream; }; enum StreamRole { diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 2f909ce..bf97b53 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -218,6 +218,21 @@ private: Camera *activeCamera_; }; +namespace { + +static const std::array formats{ + PixelFormat(DRM_FORMAT_YUYV), + PixelFormat(DRM_FORMAT_YVYU), + PixelFormat(DRM_FORMAT_VYUY), + PixelFormat(DRM_FORMAT_NV16), + PixelFormat(DRM_FORMAT_NV61), + PixelFormat(DRM_FORMAT_NV21), + PixelFormat(DRM_FORMAT_NV12), + /* \todo Add support for 8-bit greyscale to DRM formats */ +}; + +} /* namespace */ + RkISP1Frames::RkISP1Frames(PipelineHandler *pipe) : pipe_(dynamic_cast(pipe)) { @@ -430,17 +445,6 @@ RkISP1CameraConfiguration::RkISP1CameraConfiguration(Camera *camera, CameraConfiguration::Status RkISP1CameraConfiguration::validate() { - static const std::array formats{ - PixelFormat(DRM_FORMAT_YUYV), - PixelFormat(DRM_FORMAT_YVYU), - PixelFormat(DRM_FORMAT_VYUY), - PixelFormat(DRM_FORMAT_NV16), - PixelFormat(DRM_FORMAT_NV61), - PixelFormat(DRM_FORMAT_NV21), - PixelFormat(DRM_FORMAT_NV12), - /* \todo Add support for 8-bit greyscale to DRM formats */ - }; - const CameraSensor *sensor = data_->sensor_; Status status = Valid; @@ -537,7 +541,16 @@ CameraConfiguration *PipelineHandlerRkISP1::generateConfiguration(Camera *camera if (roles.empty()) return config; - StreamConfiguration cfg{}; + std::map> pixelformats; + + for (PixelFormat pixelformat : formats) { + std::vector sizes{ + SizeRange{ { 32, 16 }, { 4416, 3312 } } + }; + pixelformats[pixelformat] = sizes; + } + StreamFormats format(pixelformats); + StreamConfiguration cfg(format); cfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12); cfg.size = data->sensor_->resolution(); diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp index ea3d214..96b3dc5 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -274,15 +274,6 @@ SizeRange StreamFormats::range(const PixelFormat &pixelformat) const * configured for a single video stream. */ -/** - * \todo This method is deprecated and should be removed once all pipeline - * handlers provied StreamFormats. - */ -StreamConfiguration::StreamConfiguration() - : pixelFormat(0), stream_(nullptr) -{ -} - /** * \brief Construct a configuration with stream formats */