Patch Detail
Show a patch.
GET /api/1.1/patches/10685/?format=api
{ "id": 10685, "url": "https://patchwork.libcamera.org/api/1.1/patches/10685/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10685/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20201218164754.81422-5-jacopo@jmondi.org>", "date": "2020-12-18T16:47:49", "name": "[libcamera-devel,v2,4/9] libcamera: camera_sensor: Register ColorFilterArrangement", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "c7b72a4503882a854829e36a1406f288fa6f3b78", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": { "id": 15, "url": "https://patchwork.libcamera.org/api/1.1/users/15/?format=api", "username": "jmondi", "first_name": "Jacopo", "last_name": "Mondi", "email": "jacopo@jmondi.org" }, "mbox": "https://patchwork.libcamera.org/patch/10685/mbox/", "series": [ { "id": 1538, "url": "https://patchwork.libcamera.org/api/1.1/series/1538/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1538", "date": "2020-12-18T16:47:45", "name": "libcamera: Introduce sensor database", "version": 2, "mbox": "https://patchwork.libcamera.org/series/1538/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10685/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10685/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 B060BC0F1A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 18 Dec 2020 16:47:56 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8BFE361FF6;\n\tFri, 18 Dec 2020 17:47:56 +0100 (CET)", "from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[217.70.183.200])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F3E5061596\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Dec 2020 17:47:50 +0100 (CET)", "from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay7-d.mail.gandi.net (Postfix) with ESMTPSA id C180A20009\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 18 Dec 2020 16:47:50 +0000 (UTC)" ], "X-Originating-IP": "93.34.118.233", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 18 Dec 2020 17:47:49 +0100", "Message-Id": "<20201218164754.81422-5-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.29.2", "In-Reply-To": "<20201218164754.81422-1-jacopo@jmondi.org>", "References": "<20201218164754.81422-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v2 4/9] libcamera: camera_sensor: Register\n\tColorFilterArrangement", "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": "Inspect the list of media bus codes supported by the camera sensor\nin order to deduce the color filter arrangement and register the\nColorFilterArrangement draft property.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/camera_sensor.cpp | 36 +++++++++++++++++++++++++++++----\n 1 file changed, 32 insertions(+), 4 deletions(-)", "diff": "diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 1628ba9c892b..2b78eb4cb530 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -17,6 +17,7 @@\n \n #include <libcamera/property_ids.h>\n \n+#include \"libcamera/internal/bayer_format.h\"\n #include \"libcamera/internal/formats.h\"\n #include \"libcamera/internal/sysfs.h\"\n #include \"libcamera/internal/utils.h\"\n@@ -178,10 +179,6 @@ int CameraSensor::init()\n \tif (ret < 0)\n \t\treturn ret;\n \n-\tret = initProperties();\n-\tif (ret)\n-\t\treturn ret;\n-\n \t/* Enumerate, sort and cache media bus codes and sizes. */\n \tformats_ = subdev_->formats(pad_);\n \tif (formats_.empty()) {\n@@ -210,6 +207,10 @@ int CameraSensor::init()\n \t */\n \tresolution_ = sizes_.back();\n \n+\tret = initProperties();\n+\tif (ret)\n+\t\treturn ret;\n+\n \treturn 0;\n }\n \n@@ -307,6 +308,33 @@ int CameraSensor::initProperties()\n \t\tproperties_.set(properties::PixelArrayActiveAreas, { crop });\n \t}\n \n+\t/* Color filter arrangement, default to the generic 'RGB' */\n+\tint32_t cfa = properties::draft::RGB;\n+\tfor (const auto &format : formats_) {\n+\t\tunsigned int mbusCode = format.first;\n+\t\tBayerFormat bayerFormat(mbusCode);\n+\t\tif (!bayerFormat.isValid())\n+\t\t\tcontinue;\n+\n+\t\t/* Report the CFA ordering of the first valid RAW Bayer format. */\n+\t\tswitch (bayerFormat.order) {\n+\t\tcase BayerFormat::BGGR:\n+\t\t\tcfa = properties::draft::BGGR;\n+\t\t\tbreak;\n+\t\tcase BayerFormat::GBRG:\n+\t\t\tcfa = properties::draft::GBRG;\n+\t\t\tbreak;\n+\t\tcase BayerFormat::GRBG:\n+\t\t\tcfa = properties::draft::GRBG;\n+\t\t\tbreak;\n+\t\tcase BayerFormat::RGGB:\n+\t\t\tcfa = properties::draft::RGGB;\n+\t\t\tbreak;\n+\t\t}\n+\t\tbreak;\n+\t}\n+\tproperties_.set(properties::draft::ColorFilterArrangement, cfa);\n+\n \treturn 0;\n }\n \n", "prefixes": [ "libcamera-devel", "v2", "4/9" ] }