Patch Detail
Show a patch.
GET /api/patches/11468/?format=api
{ "id": 11468, "url": "https://patchwork.libcamera.org/api/patches/11468/?format=api", "web_url": "https://patchwork.libcamera.org/patch/11468/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20210302194948.20396-1-laurent.pinchart@ideasonboard.com>", "date": "2021-03-02T19:49:48", "name": "[libcamera-devel,v2] libcamera: camera_sensor: Use active area size as resolution", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "1f9263539b8e095fc270d8976d213f68f6e57180", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/11468/mbox/", "series": [ { "id": 1745, "url": "https://patchwork.libcamera.org/api/series/1745/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1745", "date": "2021-03-02T19:49:48", "name": "[libcamera-devel,v2] libcamera: camera_sensor: Use active area size as resolution", "version": 2, "mbox": "https://patchwork.libcamera.org/series/1745/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/11468/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/11468/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 4C656BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 2 Mar 2021 19:50:23 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CF61768A98;\n\tTue, 2 Mar 2021 20:50:22 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4A19260106\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 2 Mar 2021 20:50:21 +0100 (CET)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A1CC745D;\n\tTue, 2 Mar 2021 20:50:20 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Z21T0qFH\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1614714620;\n\tbh=LC/3XUM84SBeHWL+CsAv50A8K6JMvnEhZAxL07sBKNY=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=Z21T0qFHfiyXcNES35b9FeuwHRvVYt4Ba6ou7BfLS4L3MbDY/huaZM4NWN9Pz8MvI\n\tpaJH0AoaUySdsbiwU+k35nNDa/KQNO0XF0MoRHyAz8YycTDnerZWb6Zpy7/11i5Axr\n\tnuytE8VSBpGujh7naxSF8tUCouCUvQN8saXJjv90=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 2 Mar 2021 21:49:48 +0200", "Message-Id": "<20210302194948.20396-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.28.0", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v2] libcamera: camera_sensor: Use active\n\tarea size as resolution", "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>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "When a sensor can upscale the image, the native sensor resolution isn't\nequal to the largest size reported by the sensor. Use the active area\nsize instead, and default it to the largest enumerated size if the crop\nrectangle targets are not supported.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nChanges since v1:\n\n- Don't set default pixelArraySize_ to override it later\n\nNote how this causes the pixelArraySize_ = sizes_.back() assignment to\nbe duplicated in CameraSensor::validateSensorDriver() and\nCameraSensor::initVimcDefaultProperties(). Jacopo, do you prefer v1 or\nv2 ?\n\n---\n include/libcamera/internal/camera_sensor.h | 3 +--\n src/libcamera/camera_sensor.cpp | 23 +++++++++++-----------\n 2 files changed, 13 insertions(+), 13 deletions(-)", "diff": "diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex f22ffbfe9f97..71d012f795fe 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -53,7 +53,7 @@ public:\n \tconst MediaEntity *entity() const { return entity_; }\n \tconst std::vector<unsigned int> &mbusCodes() const { return mbusCodes_; }\n \tconst std::vector<Size> &sizes() const { return sizes_; }\n-\tconst Size &resolution() const { return resolution_; }\n+\tSize resolution() const { return activeArea_.size(); }\n \n \tV4L2SubdeviceFormat getFormat(const std::vector<unsigned int> &mbusCodes,\n \t\t\t\t const Size &size) const;\n@@ -87,7 +87,6 @@ private:\n \tstd::string id_;\n \n \tV4L2Subdevice::Formats formats_;\n-\tSize resolution_;\n \tstd::vector<unsigned int> mbusCodes_;\n \tstd::vector<Size> sizes_;\n \ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 8a1b9bd277df..8db6e8974a8d 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -233,12 +233,6 @@ int CameraSensor::init()\n \tauto last = std::unique(sizes_.begin(), sizes_.end());\n \tsizes_.erase(last, sizes_.end());\n \n-\t/*\n-\t * The sizes_ vector is sorted in ascending order, the resolution is\n-\t * thus the last element of the vector.\n-\t */\n-\tresolution_ = sizes_.back();\n-\n \t/*\n \t * VIMC is a bit special, as it does not yet support all the mandatory\n \t * requirements regular sensors have to respect.\n@@ -324,14 +318,20 @@ int CameraSensor::validateSensorDriver()\n \tRectangle rect;\n \tint ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_BOUNDS, &rect);\n \tif (ret) {\n-\t\trect = Rectangle(resolution());\n+\t\t/*\n+\t\t * Default the pixel array size to the largest size supported\n+\t\t * by the sensor. The sizes_ vector is sorted in ascending\n+\t\t * order, the largest size is thus the last element.\n+\t\t */\n+\t\tpixelArraySize_ = sizes_.back();\n+\n \t\tLOG(CameraSensor, Warning)\n \t\t\t<< \"The PixelArraySize property has been defaulted to \"\n-\t\t\t<< rect.toString();\n+\t\t\t<< pixelArraySize_.toString();\n \t\terr = -EINVAL;\n+\t} else {\n+\t\tpixelArraySize_ = rect.size();\n \t}\n-\tpixelArraySize_.width = rect.width;\n-\tpixelArraySize_.height = rect.height;\n \n \tret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_DEFAULT, &activeArea_);\n \tif (ret) {\n@@ -397,7 +397,8 @@ int CameraSensor::validateSensorDriver()\n */\n void CameraSensor::initVimcDefaultProperties()\n {\n-\tpixelArraySize_ = resolution();\n+\t/* Use the largest supported size. */\n+\tpixelArraySize_ = sizes_.back();\n \tactiveArea_ = Rectangle(pixelArraySize_);\n }\n \n", "prefixes": [ "libcamera-devel", "v2" ] }