From patchwork Tue Mar 24 17:56:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3308 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com Return-Path: Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C010760411 for ; Tue, 24 Mar 2020 18:57:03 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=es-iitr-ac-in.20150623.gappssmtp.com header.i=@es-iitr-ac-in.20150623.gappssmtp.com header.b="QqLMExTc"; dkim-atps=neutral Received: by mail-pg1-x532.google.com with SMTP id u12so9399511pgb.10 for ; Tue, 24 Mar 2020 10:57:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MWgywxvMYeI+ipWzmZQk0+GkEWZA5PZuWKJ75SGt2mA=; b=QqLMExTcWhbLlUZdPLJuZkZeJZ9J5iRMbt+JmosU5L4SXam2LOk5Sxdn9RDtuR/eBr QLDAd1m0uJ58KZ2o4Hry8wzIFuoqWtf5r4RfwXMh042qrG1RMK/LthaeIuuIWmHWJZub SWRmxNdl23o+wvXxSqFZaT2mLQPiAQdzycFhl8Psbd5Cbdq7LJIflf6p9PV+yjhp/06W qaWDb7fb9KyNSyUTIzXwW4ODoU7eyWNXItMGvFRZtg/kWcTFnLrxBBkgqLta9f1PRZgb xqV220+fN6aBNbSSb6wq0K6hvhegl4ym3Nzmv5qkvOZGFfp6qoEQpiJnOxwtJmG7QAQK biyg== 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; bh=MWgywxvMYeI+ipWzmZQk0+GkEWZA5PZuWKJ75SGt2mA=; b=pgZaTEg0XraCn90u7RfsJrTG4TiVtL+PH81kSrYEQ4wuMhbBnPwtLctMzloqGodzeO 1T3ArTWs76KYTIeL5blOtpD/C/AO4XDBAyDM0KY9Bcskqo1m6jA3mxq3vMsu99iI6D0o YAGQFHSm9HjqlahosVDboeB+6nXn9xdU7pCwJ9txlE2sMXy6Cl/mf92bWocD71uUiAzI GrNHmjdB+guUlTr543o1Y37BgM7HKTYBhTTv4NMPHkbKK58a99XOuHJ0Lmi8mr9t7dLQ Zf1n0NczTHOD7uR963t23mJnX1SufEnIqgF2UZ8YGg196FVtsH/psJ3G1gPSUcC/Tz/m i3mA== X-Gm-Message-State: ANhLgQ2b5zL4cVCevmVM7xFffM0UllhCvJVsy1Vs//x0mjGumRY2v19V q9vQGr9fnSeEP9qEMmrf34PmuQ== X-Google-Smtp-Source: ADFU+vtQcTBXstP1pFZiMKUgc0tF7KOWHP5MAjg0Y/fvZ8hecHx4pP3PSnoyd0pfHhXMvxIYz0UPUg== X-Received: by 2002:a63:c50f:: with SMTP id f15mr28778054pgd.88.1585072622123; Tue, 24 Mar 2020 10:57:02 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.154]) by smtp.gmail.com with ESMTPSA id n22sm2770316pjq.36.2020.03.24.10.57.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 10:57:01 -0700 (PDT) From: Kaaira Gupta To: libcamera-devel@lists.libcamera.org, Kieran Bingham , Helen Koike , Vaishali Thakkar Cc: Kaaira Gupta Date: Tue, 24 Mar 2020 23:26:41 +0530 Message-Id: <20200324175643.22382-2-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200324175643.22382-1-kgupta@es.iitr.ac.in> References: <20200324175643.22382-1-kgupta@es.iitr.ac.in> Subject: [libcamera-devel] [PATCH v2 1/3] libcamera: pipeline: Replace resize() with erase() in validate() 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: Tue, 24 Mar 2020 17:57:04 -0000 Replace .resize() with .erase() in validate() calls in all pipelines, because resize() calls default constructor StreamConfiguration() when it tries to increase the size. Signed-off-by: Kaaira Gupta Reviewed-by: Jacopo Mondi --- src/libcamera/pipeline/ipu3/ipu3.cpp | 8 ++++++-- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 8 ++++++-- src/libcamera/pipeline/uvcvideo.cpp | 8 ++++++-- src/libcamera/pipeline/vimc.cpp | 8 ++++++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 1b44460..36f3990 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -298,9 +298,13 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate() if (config_.empty()) return Invalid; - /* Cap the number of entries to the available streams. */ + /* + * Cap the number of entries to the available streams. + * Use erase() instead of resize() because resize() uses default constructor + * when it increases config_'s size, which we wish to avoid. + */ if (config_.size() > 2) { - config_.resize(2); + config_.erase(config_.begin() + 2, config_.end()); status = Adjusted; } diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 2f909ce..04b0ed3 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -447,9 +447,13 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate() if (config_.empty()) return Invalid; - /* Cap the number of entries to the available streams. */ + /* + * Cap the number of entries to the available streams. + * Use erase() instead of resize() because resize() uses default constructor + * when it increases config_'s size, which we wish to avoid. + */ if (config_.size() > 1) { - config_.resize(1); + config_.erase(config_.begin() + 1, config_.end()); status = Adjusted; } diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp index ffbddf2..462eae2 100644 --- a/src/libcamera/pipeline/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo.cpp @@ -97,9 +97,13 @@ CameraConfiguration::Status UVCCameraConfiguration::validate() if (config_.empty()) return Invalid; - /* Cap the number of entries to the available streams. */ + /* + * Cap the number of entries to the available streams. + * Use erase() instead of resize() because resize() uses default constructor + * when it increases config_'s size, which we wish to avoid. + */ if (config_.size() > 1) { - config_.resize(1); + config_.erase(config_.begin() + 1, config_.end()); status = Adjusted; } diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp index b04a972..4c991ff 100644 --- a/src/libcamera/pipeline/vimc.cpp +++ b/src/libcamera/pipeline/vimc.cpp @@ -123,9 +123,13 @@ CameraConfiguration::Status VimcCameraConfiguration::validate() if (config_.empty()) return Invalid; - /* Cap the number of entries to the available streams. */ + /* + * Cap the number of entries to the available streams. + * Use erase() instead of resize() because resize() uses default constructor + * when it increases config_'s size, which we wish to avoid. + */ if (config_.size() > 1) { - config_.resize(1); + config_.erase(config_.begin() + 1, config_.end()); status = Adjusted; } From patchwork Tue Mar 24 17:56:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3309 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com Return-Path: Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 28AC760411 for ; Tue, 24 Mar 2020 18:57:09 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=es-iitr-ac-in.20150623.gappssmtp.com header.i=@es-iitr-ac-in.20150623.gappssmtp.com header.b="uf7Omt8z"; dkim-atps=neutral Received: by mail-pl1-x631.google.com with SMTP id b9so7699831pls.12 for ; Tue, 24 Mar 2020 10:57:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BxCHFxmMHeDPopi6DfMS46XCjrfnqI6dzpiKbtcYCkw=; b=uf7Omt8z/OWYeZWI39Aw3uAZvX7LLdayv5Y4pLCzl9MAULeD9aZVHUBv9B4Jccv599 r4/yDjRBAhv+lNPGbG5DUcfPgIC/HQYE/LyVK6Bf0jG0EwuiwcaTWASeZNB325vE81j5 kLAyrdy2tUGi4321I8p8qGWdyHu9T7dnGJlSgRCvXlaH1RnfxZEywb+FOxZKEeJflAJT ct/5DsvZ1WMo7dBZTAVnnMYld3cfqk/npY6anWdxfZjFjlA55aLmb6FaeNyHZQgLvlku 7gajNjETcGNGMjYNCuGsz7V14BRU8LFCkgQYfrzUG8ukQ3ScIC+bnTz9c97v/a6mfuNf TTsw== 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; bh=BxCHFxmMHeDPopi6DfMS46XCjrfnqI6dzpiKbtcYCkw=; b=KqY6CnzrQLTo7P3mee6SsB3KQ7AyA8zgZKtFyB5XTWeqst42hUcjS9mY3GMnOwYDcX YSmUR4mTbj2AgfwL9ZAr0M1z7rprpA+jLlP2ndi1iK18ldnHUWX7XeC+sOj1up/0EoTy RmxS+7BlWVkzLppiJvGS+2J55GPXRNs9OpQGPVuclkq7KVW0x+nrAo/wCe2LNkbCsHFt 9UsdpYwWfwV7QtpbujIFBxGtxnc13B0AYr1ytsmU6cq5pXEJ0XpnQHsXcTtNImyXiFeD pICvqhuMm4cKiegsbaKWHzBFZs4WTMB/MVIc/awLhESFyMYQyhBPxzybnuQ+MuGyUsfz 18hQ== X-Gm-Message-State: ANhLgQ1s5jGe8zgs0FnubZz6gSEXYTT/2j7h/2uGToBuSDhMEoUpH1MM SzVtILCUb2euWdDL7ZUq9H3XDA== X-Google-Smtp-Source: ADFU+vul9yArNEP5pJCtJKQG8HJ3MaQYdjSqz6C8mlg8WgCCGFwy66Ss2gMs5VXFcGsT3PDg/+ijbA== X-Received: by 2002:a17:90a:d585:: with SMTP id v5mr6776996pju.168.1585072627149; Tue, 24 Mar 2020 10:57:07 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.154]) by smtp.gmail.com with ESMTPSA id j38sm14995443pgi.51.2020.03.24.10.57.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 10:57:06 -0700 (PDT) From: Kaaira Gupta To: libcamera-devel@lists.libcamera.org, Kieran Bingham , Helen Koike , Vaishali Thakkar Cc: Kaaira Gupta Date: Tue, 24 Mar 2020 23:26:42 +0530 Message-Id: <20200324175643.22382-3-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200324175643.22382-1-kgupta@es.iitr.ac.in> References: <20200324175643.22382-1-kgupta@es.iitr.ac.in> Subject: [libcamera-devel] [PATCH v2 2/3] libcamera: pipeline: rkisp1: Use parameterized StreamConfiguration 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: Tue, 24 Mar 2020 17:57:09 -0000 Replace default constructor StreamConfiguration() by its parameterized counterpart by using StreamFormats in generateConfiguration() in rkisp1. Signed-off-by: Kaaira Gupta Reviewed-by: Jacopo Mondi --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 39 ++++++++++++++++-------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 04b0ed3..cfbfc9e 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; @@ -541,7 +545,18 @@ CameraConfiguration *PipelineHandlerRkISP1::generateConfiguration(Camera *camera if (roles.empty()) return config; - StreamConfiguration cfg{}; + std::map> pixelformats; + for (PixelFormat pixelformat : formats) { + std::vector sizes{ + /* Minimum and maximum capabilities of ISP output */ + 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(); From patchwork Tue Mar 24 17:56:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3310 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com Return-Path: Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5D0CB62BEB for ; Tue, 24 Mar 2020 18:57:14 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=es-iitr-ac-in.20150623.gappssmtp.com header.i=@es-iitr-ac-in.20150623.gappssmtp.com header.b="L9HAGOc8"; dkim-atps=neutral Received: by mail-pj1-x1044.google.com with SMTP id v13so1929006pjb.0 for ; Tue, 24 Mar 2020 10:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dNTjpE4aJ2HhzaxdksRpZD9ZJFccgdF6ws3erMNs82o=; b=L9HAGOc8G9BBb32pnUqHNA9xqWr/WwGtKZjupUEOQDQShY79zb9P3RDeFdnhrXWJ97 NCL3KBFLuHHqyyNnQsNSifgwb38LLrjSxvl8FSPHNrOzBmJZwZLvCzXXwEuAAZaD3Ad6 JsCyMIh6iD0uplH19S9HfR5E4awliusumX6AULk5O/0ueF/tys9kBxgQt60y7NIqNsGE 7aCM0m5NOZK3hZeObp4XEIBF7CKKMfeJBdQoFfSIXL+cqZs2Zo3OxBqjVzCJwVIKUtog 7x9i6gN+zDdyuqBxMLP1jHYwldhyOund1jRrKWKO0Mm0tYtgeojb0ZcrBVFqxXJtRntN avpQ== 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; bh=dNTjpE4aJ2HhzaxdksRpZD9ZJFccgdF6ws3erMNs82o=; b=EUtPjqOGTLkdwoi7Tbv4KPmAUwbtdnNkNaM+GI+CUhLQkAxqZFAP+vdYmOB0G5+b/+ JxJKCIFwLPBP9zsYTE9NS5/lNnFIEYbHbBpv+LgGbzJiY8MZrVg9TJ737kib0guKUDO6 ASmuPDP4qJRFZgJR1rp+jCLvlZPayjzqwmzcCK0MT1rmWeRHWUQN5PucTogRjsoJnbS/ eBWICe6O1yFwYSBzpCkF+zJvILOxEsuUQ1jX07lxLygI/73bgW9gE0ZGL7OcR9ufWEij cghx4D+3hmamVXHj2biBWJIZHKpP/lpI6Vz9O/eLI4o3yV1gjQcldPzs8Sa5BJT5r/Zz sQyA== X-Gm-Message-State: ANhLgQ13OhVxKyUQgKZsfyXs8/Fs1GLNkfe9uB9NS5a2M0Ihtoz+1sDw Cj/pbecgg3lrrPbWrtfUYZZBIQ== X-Google-Smtp-Source: ADFU+vvEz+Lq6Si4B7AhWju30c+CYcDGtoq57FTZuGO98E2u/XBBKpuAJP0IKpnBlC1PbdaMHN0K0A== X-Received: by 2002:a17:902:bb92:: with SMTP id m18mr28265022pls.46.1585072632929; Tue, 24 Mar 2020 10:57:12 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.154]) by smtp.gmail.com with ESMTPSA id b17sm16774962pff.81.2020.03.24.10.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 10:57:12 -0700 (PDT) From: Kaaira Gupta To: libcamera-devel@lists.libcamera.org, Kieran Bingham , Helen Koike , Vaishali Thakkar Cc: Kaaira Gupta Date: Tue, 24 Mar 2020 23:26:43 +0530 Message-Id: <20200324175643.22382-4-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200324175643.22382-1-kgupta@es.iitr.ac.in> References: <20200324175643.22382-1-kgupta@es.iitr.ac.in> Subject: [libcamera-devel] [PATCH v2 3/3] libcamera: pipeline: ipu3: Use parameterized StreamConfiguration 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: Tue, 24 Mar 2020 17:57:14 -0000 Replace default constructor StreamConfiguration() by its parameterized counterpart by using StreamFormats in generateConfiguration() in ipu3 Signed-off-by: Kaaira Gupta --- src/libcamera/pipeline/ipu3/ipu3.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 36f3990..1400099 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -399,9 +399,18 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera, }; config = new IPU3CameraConfiguration(camera, data); + ImgUDevice *imgu = data->imgu_; + V4L2VideoDevice *dev = (imgu->output_).dev; + auto formats = (*dev).formats(); + + /* We find the range of the only pixel format that the driver upports. */ + std::vector range = formats[V4L2PixelFormat(PixelFormat(DRM_FORMAT_NV12))]; + std::map> pixelformats; + pixelformats[PixelFormat(DRM_FORMAT_NV12)] = {range}; for (const StreamRole role : roles) { - StreamConfiguration cfg = {}; + StreamFormats format(pixelformats); + StreamConfiguration cfg(format); IPU3Stream *stream = nullptr; cfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12);