From patchwork Mon Mar 23 23:28:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3292 Return-Path: Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B8EAD60417 for ; Tue, 24 Mar 2020 00:29:58 +0100 (CET) Received: by mail-pf1-x441.google.com with SMTP id 23so8333615pfj.1 for ; Mon, 23 Mar 2020 16:29:58 -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=3J5D7TFPdLOULzPBNeyi1SvzT2BqMrZXa+z/CdzZtIM=; b=tqgWokWkhGppTaw3RTCuC2kdORsvduUaVFDF9KIHKmFJ5fbvxXKJKUDjlS3pdv2f9J B9l90I6Twp6fcKWgF4/2HBiAfUIBAfj2eFqHf5VczLovjn2Y6IFwXjeC3jv7zAKL5/3q ctmmJBNUluqd1Byp+VYgiWEcEP8cyLtgywvWI+W0dKp4Gl/zpV8dfY+DWL2/q/cEWDlJ +/NmRdTYV5ZGIKeORkDyl0H0GZl0N3RvAJPr5SBrr4N33mkaIJXKzFYpw9vJwl4CKpdm 8R20yeFfkHa6Nam9a7SbUnEqqgnABhW0u+SLHijdxXlah24M0VlDsOraWofsQQTrV+QZ eRsg== 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=3J5D7TFPdLOULzPBNeyi1SvzT2BqMrZXa+z/CdzZtIM=; b=M6Bm5vpbGi5Jv0Q31ytd7joxcb0iuUFCcaKoRh/j1dXPxUZ0ga6+MGqLLIJjta2ZSD pnfc1ILZDNA/Mvl3VOqRJ6m5s0rgEx6BvQNcaV6Qa0xIhb4uCTnx4WI3v/iJAWi2YLK0 TRnaSICMOfMQ72KWp6mD2vS5KA7NpG2X23oWu1WjF1wc3md+XxllszwG2X3N4se/fwJ5 mk6vsoPri8SzSoT4S+CElIDiAJcFNxhFOkZZlIjt5/uIWNbomh+5I5oVw/LEN+2UnwZM R/qOF0JuN0ENYVhr0qKCo+BYCuSPBN/efTVM+YdLfKxP1+2Cl2S5A6sd787bYqLkcS1X kX4w== X-Gm-Message-State: ANhLgQ3yQxx7nDGx8LwhleSdt/iLbfpy+0C+6usgXggx/gfF1m+Bu++u v7+g3NRjcQ3j3q2niRUv6vEpiA== X-Google-Smtp-Source: ADFU+vvYHp69x8cjJEuUYsdZkVTQw4Jsd5iDSbEKq9GwrHOkknRn5Cp3ZtnlosKXSpZEaclNmUhxRw== X-Received: by 2002:aa7:988f:: with SMTP id r15mr27219764pfl.252.1585006197027; Mon, 23 Mar 2020 16:29:57 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.154]) by smtp.gmail.com with ESMTPSA id d206sm13816336pfd.160.2020.03.23.16.29.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2020 16:29:56 -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 04:58:59 +0530 Message-Id: <20200323232901.29169-2-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200323232901.29169-1-kgupta@es.iitr.ac.in> References: <20200323232901.29169-1-kgupta@es.iitr.ac.in> Subject: [libcamera-devel] [PATCH 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: Mon, 23 Mar 2020 23:29:58 -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 | 9 +++++++-- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 8 ++++++-- src/libcamera/pipeline/uvcvideo.cpp | 8 ++++++-- src/libcamera/pipeline/vimc.cpp | 8 ++++++-- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 1b44460..7feb44c 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -298,9 +298,14 @@ 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 Mon Mar 23 23:29:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3293 Return-Path: Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0041560417 for ; Tue, 24 Mar 2020 00:30:31 +0100 (CET) Received: by mail-pf1-x431.google.com with SMTP id j1so5619006pfe.0 for ; Mon, 23 Mar 2020 16:30:31 -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=7aT/VOTF4OI5tBdLEsW/gGD8NC+znxJEhpvIOMeYaAk=; b=wiT/Z4lsRkmmb6XhB4yvtmZmfZRvCrjhJh6utFFzCd6inimZBXiJkUnGLbaPuoibDc W5J2mpWQ3KTCei2DvWqa5NviluymJQq0Vln64qCQbADpPpaK5IhToGHZVniB/im+T40J pxZyB5H4YIWS/sbCuCQtGprDYTdSyQl01yNx/LkVvlDcgm3ODpgBQ8SWb0TKn3TFYva1 5lIbOTMcgeuaWuc4gjpecWiHBzfaxDHtJ4BfFhVY/5Veaz8mF9q39lVivqtO5Xa72aKy WNgFskkAuZ5so4OGz/Gz6+0bm6Q1huLkpLQQgLd+fn+138U1rjnFGMzl66uLHuMpGi2p Q8WQ== 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=7aT/VOTF4OI5tBdLEsW/gGD8NC+znxJEhpvIOMeYaAk=; b=j483C4WNviHFyYKy3hXqE1tA/8KtccdQ8LGCHn2hlNlJVD0m0J78/XOvUZ1lKQRizB rBYWcd8jDuFQD16taTbyvILXsUXBOXjyRj2wCYMnfpKJmE+cpiH8zbOYgzWKNHdyFiFV V5N8g3BTCmvYs42ICE0y+cM1NkbamECHYRgxuUxy9L09v5OhNLL5VK43hZo6C8EvH0UC d/s+9ryLeQXP2hZWlPTwYT0jpJHQ4WL636xohMVG7vpVka5hMA+0XRfrv/08l67Nl27o 21XoLh95dIraebycyKAwYHR01eprygY/uzVX44idRKPAg4mE66iJtz7YX/UNT+wg0uSM ZsMA== X-Gm-Message-State: ANhLgQ19AeKIFKM05zFTm1Mk1KqNZ0cfWpejTzc/NvrnxBogILMlgUs8 zuUpysos43FElmJc0J3sgkuHTg== X-Google-Smtp-Source: ADFU+vseyh17VfXtm5s8XV/149Ru55z0rlS2r6IKi9BXQPkbI7ngs8djZnIRVHc523Yyva6Lu3JQMQ== X-Received: by 2002:aa7:828e:: with SMTP id s14mr25576663pfm.15.1585006230564; Mon, 23 Mar 2020 16:30:30 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.154]) by smtp.gmail.com with ESMTPSA id j14sm2244008pgk.74.2020.03.23.16.30.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2020 16:30:29 -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 04:59:00 +0530 Message-Id: <20200323232901.29169-3-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200323232901.29169-1-kgupta@es.iitr.ac.in> References: <20200323232901.29169-1-kgupta@es.iitr.ac.in> Subject: [libcamera-devel] [PATCH 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: Mon, 23 Mar 2020 23:30:32 -0000 Replace default constructor StreamConfiguration() by it's 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 Mon Mar 23 23:29:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3294 Return-Path: Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B782860417 for ; Tue, 24 Mar 2020 00:30:50 +0100 (CET) Received: by mail-pl1-x642.google.com with SMTP id h11so6597028plk.7 for ; Mon, 23 Mar 2020 16:30:50 -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=1vG2OcOONhiCi516JQ58atnaISi+UA4wXON7pv1Ssck=; b=EZkdel9Wam2ErzeSCkDHrsO+zKtvHSAJoanTNYVIIjnvPnQ6NXUp5U81skBXs/AvD8 HW31fF+BhkIseZ5sv55hNR2aMyC1LU2K/YpXFijjc7Gp7I1OGxCY8LkXlrjl84HKcuGa jr8hsrvj1NrCPo+cl4/AiB2RTw+92Fnn58pjuKJ32tFd07B22ffY7RVUWxcLg7U0smfQ xrbBA+nEiM8nP8VD6i1m+0MruyfhPM4+JXpsIV5J3cfZgEkzjbhSZGRhtJ27RES1ax1L NEolqYQCi9anj+CIyh6A9r+fLnSV+rIFTAOdH4/WaEmFm0Rt48iQchwo0/OOGXmifd3E HbJQ== 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=1vG2OcOONhiCi516JQ58atnaISi+UA4wXON7pv1Ssck=; b=V7TZUHl9+Pv+TlD2CP+wMIkN24C2Y9WFOggCug0x8V5Vtwc27gPYWp2EptPKk5TjZw PTq36WAOV/yWhf4hjv0f/3p6HYtQTHl7Gkc6AVUYMe67NCbplSJyjC79DU0W9Uobub6B ZJnQ4XW1YSidchQgH0aA+RVjBpxfL1zjfm7ykA4vYBJWamdjZ5FMuAAihOVrOosVry0l wnnb47yvn+WHbKSMAJxO9e+nLzvkZKVNaUklSgDA2eVnYEd5HEp39GTcUZ0npuaR104j DDdCWdTWAfFPDusrvqNW/0dH78Rm82oO6nO4AdhGUsFp46iOzGL5qn0zZpYAxokT7ZL1 H86Q== X-Gm-Message-State: ANhLgQ1eCVNVcA7iWq1jYoT4V9dmXbufFWNwRoU+JjKYX4tObvKrdEs/ y/+MbG+bjavGAvvI0vINO3vV3g== X-Google-Smtp-Source: ADFU+vv+V0LEwPqsqDmjMEDUOsnGSejo4aiDD1EkEInzRLI0zP3qjWP2HsOoggDSgUzc2OZrGIvUrA== X-Received: by 2002:a17:90a:364d:: with SMTP id s71mr1814998pjb.185.1585006249314; Mon, 23 Mar 2020 16:30:49 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.154]) by smtp.gmail.com with ESMTPSA id x4sm12783546pgi.76.2020.03.23.16.30.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2020 16:30:48 -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 04:59:01 +0530 Message-Id: <20200323232901.29169-4-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200323232901.29169-1-kgupta@es.iitr.ac.in> References: <20200323232901.29169-1-kgupta@es.iitr.ac.in> Subject: [libcamera-devel] [PATCH 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: Mon, 23 Mar 2020 23:30:50 -0000 Replace default constructor StreamConfiguration() by it's parameterized counterpart by using StreamFormats in generateConfiguration() in ipu3. Signed-off-by: Kaaira Gupta --- src/libcamera/pipeline/ipu3/ipu3.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 7feb44c..fe25cab 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -400,9 +400,17 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera, }; config = new IPU3CameraConfiguration(camera, data); + std::map> pixelformats; + + /* + * The driver supports only one pixel format. + * Size range is kept maximum. + */ + pixelformats[PixelFormat(DRM_FORMAT_NV12)] = {SizeRange{{ 2560, 1920 }}}; for (const StreamRole role : roles) { - StreamConfiguration cfg = {}; + StreamFormats format(pixelformats); + StreamConfiguration cfg(format); IPU3Stream *stream = nullptr; cfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12);