Patch Detail
Show a patch.
GET /api/1.1/patches/3298/?format=api
{ "id": 3298, "url": "https://patchwork.libcamera.org/api/1.1/patches/3298/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3298/", "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": "<20200324131247.20771-1-laurent.pinchart@ideasonboard.com>", "date": "2020-03-24T13:12:47", "name": "[libcamera-devel] libcamera: pipeline: vimc: Use appropriate media bus format", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "7aceec78747c53fbae3259954a6556be8bd7d51e", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/3298/mbox/", "series": [ { "id": 769, "url": "https://patchwork.libcamera.org/api/1.1/series/769/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=769", "date": "2020-03-24T13:12:47", "name": "[libcamera-devel] libcamera: pipeline: vimc: Use appropriate media bus format", "version": 1, "mbox": "https://patchwork.libcamera.org/series/769/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3298/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3298/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6355E60411\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 Mar 2020 14:12:53 +0100 (CET)", "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B27E5308;\n\tTue, 24 Mar 2020 14:12:52 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1585055573;\n\tbh=6/zX250v0SOWwH+lqlDdbwCpNawG5u3CFA5js3peUVk=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=IKTDymPlyOE+1ESzWrUy0jsDzy//8p+L58ar8/VsnO16+3s5MoYGsech1w2AtjnFs\n\t/Vf0bsIOPVFkLxSWYSLl/qkcqoluZM+ru903WfGw4+F/pdjd46XEg/1e3VnVRWvwBP\n\tMg62eH9R5ZDS+fbpmCvL5hEfCIMEg4bIFnwTyIv8=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 24 Mar 2020 15:12:47 +0200", "Message-Id": "<20200324131247.20771-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.24.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] libcamera: pipeline: vimc: Use\n\tappropriate media bus format", "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": "Tue, 24 Mar 2020 13:12:53 -0000" }, "content": "Pick the correct media bus format based on the video pixel format on the\ncapture node.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/vimc.cpp | 19 +++++++++----------\n 1 file changed, 9 insertions(+), 10 deletions(-)\n\nThis patch, while being correct (I think :-)), shouldn't be integrated,\nas it breaks VIMC camera support with Qt < 5.14.0. On 5.14.0, the\nviewfinder reports the following supported native formats (in that\norder):\n\n- DRM_FORMAT_ABGR8888\n- DRM_FORMAT_ARGB8888\n- DRM_FORMAT_BGR888\n- DRM_FORMAT_RGB888\n\nThe first two formats are not supported by the VIMC pipeline handler,\nthe last two are. The third format, DRM_FORMAT_BGR888, is thus picked,\nwhich corresponds to MEDIA_BUS_FMT_RGB888_1X24, the default today.\n\nOn Qt < 5.14.0, the third format isn't supported, so the fourth format,\nDRM_FORMAT_RGB888, will be picked. This results in a different pipeline\nconfiguration, with the debayering subdev source pad being configured\nwith MEDIA_BUS_FMT_BGR888_1X24. The kernel driver is meant to support\nthat, but in drivers/media/platform/vimc/vimc-debayer.c the\nvimc_deb_set_fmt() function handles the source pad format with\n\n\t/*\n\t * Do not change the format of the source pad,\n\t * it is propagated from the sink\n\t */\n\tif (VIMC_IS_SRC(fmt->pad)) {\n\t\tfmt->format = *sink_fmt;\n\t\t/* TODO: Add support for other formats */\n\t\tfmt->format.code = vdeb->src_code;\n\t}\n\nThis needs to be fixed on the kernel side.", "diff": "diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\nindex b04a9726efa5..ace58381fe92 100644\n--- a/src/libcamera/pipeline/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc.cpp\n@@ -6,8 +6,8 @@\n */\n \n #include <algorithm>\n-#include <array>\n #include <iomanip>\n+#include <map>\n #include <tuple>\n \n #include <linux/media-bus-format.h>\n@@ -103,10 +103,10 @@ private:\n \n namespace {\n \n-static const std::array<PixelFormat, 3> pixelformats{\n-\tPixelFormat(DRM_FORMAT_RGB888),\n-\tPixelFormat(DRM_FORMAT_BGR888),\n-\tPixelFormat(DRM_FORMAT_BGRA8888),\n+static const std::map<PixelFormat, uint32_t> pixelformats{\n+\t{ PixelFormat(DRM_FORMAT_RGB888), MEDIA_BUS_FMT_BGR888_1X24 },\n+\t{ PixelFormat(DRM_FORMAT_BGR888), MEDIA_BUS_FMT_RGB888_1X24 },\n+\t{ PixelFormat(DRM_FORMAT_BGRA8888), MEDIA_BUS_FMT_ARGB8888_1X32 },\n };\n \n } /* namespace */\n@@ -132,8 +132,7 @@ CameraConfiguration::Status VimcCameraConfiguration::validate()\n \tStreamConfiguration &cfg = config_[0];\n \n \t/* Adjust the pixel format. */\n-\tif (std::find(pixelformats.begin(), pixelformats.end(), cfg.pixelFormat) ==\n-\t pixelformats.end()) {\n+\tif (pixelformats.find(cfg.pixelFormat) == pixelformats.end()) {\n \t\tLOG(VIMC, Debug) << \"Adjusting format to RGB24\";\n \t\tcfg.pixelFormat = PixelFormat(DRM_FORMAT_BGR888);\n \t\tstatus = Adjusted;\n@@ -174,12 +173,12 @@ CameraConfiguration *PipelineHandlerVimc::generateConfiguration(Camera *camera,\n \n \tstd::map<PixelFormat, std::vector<SizeRange>> formats;\n \n-\tfor (PixelFormat pixelformat : pixelformats) {\n+\tfor (const auto &pixelformat : pixelformats) {\n \t\t/* The scaler hardcodes a x3 scale-up ratio. */\n \t\tstd::vector<SizeRange> sizes{\n \t\t\tSizeRange{ { 48, 48 }, { 4096, 2160 } }\n \t\t};\n-\t\tformats[pixelformat] = sizes;\n+\t\tformats[pixelformat.first] = sizes;\n \t}\n \n \tStreamConfiguration cfg(formats);\n@@ -214,7 +213,7 @@ int PipelineHandlerVimc::configure(Camera *camera, CameraConfiguration *config)\n \tif (ret)\n \t\treturn ret;\n \n-\tsubformat.mbus_code = MEDIA_BUS_FMT_RGB888_1X24;\n+\tsubformat.mbus_code = pixelformats.find(cfg.pixelFormat)->second;\n \tret = data->debayer_->setFormat(1, &subformat);\n \tif (ret)\n \t\treturn ret;\n", "prefixes": [ "libcamera-devel" ] }