{"id":3226,"url":"https://patchwork.libcamera.org/api/1.1/patches/3226/?format=json","web_url":"https://patchwork.libcamera.org/patch/3226/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200320215020.GA26347@kaaira-HP-Pavilion-Notebook>","date":"2020-03-20T21:50:20","name":"[libcamera-devel,WIP] libcamera: rkisp1: Use parametered constructor instead of default","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"e0d0df02f398f73594cf6f571bf623e63d461fc4","submitter":{"id":39,"url":"https://patchwork.libcamera.org/api/1.1/people/39/?format=json","name":"Kaaira Gupta","email":"kgupta@es.iitr.ac.in"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3226/mbox/","series":[{"id":752,"url":"https://patchwork.libcamera.org/api/1.1/series/752/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=752","date":"2020-03-20T21:50:20","name":"[libcamera-devel,WIP] libcamera: rkisp1: Use parametered constructor instead of default","version":1,"mbox":"https://patchwork.libcamera.org/series/752/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3226/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3226/checks/","tags":{},"headers":{"Return-Path":"<kgupta@es.iitr.ac.in>","Received":["from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com\n\t[IPv6:2607:f8b0:4864:20::1031])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8CD6360416\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Mar 2020 22:50:29 +0100 (CET)","by mail-pj1-x1031.google.com with SMTP id q16so3860455pje.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Mar 2020 14:50:29 -0700 (PDT)","from kaaira-HP-Pavilion-Notebook ([103.113.213.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tx190sm6300339pfb.96.2020.03.20.14.50.24\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tFri, 20 Mar 2020 14:50:26 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:subject:message-id:mime-version:content-disposition\n\t:user-agent; bh=2xqTuOMdloT+qXWlxdS3b28u8F5Tfo2P+JAuEC1pNLI=;\n\tb=msejUsMoXBtka/rKwxRRt8ENE2TMcN7MT+5jyHOGZFoIZ3g+NVCSlShpWSP/YgN5JV\n\tEsnAVScHIkYglezgYIA4IOz4uSGDdWm+ZV3hSJrL+bY692AT37eZTe3SihdzZhsfERQL\n\tyAO+uFxYUkzNtzP461oYpdG/lyw4vYcwTi6D4bnHI9sbOe7+uSaUHrzhbU5VVEFooEF0\n\tiGR85KYFibUBDauzMdngN2hSOxgtKWfhO7ilnQkOHcfwfiXznTW+19PTeqy/qdwu9/pY\n\tHTeJ5sDOPRig+K90x/NOYCORITNX4+7s1/BuRtcrn+6yhyXLb+8k4JxNyfSpDP1XfvqA\n\tCuYg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:subject:message-id:mime-version\n\t:content-disposition:user-agent;\n\tbh=2xqTuOMdloT+qXWlxdS3b28u8F5Tfo2P+JAuEC1pNLI=;\n\tb=ddd8BOWXSCzFJLqsiMkUUquopEBsOOCWW3EtqjaVlWHz667bOrMPBEPWvy9sME0ZZc\n\t5HK0DBB1kWaItCryzAuFIikMZq08W8zP+F6Ul1vgRhUnEzbwfPzEz+B5hmn1Fes9TWLh\n\t12de6elIQ8bubx0JA2Keaaipy+K8welMcVBbs5Uve0+ytovS+U4bT7h25ZXdfNc26yWB\n\tr1MdGyqvegAcR7lgCYV0dQ363IkF3+RL/vatXgrnT+r1mo0aih7Vnck37pRHIaDElxH6\n\tNhEAT7YD55E36kLixiFPn7eUmAj/Rqb6N4RqN/DB+FrjpDwE4QQVGaMqZeEKBkpn+1rR\n\tSJIw==","X-Gm-Message-State":"ANhLgQ1Y3nlo//aG2OQ1lVnn7FeFu3e3V+k/OGlUE14JBkw3gnc5hpm8\n\tHiGJlSU0NhF9CsfJLkVM+fr9QVpcmnc=","X-Google-Smtp-Source":"ADFU+vvd/O8gOhW4k28acyj4a4lCzfJOYf5ZuvvjumML7FbU4vqfn8lqQBuaSRgcMdQaziKatBtTjw==","X-Received":"by 2002:a17:90b:4d07:: with SMTP id\n\tmw7mr11712504pjb.94.1584741027228; \n\tFri, 20 Mar 2020 14:50:27 -0700 (PDT)","Date":"Sat, 21 Mar 2020 03:20:20 +0530","From":"Kaaira Gupta <kgupta@es.iitr.ac.in>","To":"libcamera-devel@lists.libcamera.org, kieran.bingham@ideasonboard.com,\n\tHelen Koike <helen.koike@collabora.com>,\n\tVaishali Thakkar <vthakkar@vaishalithakkar.in>","Message-ID":"<20200320215020.GA26347@kaaira-HP-Pavilion-Notebook>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","User-Agent":"Mutt/1.9.4 (2018-02-28)","Subject":"[libcamera-devel] [PATCH LIBCAMERA WIP] libcamera: rkisp1: Use\n\tparametered constructor instead of default","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 20 Mar 2020 21:50:29 -0000"},"content":"Use of default constructor StreamConfiguration() in deprecated, hence\nmake it private. Make Stream class a friend of StreamConfiguration as it\nuses the default constructor.\n\nReplace default constructor StreamConfiguration() by it's parametered\ncounterpart by using StreamFormats in generateConfiguration() in rkisp1\n\nSigned-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>\n---\nWIP:\n\t- It fails to build as other pipelines still use default\n\t  constructor.\n\t- Even rkisp1 fails as it uses default constructor in its\n\t  validate() function.\n\t- I have taken care of generateConfiguration() only.\n\n include/libcamera/stream.h               |  4 ++-\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 37 ++++++++++++++++--------\n src/libcamera/stream.cpp                 |  9 ------\n 3 files changed, 28 insertions(+), 22 deletions(-)","diff":"diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h\nindex b1441f8..c19aed6 100644\n--- a/include/libcamera/stream.h\n+++ b/include/libcamera/stream.h\n@@ -37,7 +37,6 @@ private:\n };\n \n struct StreamConfiguration {\n-\tStreamConfiguration();\n \tStreamConfiguration(const StreamFormats &formats);\n \n \tPixelFormat pixelFormat;\n@@ -52,8 +51,11 @@ struct StreamConfiguration {\n \tstd::string toString() const;\n \n private:\n+\tStreamConfiguration();\n \tStream *stream_;\n \tStreamFormats formats_;\n+\n+\tfriend class Stream;\n };\n \n enum StreamRole {\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 2f909ce..bf97b53 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -218,6 +218,21 @@ private:\n \tCamera *activeCamera_;\n };\n \n+namespace {\n+\n+static const std::array<PixelFormat, 8> formats{\n+\tPixelFormat(DRM_FORMAT_YUYV),\n+\tPixelFormat(DRM_FORMAT_YVYU),\n+\tPixelFormat(DRM_FORMAT_VYUY),\n+\tPixelFormat(DRM_FORMAT_NV16),\n+\tPixelFormat(DRM_FORMAT_NV61),\n+\tPixelFormat(DRM_FORMAT_NV21),\n+\tPixelFormat(DRM_FORMAT_NV12),\n+\t/* \\todo Add support for 8-bit greyscale to DRM formats */\n+};\n+\n+} /* namespace */\n+\n RkISP1Frames::RkISP1Frames(PipelineHandler *pipe)\n \t: pipe_(dynamic_cast<PipelineHandlerRkISP1 *>(pipe))\n {\n@@ -430,17 +445,6 @@ RkISP1CameraConfiguration::RkISP1CameraConfiguration(Camera *camera,\n \n CameraConfiguration::Status RkISP1CameraConfiguration::validate()\n {\n-\tstatic const std::array<PixelFormat, 8> formats{\n-\t\tPixelFormat(DRM_FORMAT_YUYV),\n-\t\tPixelFormat(DRM_FORMAT_YVYU),\n-\t\tPixelFormat(DRM_FORMAT_VYUY),\n-\t\tPixelFormat(DRM_FORMAT_NV16),\n-\t\tPixelFormat(DRM_FORMAT_NV61),\n-\t\tPixelFormat(DRM_FORMAT_NV21),\n-\t\tPixelFormat(DRM_FORMAT_NV12),\n-\t\t/* \\todo Add support for 8-bit greyscale to DRM formats */\n-\t};\n-\n \tconst CameraSensor *sensor = data_->sensor_;\n \tStatus status = Valid;\n \n@@ -537,7 +541,16 @@ CameraConfiguration *PipelineHandlerRkISP1::generateConfiguration(Camera *camera\n \tif (roles.empty())\n \t\treturn config;\n \n-\tStreamConfiguration cfg{};\n+\tstd::map<PixelFormat, std::vector<SizeRange>> pixelformats;\n+\n+\tfor (PixelFormat pixelformat : formats) {\n+\t\tstd::vector<SizeRange> sizes{\n+\t\t\tSizeRange{ { 32, 16 }, { 4416, 3312 } }\n+\t\t};\n+\t\tpixelformats[pixelformat] = sizes;\n+\t}\n+\tStreamFormats format(pixelformats);\n+\tStreamConfiguration cfg(format);\n \tcfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12);\n \tcfg.size = data->sensor_->resolution();\n \ndiff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\nindex ea3d214..96b3dc5 100644\n--- a/src/libcamera/stream.cpp\n+++ b/src/libcamera/stream.cpp\n@@ -274,15 +274,6 @@ SizeRange StreamFormats::range(const PixelFormat &pixelformat) const\n  * configured for a single video stream.\n  */\n \n-/**\n- * \\todo This method is deprecated and should be removed once all pipeline\n- * handlers provied StreamFormats.\n- */\n-StreamConfiguration::StreamConfiguration()\n-\t: pixelFormat(0), stream_(nullptr)\n-{\n-}\n-\n /**\n  * \\brief Construct a configuration with stream formats\n  */\n","prefixes":["libcamera-devel","WIP"]}