{"id":3238,"url":"https://patchwork.libcamera.org/api/patches/3238/?format=json","web_url":"https://patchwork.libcamera.org/patch/3238/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20200321183246.GA14651@kaaira-HP-Pavilion-Notebook>","date":"2020-03-21T18:32:46","name":"[libcamera-devel,v2] libcamera: rkisp1: Use parametered constructor instead of default","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"180632be6e67fa0ff459d344a9a5b4a47284c5f7","submitter":{"id":39,"url":"https://patchwork.libcamera.org/api/people/39/?format=json","name":"Kaaira Gupta","email":"kgupta@es.iitr.ac.in"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3238/mbox/","series":[{"id":756,"url":"https://patchwork.libcamera.org/api/series/756/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=756","date":"2020-03-21T18:32:46","name":"[libcamera-devel,v2] libcamera: rkisp1: Use parametered constructor instead of default","version":2,"mbox":"https://patchwork.libcamera.org/series/756/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3238/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3238/checks/","tags":{},"headers":{"Return-Path":"<kgupta@es.iitr.ac.in>","Received":["from mail-pg1-x542.google.com (mail-pg1-x542.google.com\n\t[IPv6:2607:f8b0:4864:20::542])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D34D560415\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 21 Mar 2020 19:32:54 +0100 (CET)","by mail-pg1-x542.google.com with SMTP id d17so4270943pgo.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 21 Mar 2020 11:32:54 -0700 (PDT)","from kaaira-HP-Pavilion-Notebook ([103.113.213.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tu12sm8745822pfm.165.2020.03.21.11.32.50\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tSat, 21 Mar 2020 11:32:52 -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=Vut/haz12uCQ/pDO9/q3asl7pFHcPnGWfdpApXdplxU=;\n\tb=bNflZaXpW0ZvS1n4Ymd/GZ+AHh4rDky+ysjykchlmAOrv3ek3bxjy78nDmLyjMdY/5\n\tz7Mva1dKRVT9B0RBM3eIfHVkm2MUNiYifRK8nk56ThKF5NBDwcjSz9pCW41atUOoMAEa\n\t03xW5n7R5Z29zV/r6TWB2keIRjH5lHsa4/afMszFQ/mi7O+TFz+Pr1nKnab1+UHJ9HxL\n\tfHWTwDqAN0KfFSiyAHePTGwLVRTCAyrGMTy1kUSRKfQnL4wekhsdankC6bWyS+LA2THV\n\tLp7Q0JNbI0/HeBCwzTEn3QxnVdFHvmdltS98D6rebOVI9q8ywzee0qcxOM409U1Xelt1\n\ta1EA==","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=Vut/haz12uCQ/pDO9/q3asl7pFHcPnGWfdpApXdplxU=;\n\tb=GQRQcHRkCONNWq+dLDH5DMAlv99A9m/kgq1iqNiWRrT8PUAE6IjvuZamkZqTQxHjJ7\n\t4TbMBulApZUo5d7TzJPpMrgoYX0E3PaLKE3WZL8BY6Q8urv7DgGt0RNJsDVLVyB9qaW0\n\tOrHL2DN2WtNnfq13xFCb54/3NAkl331GkkG+Wg07PY09MupoG2oGunWYd2dqv4OiMbt8\n\tVeTlZIRDpG9PG6G/Xds5+hVcZ3ktJoHHJ8Yi+5EPE1qdSbAMlSmei0vRg8xehsmVkTQo\n\t02+ENA6NoiLQtb2RdtMrT4M8AiIKLEx1hbD6sCbVejIpAYudULrRZu8UsLJel/3CRU4+\n\tvuTw==","X-Gm-Message-State":"ANhLgQ2lnPeg6KTfqJZZkbkLbb1diiQZun1JfmB8iSTxQ3PZIKH9jDlP\n\tUOSE33uw+kUCxP0tF8fSphRzrQ==","X-Google-Smtp-Source":"ADFU+vv4o03XV/ghDswKEBfsS23g2Jj8zfTLqkDb18O3vRFZ6uTKAWLREDlaSjFPD5+v9NEWBcMwiA==","X-Received":"by 2002:a63:8b41:: with SMTP id\n\tj62mr13939088pge.18.1584815573282; \n\tSat, 21 Mar 2020 11:32:53 -0700 (PDT)","Date":"Sun, 22 Mar 2020 00:02:46 +0530","From":"Kaaira Gupta <kgupta@es.iitr.ac.in>","To":"jacopo@jmondi.org, libcamera-devel@lists.libcamera.org,\n\tkieran.bingham@ideasonboard.com,\n\tHelen Koike <helen.koike@collabora.com>, \n\tVaishali Thakkar <vthakkar@vaishalithakkar.in>","Message-ID":"<20200321183246.GA14651@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 v2] 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":"Sat, 21 Mar 2020 18:32:55 -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 parametrized\ncounterpart by using StreamFormats in generateConfiguration() in rkisp1\n\nAlso, use erase(), instead of replace() in validate() to prevent it from\ncreating a new instance with empty constructor.\n\nSigned-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>\n---\nChanges since v1:\n\t- replace resize() by erase() in validate() to prevent it from\ncreating a new instance with empty constructor.\n\nWIP:\n        - It fails to build as other pipelines still use default\n          constructor.\n\n include/libcamera/stream.h               |  4 ++-\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 39 ++++++++++++++++--------\n src/libcamera/stream.cpp                 |  9 ------\n 3 files changed, 29 insertions(+), 23 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..8e8414e 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@@ -449,7 +453,7 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()\n \n \t/* Cap the number of entries to the available streams. */\n \tif (config_.size() > 1) {\n-\t\tconfig_.resize(1);\n+\t\tconfig_.erase(config_.begin() + 1, config_.end() - 1);\n \t\tstatus = Adjusted;\n \t}\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","v2"]}