Patch Detail
Show a patch.
GET /api/1.1/patches/3160/?format=api
{ "id": 3160, "url": "https://patchwork.libcamera.org/api/1.1/patches/3160/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3160/", "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": "<20200318033200.3042855-8-niklas.soderlund@ragnatech.se>", "date": "2020-03-18T03:31:59", "name": "[libcamera-devel,v3,7/8] libcamera: PixelFormat: Make constructor explicit", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "b30693ec60f0497cb4c7f2d73f283419a4a81046", "submitter": { "id": 5, "url": "https://patchwork.libcamera.org/api/1.1/people/5/?format=api", "name": "Niklas Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/3160/mbox/", "series": [ { "id": 730, "url": "https://patchwork.libcamera.org/api/1.1/series/730/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=730", "date": "2020-03-18T03:31:52", "name": "libcamera: PixelFormat: Turn into a class", "version": 3, "mbox": "https://patchwork.libcamera.org/series/730/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3160/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3160/checks/", "tags": {}, "headers": { "Return-Path": "<niklas.soderlund@ragnatech.se>", "Received": [ "from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B1F1C6298E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 Mar 2020 04:32:40 +0100 (CET)", "from bismarck.berto.se (p4fca2392.dip0.t-ipconnect.de\n\t[79.202.35.146]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid 1e2351f7-68c9-11ea-9f85-005056917a89;\n\tWed, 18 Mar 2020 04:32:39 +0100 (CET)" ], "X-Halon-ID": "1e2351f7-68c9-11ea-9f85-005056917a89", "Authorized-sender": "niklas@soderlund.pp.se", "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 18 Mar 2020 04:31:59 +0100", "Message-Id": "<20200318033200.3042855-8-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20200318033200.3042855-1-niklas.soderlund@ragnatech.se>", "References": "<20200318033200.3042855-1-niklas.soderlund@ragnatech.se>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 7/8] libcamera: PixelFormat: Make\n\tconstructor explicit", "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": "Wed, 18 Mar 2020 03:32:41 -0000" }, "content": "From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nTo achieve the goal of preventing unwanted conversion between a DRM and\na V4L2 FourCC, make the PixelFormat constructor that takes an integer\nvalue explicit. All users of pixel formats flagged by the compiler\nare fixed.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n* Changes since v2\n- Moved compare operations to where PixelFormat class is added.\n---\n include/libcamera/pixelformats.h | 2 +-\n src/gstreamer/gstlibcamera-utils.cpp | 4 ++--\n src/libcamera/pipeline/ipu3/ipu3.cpp | 6 ++---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 18 +++++++--------\n src/libcamera/pipeline/vimc.cpp | 10 ++++-----\n src/libcamera/v4l2_videodevice.cpp | 26 +++++++++++-----------\n src/v4l2/v4l2_camera_proxy.cpp | 28 ++++++++++++------------\n test/stream/stream_formats.cpp | 24 ++++++++++----------\n test/v4l2_videodevice/buffer_cache.cpp | 2 +-\n 9 files changed, 60 insertions(+), 60 deletions(-)", "diff": "diff --git a/include/libcamera/pixelformats.h b/include/libcamera/pixelformats.h\nindex eb40e55ac159505a..9ce6f7f082d259f8 100644\n--- a/include/libcamera/pixelformats.h\n+++ b/include/libcamera/pixelformats.h\n@@ -19,7 +19,7 @@ class PixelFormat\n {\n public:\n \tPixelFormat();\n-\tPixelFormat(uint32_t fourcc, const std::set<uint64_t> &modifiers = {});\n+\texplicit PixelFormat(uint32_t fourcc, const std::set<uint64_t> &modifiers = {});\n \n \tbool operator==(const PixelFormat &other) const;\n \tbool operator!=(const PixelFormat &other) const { return !(*this == other); }\ndiff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp\nindex f21e94c3eef92737..c13b0ca245386168 100644\n--- a/src/gstreamer/gstlibcamera-utils.cpp\n+++ b/src/gstreamer/gstlibcamera-utils.cpp\n@@ -154,9 +154,9 @@ gst_libcamera_configure_stream_from_caps(StreamConfiguration &stream_cfg,\n \tif (gst_structure_has_name(s, \"video/x-raw\")) {\n \t\tconst gchar *format = gst_structure_get_string(s, \"format\");\n \t\tgst_format = gst_video_format_from_string(format);\n-\t\tstream_cfg.pixelFormat = gst_format_to_drm(gst_format);\n+\t\tstream_cfg.pixelFormat = PixelFormat(gst_format_to_drm(gst_format));\n \t} else if (gst_structure_has_name(s, \"image/jpeg\")) {\n-\t\tstream_cfg.pixelFormat = DRM_FORMAT_MJPEG;\n+\t\tstream_cfg.pixelFormat = PixelFormat(DRM_FORMAT_MJPEG);\n \t} else {\n \t\tg_critical(\"Unsupported media type: %s\", gst_structure_get_name(s));\n \t}\ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 1e3d8a107c6475be..55ce8fa16af160d6 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -245,7 +245,7 @@ IPU3CameraConfiguration::IPU3CameraConfiguration(Camera *camera,\n void IPU3CameraConfiguration::adjustStream(StreamConfiguration &cfg, bool scale)\n {\n \t/* The only pixel format the driver supports is NV12. */\n-\tcfg.pixelFormat = DRM_FORMAT_NV12;\n+\tcfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12);\n \n \tif (scale) {\n \t\t/*\n@@ -400,7 +400,7 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n \t\tStreamConfiguration cfg = {};\n \t\tIPU3Stream *stream = nullptr;\n \n-\t\tcfg.pixelFormat = DRM_FORMAT_NV12;\n+\t\tcfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12);\n \n \t\tswitch (role) {\n \t\tcase StreamRole::StillCapture:\n@@ -1078,7 +1078,7 @@ int ImgUDevice::configureOutput(ImgUOutput *output,\n \t\treturn 0;\n \n \tV4L2DeviceFormat outputFormat = {};\n-\toutputFormat.fourcc = dev->toV4L2Fourcc(DRM_FORMAT_NV12);\n+\toutputFormat.fourcc = dev->toV4L2Fourcc(PixelFormat(DRM_FORMAT_NV12));\n \toutputFormat.size = cfg.size;\n \toutputFormat.planesCount = 2;\n \ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 8a11deb814bc0bfb..80bd2185bfd7e827 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -431,13 +431,13 @@ RkISP1CameraConfiguration::RkISP1CameraConfiguration(Camera *camera,\n CameraConfiguration::Status RkISP1CameraConfiguration::validate()\n {\n \tstatic const std::array<PixelFormat, 8> formats{\n-\t\tDRM_FORMAT_YUYV,\n-\t\tDRM_FORMAT_YVYU,\n-\t\tDRM_FORMAT_VYUY,\n-\t\tDRM_FORMAT_NV16,\n-\t\tDRM_FORMAT_NV61,\n-\t\tDRM_FORMAT_NV21,\n-\t\tDRM_FORMAT_NV12,\n+\t\tPixelFormat(DRM_FORMAT_YUYV),\n+\t\tPixelFormat(DRM_FORMAT_YVYU),\n+\t\tPixelFormat(DRM_FORMAT_VYUY),\n+\t\tPixelFormat(DRM_FORMAT_NV16),\n+\t\tPixelFormat(DRM_FORMAT_NV61),\n+\t\tPixelFormat(DRM_FORMAT_NV21),\n+\t\tPixelFormat(DRM_FORMAT_NV12),\n \t\t/* \\todo Add support for 8-bit greyscale to DRM formats */\n \t};\n \n@@ -459,7 +459,7 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()\n \tif (std::find(formats.begin(), formats.end(), cfg.pixelFormat) ==\n \t formats.end()) {\n \t\tLOG(RkISP1, Debug) << \"Adjusting format to NV12\";\n-\t\tcfg.pixelFormat = DRM_FORMAT_NV12,\n+\t\tcfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12),\n \t\tstatus = Adjusted;\n \t}\n \n@@ -538,7 +538,7 @@ CameraConfiguration *PipelineHandlerRkISP1::generateConfiguration(Camera *camera\n \t\treturn config;\n \n \tStreamConfiguration cfg{};\n-\tcfg.pixelFormat = DRM_FORMAT_NV12;\n+\tcfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12);\n \tcfg.size = data->sensor_->resolution();\n \n \tconfig->addConfiguration(cfg);\ndiff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\nindex 2e2162b2bf4477c5..fa84f0c1b20d3182 100644\n--- a/src/libcamera/pipeline/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc.cpp\n@@ -104,9 +104,9 @@ private:\n namespace {\n \n static const std::array<PixelFormat, 3> pixelformats{\n-\tDRM_FORMAT_RGB888,\n-\tDRM_FORMAT_BGR888,\n-\tDRM_FORMAT_BGRA8888,\n+\tPixelFormat(DRM_FORMAT_RGB888),\n+\tPixelFormat(DRM_FORMAT_BGR888),\n+\tPixelFormat(DRM_FORMAT_BGRA8888),\n };\n \n } /* namespace */\n@@ -135,7 +135,7 @@ CameraConfiguration::Status VimcCameraConfiguration::validate()\n \tif (std::find(pixelformats.begin(), pixelformats.end(), cfg.pixelFormat) ==\n \t pixelformats.end()) {\n \t\tLOG(VIMC, Debug) << \"Adjusting format to RGB24\";\n-\t\tcfg.pixelFormat = DRM_FORMAT_BGR888;\n+\t\tcfg.pixelFormat = PixelFormat(DRM_FORMAT_BGR888);\n \t\tstatus = Adjusted;\n \t}\n \n@@ -184,7 +184,7 @@ CameraConfiguration *PipelineHandlerVimc::generateConfiguration(Camera *camera,\n \n \tStreamConfiguration cfg(formats);\n \n-\tcfg.pixelFormat = DRM_FORMAT_BGR888;\n+\tcfg.pixelFormat = PixelFormat(DRM_FORMAT_BGR888);\n \tcfg.size = { 1920, 1080 };\n \tcfg.bufferCount = 4;\n \ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex c8ba0f8cebedb91a..3d2747274dc4c020 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -1567,39 +1567,39 @@ PixelFormat V4L2VideoDevice::toPixelFormat(uint32_t v4l2Fourcc)\n \tswitch (v4l2Fourcc) {\n \t/* RGB formats. */\n \tcase V4L2_PIX_FMT_RGB24:\n-\t\treturn DRM_FORMAT_BGR888;\n+\t\treturn PixelFormat(DRM_FORMAT_BGR888);\n \tcase V4L2_PIX_FMT_BGR24:\n-\t\treturn DRM_FORMAT_RGB888;\n+\t\treturn PixelFormat(DRM_FORMAT_RGB888);\n \tcase V4L2_PIX_FMT_ARGB32:\n-\t\treturn DRM_FORMAT_BGRA8888;\n+\t\treturn PixelFormat(DRM_FORMAT_BGRA8888);\n \n \t/* YUV packed formats. */\n \tcase V4L2_PIX_FMT_YUYV:\n-\t\treturn DRM_FORMAT_YUYV;\n+\t\treturn PixelFormat(DRM_FORMAT_YUYV);\n \tcase V4L2_PIX_FMT_YVYU:\n-\t\treturn DRM_FORMAT_YVYU;\n+\t\treturn PixelFormat(DRM_FORMAT_YVYU);\n \tcase V4L2_PIX_FMT_UYVY:\n-\t\treturn DRM_FORMAT_UYVY;\n+\t\treturn PixelFormat(DRM_FORMAT_UYVY);\n \tcase V4L2_PIX_FMT_VYUY:\n-\t\treturn DRM_FORMAT_VYUY;\n+\t\treturn PixelFormat(DRM_FORMAT_VYUY);\n \n \t/* YUY planar formats. */\n \tcase V4L2_PIX_FMT_NV16:\n \tcase V4L2_PIX_FMT_NV16M:\n-\t\treturn DRM_FORMAT_NV16;\n+\t\treturn PixelFormat(DRM_FORMAT_NV16);\n \tcase V4L2_PIX_FMT_NV61:\n \tcase V4L2_PIX_FMT_NV61M:\n-\t\treturn DRM_FORMAT_NV61;\n+\t\treturn PixelFormat(DRM_FORMAT_NV61);\n \tcase V4L2_PIX_FMT_NV12:\n \tcase V4L2_PIX_FMT_NV12M:\n-\t\treturn DRM_FORMAT_NV12;\n+\t\treturn PixelFormat(DRM_FORMAT_NV12);\n \tcase V4L2_PIX_FMT_NV21:\n \tcase V4L2_PIX_FMT_NV21M:\n-\t\treturn DRM_FORMAT_NV21;\n+\t\treturn PixelFormat(DRM_FORMAT_NV21);\n \n \t/* Compressed formats. */\n \tcase V4L2_PIX_FMT_MJPEG:\n-\t\treturn DRM_FORMAT_MJPEG;\n+\t\treturn PixelFormat(DRM_FORMAT_MJPEG);\n \n \t/* V4L2 formats not yet supported by DRM. */\n \tcase V4L2_PIX_FMT_GREY:\n@@ -1612,7 +1612,7 @@ PixelFormat V4L2VideoDevice::toPixelFormat(uint32_t v4l2Fourcc)\n \t\t\t\tLogError).stream()\n \t\t\t<< \"Unsupported V4L2 pixel format \"\n \t\t\t<< utils::hex(v4l2Fourcc);\n-\t\treturn 0;\n+\t\treturn PixelFormat();\n \t}\n }\n \ndiff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex c6d1e5030b58b630..547ae2dd6606dec9 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -535,21 +535,21 @@ namespace {\n \n static const std::array<PixelFormatInfo, 13> pixelFormatInfo = {{\n \t/* RGB formats. */\n-\t{ DRM_FORMAT_RGB888,\tV4L2_PIX_FMT_BGR24,\t1, {{ { 24, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} },\n-\t{ DRM_FORMAT_BGR888,\tV4L2_PIX_FMT_RGB24,\t1, {{ { 24, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} },\n-\t{ DRM_FORMAT_BGRA8888,\tV4L2_PIX_FMT_ARGB32,\t1, {{ { 32, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} },\n+\t{ PixelFormat(DRM_FORMAT_RGB888),\tV4L2_PIX_FMT_BGR24,\t1, {{ { 24, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} },\n+\t{ PixelFormat(DRM_FORMAT_BGR888),\tV4L2_PIX_FMT_RGB24,\t1, {{ { 24, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} },\n+\t{ PixelFormat(DRM_FORMAT_BGRA8888),\tV4L2_PIX_FMT_ARGB32,\t1, {{ { 32, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} },\n \t/* YUV packed formats. */\n-\t{ DRM_FORMAT_UYVY,\tV4L2_PIX_FMT_UYVY,\t1, {{ { 16, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} },\n-\t{ DRM_FORMAT_VYUY,\tV4L2_PIX_FMT_VYUY,\t1, {{ { 16, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} },\n-\t{ DRM_FORMAT_YUYV,\tV4L2_PIX_FMT_YUYV,\t1, {{ { 16, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} },\n-\t{ DRM_FORMAT_YVYU,\tV4L2_PIX_FMT_YVYU,\t1, {{ { 16, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} },\n+\t{ PixelFormat(DRM_FORMAT_UYVY),\t\tV4L2_PIX_FMT_UYVY,\t1, {{ { 16, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} },\n+\t{ PixelFormat(DRM_FORMAT_VYUY),\t\tV4L2_PIX_FMT_VYUY,\t1, {{ { 16, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} },\n+\t{ PixelFormat(DRM_FORMAT_YUYV),\t\tV4L2_PIX_FMT_YUYV,\t1, {{ { 16, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} },\n+\t{ PixelFormat(DRM_FORMAT_YVYU),\t\tV4L2_PIX_FMT_YVYU,\t1, {{ { 16, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} },\n \t/* YUY planar formats. */\n-\t{ DRM_FORMAT_NV12,\tV4L2_PIX_FMT_NV12,\t2, {{ { 8, 1, 1 }, { 16, 2, 2 }, { 0, 0, 0 } }} },\n-\t{ DRM_FORMAT_NV21,\tV4L2_PIX_FMT_NV21,\t2, {{ { 8, 1, 1 }, { 16, 2, 2 }, { 0, 0, 0 } }} },\n-\t{ DRM_FORMAT_NV16,\tV4L2_PIX_FMT_NV16,\t2, {{ { 8, 1, 1 }, { 16, 2, 1 }, { 0, 0, 0 } }} },\n-\t{ DRM_FORMAT_NV61,\tV4L2_PIX_FMT_NV61,\t2, {{ { 8, 1, 1 }, { 16, 2, 1 }, { 0, 0, 0 } }} },\n-\t{ DRM_FORMAT_NV24,\tV4L2_PIX_FMT_NV24,\t2, {{ { 8, 1, 1 }, { 16, 2, 1 }, { 0, 0, 0 } }} },\n-\t{ DRM_FORMAT_NV42,\tV4L2_PIX_FMT_NV42,\t2, {{ { 8, 1, 1 }, { 16, 1, 1 }, { 0, 0, 0 } }} },\n+\t{ PixelFormat(DRM_FORMAT_NV12),\t\tV4L2_PIX_FMT_NV12,\t2, {{ { 8, 1, 1 }, { 16, 2, 2 }, { 0, 0, 0 } }} },\n+\t{ PixelFormat(DRM_FORMAT_NV21),\t\tV4L2_PIX_FMT_NV21,\t2, {{ { 8, 1, 1 }, { 16, 2, 2 }, { 0, 0, 0 } }} },\n+\t{ PixelFormat(DRM_FORMAT_NV16),\t\tV4L2_PIX_FMT_NV16,\t2, {{ { 8, 1, 1 }, { 16, 2, 1 }, { 0, 0, 0 } }} },\n+\t{ PixelFormat(DRM_FORMAT_NV61),\t\tV4L2_PIX_FMT_NV61,\t2, {{ { 8, 1, 1 }, { 16, 2, 1 }, { 0, 0, 0 } }} },\n+\t{ PixelFormat(DRM_FORMAT_NV24),\t\tV4L2_PIX_FMT_NV24,\t2, {{ { 8, 1, 1 }, { 16, 2, 1 }, { 0, 0, 0 } }} },\n+\t{ PixelFormat(DRM_FORMAT_NV42),\t\tV4L2_PIX_FMT_NV42,\t2, {{ { 8, 1, 1 }, { 16, 1, 1 }, { 0, 0, 0 } }} },\n }};\n \n } /* namespace */\n@@ -593,7 +593,7 @@ PixelFormat V4L2CameraProxy::v4l2ToDrm(uint32_t format)\n \t\t\t\t\t return info.v4l2Format == format;\n \t\t\t\t });\n \tif (info == pixelFormatInfo.end())\n-\t\treturn format;\n+\t\treturn PixelFormat();\n \n \treturn info->format;\n }\ndiff --git a/test/stream/stream_formats.cpp b/test/stream/stream_formats.cpp\nindex a391f5cd087d3872..92f1574b8a0b315c 100644\n--- a/test/stream/stream_formats.cpp\n+++ b/test/stream/stream_formats.cpp\n@@ -55,40 +55,40 @@ protected:\n \t{\n \t\t/* Test discrete sizes */\n \t\tStreamFormats discrete({\n-\t\t\t{ 1, { SizeRange(100, 100), SizeRange(200, 200) } },\n-\t\t\t{ 2, { SizeRange(300, 300), SizeRange(400, 400) } },\n+\t\t\t{ PixelFormat(1), { SizeRange(100, 100), SizeRange(200, 200) } },\n+\t\t\t{ PixelFormat(2), { SizeRange(300, 300), SizeRange(400, 400) } },\n \t\t});\n \n-\t\tif (testSizes(\"discrete 1\", discrete.sizes(1),\n+\t\tif (testSizes(\"discrete 1\", discrete.sizes(PixelFormat(1)),\n \t\t\t { Size(100, 100), Size(200, 200) }))\n \t\t\treturn TestFail;\n-\t\tif (testSizes(\"discrete 2\", discrete.sizes(2),\n+\t\tif (testSizes(\"discrete 2\", discrete.sizes(PixelFormat(2)),\n \t\t\t { Size(300, 300), Size(400, 400) }))\n \t\t\treturn TestFail;\n \n \t\t/* Test range sizes */\n \t\tStreamFormats range({\n-\t\t\t{ 1, { SizeRange(640, 480, 640, 480) } },\n-\t\t\t{ 2, { SizeRange(640, 480, 800, 600, 8, 8) } },\n-\t\t\t{ 3, { SizeRange(640, 480, 800, 600, 16, 16) } },\n-\t\t\t{ 4, { SizeRange(128, 128, 4096, 4096, 128, 128) } },\n+\t\t\t{ PixelFormat(1), { SizeRange(640, 480, 640, 480) } },\n+\t\t\t{ PixelFormat(2), { SizeRange(640, 480, 800, 600, 8, 8) } },\n+\t\t\t{ PixelFormat(3), { SizeRange(640, 480, 800, 600, 16, 16) } },\n+\t\t\t{ PixelFormat(4), { SizeRange(128, 128, 4096, 4096, 128, 128) } },\n \t\t});\n \n-\t\tif (testSizes(\"range 1\", range.sizes(1), { Size(640, 480) }))\n+\t\tif (testSizes(\"range 1\", range.sizes(PixelFormat(1)), { Size(640, 480) }))\n \t\t\treturn TestFail;\n \n-\t\tif (testSizes(\"range 2\", range.sizes(2), {\n+\t\tif (testSizes(\"range 2\", range.sizes(PixelFormat(2)), {\n \t\t\t Size(640, 480), Size(720, 480),\n \t\t\t Size(720, 576), Size(768, 480),\n \t\t\t Size(800, 600) }))\n \t\t\treturn TestFail;\n \n-\t\tif (testSizes(\"range 3\", range.sizes(3), {\n+\t\tif (testSizes(\"range 3\", range.sizes(PixelFormat(3)), {\n \t\t\t Size(640, 480), Size(720, 480),\n \t\t\t Size(720, 576), Size(768, 480) }))\n \t\t\treturn TestFail;\n \n-\t\tif (testSizes(\"range 4\", range.sizes(4), {\n+\t\tif (testSizes(\"range 4\", range.sizes(PixelFormat(4)), {\n \t\t\t Size(1024, 768), Size(1280, 1024),\n \t\t\t Size(2048, 1152), Size(2048, 1536),\n \t\t\t Size(2560, 2048), Size(3200, 2048), }))\ndiff --git a/test/v4l2_videodevice/buffer_cache.cpp b/test/v4l2_videodevice/buffer_cache.cpp\nindex e6edd2fad7aa3d33..d730e7550377430e 100644\n--- a/test/v4l2_videodevice/buffer_cache.cpp\n+++ b/test/v4l2_videodevice/buffer_cache.cpp\n@@ -142,7 +142,7 @@ public:\n \t\tconst unsigned int numBuffers = 8;\n \n \t\tStreamConfiguration cfg;\n-\t\tcfg.pixelFormat = DRM_FORMAT_YUYV;\n+\t\tcfg.pixelFormat = PixelFormat(DRM_FORMAT_YUYV);\n \t\tcfg.size = Size(600, 800);\n \t\tcfg.bufferCount = numBuffers;\n \n", "prefixes": [ "libcamera-devel", "v3", "7/8" ] }