[{"id":33674,"web_url":"https://patchwork.libcamera.org/comment/33674/","msgid":"<174251063991.2222410.7500950803669680754@ping.linuxembedded.co.uk>","date":"2025-03-20T22:43:59","subject":"Re: [PATCH v3 5/8] libcamera: simple: Consider raw output\n\tconfigurations","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Milan Zamazal (2025-03-05 19:26:12)\n> When generating simple pipeline configuration, raw output configurations\n> are generated but later filtered out.  Let's include processed and/or\n> raw output configurations depending on the requested stream roles.\n> \n> Raw and processed formats are handled separately.  The intention is that\n> in case both raw and processed formats are requested then the raw\n> formats should be left intact to the extent possible and not be\n> influenced by the processed formats (implying that raw parameters\n> compatible with the processed output requirements must be requested by\n> the application).\n> \n> Raw output configurations are marked by setting their colorSpace to\n> ColorSpace::Raw, which is the only place there suitable for the purpose.\n> \n> This is another preparatory patch without making raw outputs working.\n\nI've identified two interesting effects which I've bisected to this\npatch:\n\nFirst:\n\nWithout this patch on x13s:\n\n[libcamera] kbingham@charm:~/iob/libcamera/build/gcc$ cam -c1 --metadata -C10\n[1:44:39.464209549] [37696]  INFO IPAManager ipa_manager.cpp:137 libcamera is not installed. Adding '/home/kbingham/iob/libcamera/build/gcc/src/ipa' to the IPA search path\n[1:44:39.471858239] [37696]  INFO Camera camera_manager.cpp:327 libcamera v0.4.0+149-628e8c80\n[1:44:39.497573824] [37697]  WARN CameraSensor camera_sensor_legacy.cpp:616 'ov5675 24-0010': Rotation control not available, default to 0 degrees\n[1:44:39.502155101] [37697]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n[1:44:39.502180672] [37697]  WARN IPAProxy ipa_proxy.cpp:177 Configuration file 'ov5675.yaml' not found for IPA module 'simple', falling back to 'uncalibrated.yaml'\n[1:44:39.502468206] [37697]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n[1:44:39.512547578] [37697]  INFO Pipeline pipeline_handler.cpp:618 libcamera is not installed. Loading platform configuration file from '/home/kbingham/iob/libcamera/src/libcamera/pipeline/virtual/data/virtual.yaml'\nUsing camera /base/soc@0/cci@ac4c000/i2c-bus@1/camera@10 as cam0\n[1:44:39.514127115] [37696]  INFO Camera camera.cpp:1203 configuring streams: (0) 2584x1944-ABGR8888\n[1:44:39.520536247] [37697]  WARN CameraSensor camera_sensor_legacy.cpp:501 'ov5675 24-0010': No sensor delays found in static properties. Assuming unverified defaults.\n[1:44:39.520899922] [37697]  INFO IPASoft soft_simple.cpp:251 IPASoft: Exposure 4-2016, gain 1-15.9922 (0.149922)\ncam0: Capture 10 frames\n6279.664529 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 20093184\n\tSensorTimestamp = 6279664529000\n6279.697607 (30.23 fps) cam0-stream0 seq: 000001 bytesused: 20093184\n\tSensorTimestamp = 6279697607000\n6279.731336 (29.65 fps) cam0-stream0 seq: 000002 bytesused: 20093184\n\tSensorTimestamp = 6279731336000\n6279.831491 (9.98 fps) cam0-stream0 seq: 000003 bytesused: 20093184\n\tSensorTimestamp = 6279831491000\n6279.898368 (14.95 fps) cam0-stream0 seq: 000004 bytesused: 20093184\n\tSensorTimestamp = 6279898368000\n6279.965133 (14.98 fps) cam0-stream0 seq: 000005 bytesused: 20093184\n\tSensorTimestamp = 6279965133000\n6280.031911 (14.97 fps) cam0-stream0 seq: 000006 bytesused: 20093184\n\tSensorTimestamp = 6280031911000\n6280.098577 (15.00 fps) cam0-stream0 seq: 000007 bytesused: 20093184\n\tSensorTimestamp = 6280098577000\n6280.165320 (14.98 fps) cam0-stream0 seq: 000008 bytesused: 20093184\n\tSensorTimestamp = 6280165320000\n6280.232225 (14.95 fps) cam0-stream0 seq: 000009 bytesused: 20093184\n\tSensorTimestamp = 6280232225000\n\n(Note the 15 FPS), and pipewire/gstreamer/cheese are all 'streaming'...\n\n\nBut with this patch the rate jumps to a more reasonable 30 FPS seen by\nqcam and cam:\n\n[libcamera] kbingham@charm:~/iob/libcamera/build/gcc$ cam -c1 --metadata -C10\n[1:46:59.040578435] [38346]  INFO IPAManager ipa_manager.cpp:137 libcamera is not installed. Adding '/home/kbingham/iob/libcamera/build/gcc/src/ipa' to the IPA search path\n[1:46:59.048420757] [38346]  INFO Camera camera_manager.cpp:327 libcamera v0.4.0+150-d0e1caa0\n[1:46:59.074259713] [38347]  WARN CameraSensor camera_sensor_legacy.cpp:616 'ov5675 24-0010': Rotation control not available, default to 0 degrees\n[1:46:59.078796773] [38347]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n[1:46:59.078822605] [38347]  WARN IPAProxy ipa_proxy.cpp:177 Configuration file 'ov5675.yaml' not found for IPA module 'simple', falling back to 'uncalibrated.yaml'\n[1:46:59.079110243] [38347]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n[1:46:59.087987917] [38347]  INFO Pipeline pipeline_handler.cpp:618 libcamera is not installed. Loading platform configuration file from '/home/kbingham/iob/libcamera/src/libcamera/pipeline/virtual/data/virtual.yaml'\nUsing camera /base/soc@0/cci@ac4c000/i2c-bus@1/camera@10 as cam0\n[1:46:59.089522196] [38346]  INFO Camera camera.cpp:1203 configuring streams: (0) 1288x972-ABGR8888\n[1:46:59.096422962] [38347]  WARN CameraSensor camera_sensor_legacy.cpp:501 'ov5675 24-0010': No sensor delays found in static properties. Assuming unverified defaults.\n[1:46:59.096786533] [38347]  INFO IPASoft soft_simple.cpp:251 IPASoft: Exposure 4-2016, gain 1-15.9922 (0.149922)\ncam0: Capture 10 frames\n6419.234779 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 5007744\n\tSensorTimestamp = 6419234779000\n6419.268213 (29.91 fps) cam0-stream0 seq: 000001 bytesused: 5007744\n\tSensorTimestamp = 6419268213000\n6419.301359 (30.17 fps) cam0-stream0 seq: 000002 bytesused: 5007744\n\tSensorTimestamp = 6419301359000\n6419.334744 (29.95 fps) cam0-stream0 seq: 000003 bytesused: 5007744\n\tSensorTimestamp = 6419334744000\n6419.368129 (29.95 fps) cam0-stream0 seq: 000004 bytesused: 5007744\n\tSensorTimestamp = 6419368129000\n6419.401516 (29.95 fps) cam0-stream0 seq: 000005 bytesused: 5007744\n\tSensorTimestamp = 6419401516000\n6419.434902 (29.95 fps) cam0-stream0 seq: 000006 bytesused: 5007744\n\tSensorTimestamp = 6419434902000\n6419.468289 (29.95 fps) cam0-stream0 seq: 000007 bytesused: 5007744\n\tSensorTimestamp = 6419468289000\n6419.501673 (29.95 fps) cam0-stream0 seq: 000008 bytesused: 5007744\n\tSensorTimestamp = 6419501673000\n6419.535058 (29.95 fps) cam0-stream0 seq: 000009 bytesused: 5007744\n\tSensorTimestamp = 6419535058000\n\n\nBut alas I note that now gstreamer (and cheese, and pipewire) now fail:\n\n[libcamera] kbingham@charm:~/iob/libcamera/build/gcc$ gst-launch-1.0 libcamerasrc ! autovideosink\nSetting pipeline to PAUSED ...\n[1:46:09.897725501] [38325]  INFO IPAManager ipa_manager.cpp:137 libcamera is not installed. Adding '/home/kbingham/iob/libcamera/build/gcc/src/ipa' to the IPA search path\n[1:46:09.903176776] [38325]  INFO Camera camera_manager.cpp:327 libcamera v0.4.0+150-d0e1caa0\n[1:46:09.935374613] [38330]  WARN CameraSensor camera_sensor_legacy.cpp:616 'ov5675 24-0010': Rotation control not available, default to 0 degrees\n[1:46:09.941677813] [38330]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n[1:46:09.941734112] [38330]  WARN IPAProxy ipa_proxy.cpp:177 Configuration file 'ov5675.yaml' not found for IPA module 'simple', falling back to 'uncalibrated.yaml'\n[1:46:09.942172574] [38330]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n[1:46:09.949343846] [38330]  INFO Pipeline pipeline_handler.cpp:618 libcamera is not installed. Loading platform configuration file from '/home/kbingham/iob/libcamera/src/libcamera/pipeline/virtual/data/virtual.yaml'\nPipeline is live and does not need PREROLL ...\nPipeline is PREROLLED ...\nSetting pipeline to PLAYING ...\nNew clock: GstSystemClock\n[1:46:09.950895937] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n[1:46:09.950940309] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n[1:46:09.950962495] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n[1:46:09.950982129] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n[1:46:09.951001711] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n[1:46:09.951020564] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\nERROR: from element /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0: Internal data stream error.\nAdditional debug info:\n../../src/gstreamer/gstlibcamerasrc.cpp(662): gst_libcamera_src_task_enter (): /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0:\nstreaming stopped, reason not-negotiated (-4)\nExecution ended after 0:00:00.000438306\nSetting pipeline to NULL ...\nFreeing pipeline ...\n\nDebugging a little, at stream.ccp:215\n\ndiff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\nindex 978d72752b00..22f348c2df87 100644\n--- a/src/libcamera/stream.cpp\n+++ b/src/libcamera/stream.cpp\n@@ -213,6 +213,8 @@ std::vector<Size> StreamFormats::sizes(const PixelFormat &pixelformat) const\n        if (!discrete) {\n                if (ranges.size() != 1) {\n                        LOG(Stream, Error) << \"Range format is ambiguous\";\n+                       for (auto range: ranges)\n+                               LOG(Stream, Error) << range;\n                        return {};\n                }\n\nReports:\n\n[1:51:01.855863590] [40484] ERROR Stream stream.cpp:215 Range format is ambiguous\n[1:51:01.855901452] [40484] ERROR Stream stream.cpp:217 (4x2)-(1288x972)/(+4,+2)\n[1:51:01.855920305] [40484] ERROR Stream stream.cpp:217 (4x2)-(2584x1944)/(+4,+2)\n\nSo we're somehow setting up the stream capabilities incorrectly here\nwhich breaks things... (note that ranges.size is 2, not 1?)\n\nPerhaps we're incorrectly adding the raw stream sizes to the processed stream\nsizes ?\n\n--\nKieran\n\n\n> \n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> ---\n>  src/libcamera/pipeline/simple/simple.cpp | 72 ++++++++++++++++--------\n>  1 file changed, 49 insertions(+), 23 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> index 0c6e0f44..92b9608b 100644\n> --- a/src/libcamera/pipeline/simple/simple.cpp\n> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> @@ -25,6 +25,7 @@\n>  #include <libcamera/base/log.h>\n>  \n>  #include <libcamera/camera.h>\n> +#include <libcamera/color_space.h>\n>  #include <libcamera/control_ids.h>\n>  #include <libcamera/pixel_format.h>\n>  #include <libcamera/request.h>\n> @@ -389,6 +390,8 @@ private:\n>         const MediaPad *acquirePipeline(SimpleCameraData *data);\n>         void releasePipeline(SimpleCameraData *data);\n>  \n> +       void setUpFormatSizes(std::map<PixelFormat, std::vector<SizeRange>> formats);\n> +\n>         std::map<const MediaEntity *, EntityData> entities_;\n>  \n>         MediaDevice *converter_;\n> @@ -1191,15 +1194,56 @@ SimplePipelineHandler::generateConfiguration(Camera *camera, Span<const StreamRo\n>                         data->processedRequested_ = true;\n>                 }\n>  \n> -       /* Create the formats map. */\n> -       std::map<PixelFormat, std::vector<SizeRange>> formats;\n> +       /* Create the formats maps. */\n> +       std::map<PixelFormat, std::vector<SizeRange>> processedFormats;\n> +       std::map<PixelFormat, std::vector<SizeRange>> rawFormats;\n>  \n>         for (const SimpleCameraData::Configuration &cfg : data->configs_)\n> -               if (!cfg.raw)\n> -                       for (PixelFormat format : cfg.outputFormats)\n> -                               formats[format].push_back(cfg.outputSizes);\n> +               for (PixelFormat format : cfg.outputFormats)\n> +                       (cfg.raw ? rawFormats : processedFormats)[format].push_back(cfg.outputSizes);\n> +\n> +       if (data->processedRequested_ && processedFormats.empty()) {\n> +               LOG(SimplePipeline, Error)\n> +                       << \"Processed stream requsted but no corresponding output configuration found\";\n> +               return nullptr;\n> +       }\n> +       if (data->rawRequested_ && rawFormats.empty()) {\n> +               LOG(SimplePipeline, Error)\n> +                       << \"Raw stream requsted but no corresponding output configuration found\";\n> +               return nullptr;\n> +       }\n> +\n> +       setUpFormatSizes(processedFormats);\n> +       setUpFormatSizes(rawFormats);\n> +\n> +       /*\n> +        * Create the stream configurations. Take the first entry in the formats\n> +        * map as the default, for lack of a better option.\n> +        *\n> +        * \\todo Implement a better way to pick the default format\n> +        */\n> +       for (StreamRole role : roles) {\n> +               bool raw = (role == StreamRole::Raw);\n> +               auto formats = (raw ? rawFormats : processedFormats);\n> +               StreamConfiguration cfg{ StreamFormats{ formats } };\n> +               cfg.pixelFormat = formats.begin()->first;\n> +               cfg.size = formats.begin()->second[0].max;\n> +               if (raw)\n> +                       cfg.colorSpace = ColorSpace::Raw;\n> +\n> +               config->addConfiguration(cfg);\n> +       }\n> +\n> +       config->validate();\n> +\n> +       return config;\n> +}\n>  \n> +void SimplePipelineHandler::setUpFormatSizes(\n> +       std::map<PixelFormat, std::vector<SizeRange>> formats)\n> +{\n>         /* Sort the sizes and merge any consecutive overlapping ranges. */\n> +\n>         for (auto &[format, sizes] : formats) {\n>                 std::sort(sizes.begin(), sizes.end(),\n>                           [](SizeRange &a, SizeRange &b) {\n> @@ -1219,24 +1263,6 @@ SimplePipelineHandler::generateConfiguration(Camera *camera, Span<const StreamRo\n>  \n>                 sizes.erase(++cur, sizes.end());\n>         }\n> -\n> -       /*\n> -        * Create the stream configurations. Take the first entry in the formats\n> -        * map as the default, for lack of a better option.\n> -        *\n> -        * \\todo Implement a better way to pick the default format\n> -        */\n> -       for ([[maybe_unused]] StreamRole role : roles) {\n> -               StreamConfiguration cfg{ StreamFormats{ formats } };\n> -               cfg.pixelFormat = formats.begin()->first;\n> -               cfg.size = formats.begin()->second[0].max;\n> -\n> -               config->addConfiguration(cfg);\n> -       }\n> -\n> -       config->validate();\n> -\n> -       return config;\n>  }\n>  \n>  int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n> -- \n> 2.48.1\n>","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 BE437C3274\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 20 Mar 2025 22:44:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C7C2368950;\n\tThu, 20 Mar 2025 23:44:05 +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 8FA91617F5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 20 Mar 2025 23:44:03 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 812CA6EC;\n\tThu, 20 Mar 2025 23:42:19 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ULAi8TOS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1742510539;\n\tbh=WIIYdd4v3/at5Q5B6DpjFgP4eYEIqF6Vwae+wW3lZUo=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=ULAi8TOSuboVNy+sNQsnaGJQLANIfHvzeTGryPKL+FEQ2VugY3aOeOWJzuU2DRsVk\n\tZYL1gVWkk+ekj3tRxGvRD4wqf3TdI6dmDT4RWnDqP4PkkyV52Jks48ykB1L9zPiFWp\n\tRwLZ5TjwNAtLn3fUY34tM4KJsy34ubHrN+psD14o=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250305192617.18361-6-mzamazal@redhat.com>","References":"<20250305192617.18361-1-mzamazal@redhat.com>\n\t<20250305192617.18361-6-mzamazal@redhat.com>","Subject":"Re: [PATCH v3 5/8] libcamera: simple: Consider raw output\n\tconfigurations","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Milan Zamazal <mzamazal@redhat.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Date":"Thu, 20 Mar 2025 22:43:59 +0000","Message-ID":"<174251063991.2222410.7500950803669680754@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":33741,"web_url":"https://patchwork.libcamera.org/comment/33741/","msgid":"<df9758f6-46b9-4db1-97e5-79680db3ddc7@collabora.com>","date":"2025-03-26T22:54:41","subject":"Re: [PATCH v3 5/8] libcamera: simple: Consider raw output\n\tconfigurations","submitter":{"id":140,"url":"https://patchwork.libcamera.org/api/people/140/","name":"Robert Mader","email":"robert.mader@collabora.com"},"content":"I just tried the series on the Librem5 (in order to check if Camshark) \nand run into the same issue, starting with this commit:\n\n> purism-librem5:~/git/libcamera$ cam -c 1 -I\n> [0:12:04.495109800] [3837]  INFO Camera camera_manager.cpp:329 \n> libcamera v0.4.0+194-06e2de17\n> [0:12:04.611452658] [3838]  WARN IPASoft soft_simple.cpp:98 IPASoft: \n> Failed to create camera sensor helper for hi846\n> [0:12:04.622258198] [3838]  WARN CameraSensorProperties \n> camera_sensor_properties.cpp:463 No static properties available for \n> 's5k3l6xx'\n> [0:12:04.622611614] [3838]  WARN CameraSensorProperties \n> camera_sensor_properties.cpp:465 Please consider updating the camera \n> sensor properties database\n> [0:12:04.623478774] [3838]  WARN CameraSensor \n> camera_sensor_legacy.cpp:669 's5k3l6xx 3-002d': Unsupported ancillary \n> entity function 131074\n> [0:12:04.635553373] [3838]  WARN IPASoft soft_simple.cpp:98 IPASoft: \n> Failed to create camera sensor helper for s5k3l6xx\n> Using camera /base/soc@0/bus@30800000/i2c@30a40000/camera@20 as cam0\n> 0: 636x480-ABGR8888\n>  * Pixelformat: ABGR8888 (2x2)-(1628x1224)/(+0,+0)\n> [0:12:04.643438097] [3837] ERROR Stream stream.cpp:215 Range format is \n> ambiguous\n>  * Pixelformat: XBGR8888 (2x2)-(1628x1224)/(+0,+0)\n> [0:12:04.643696229] [3837] ERROR Stream stream.cpp:215 Range format is \n> ambiguous\n>  * Pixelformat: BGR888 (2x2)-(1628x1224)/(+0,+0)\n> [0:12:04.643748792] [3837] ERROR Stream stream.cpp:215 Range format is \n> ambiguous\n>  * Pixelformat: RGB888 (2x2)-(1628x1224)/(+0,+0)\n> [0:12:04.643861237] [3837] ERROR Stream stream.cpp:215 Range format is \n> ambiguous\n>  * Pixelformat: ARGB8888 (2x2)-(1628x1224)/(+0,+0)\n> [0:12:04.643918479] [3837] ERROR Stream stream.cpp:215 Range format is \n> ambiguous\n>  * Pixelformat: XRGB8888 (2x2)-(1628x1224)/(+0,+0)\n> [0:12:04.643971162] [3837] ERROR Stream stream.cpp:215 Range format is \n> ambiguous\n\nInterestingly I don't see the same on the OP6 - i.e. not every sensor \nappears to be affected.\n\nOn 20.03.25 23:43, Kieran Bingham wrote:\n> Quoting Milan Zamazal (2025-03-05 19:26:12)\n>> When generating simple pipeline configuration, raw output configurations\n>> are generated but later filtered out.  Let's include processed and/or\n>> raw output configurations depending on the requested stream roles.\n>>\n>> Raw and processed formats are handled separately.  The intention is that\n>> in case both raw and processed formats are requested then the raw\n>> formats should be left intact to the extent possible and not be\n>> influenced by the processed formats (implying that raw parameters\n>> compatible with the processed output requirements must be requested by\n>> the application).\n>>\n>> Raw output configurations are marked by setting their colorSpace to\n>> ColorSpace::Raw, which is the only place there suitable for the purpose.\n>>\n>> This is another preparatory patch without making raw outputs working.\n> I've identified two interesting effects which I've bisected to this\n> patch:\n>\n> First:\n>\n> Without this patch on x13s:\n>\n> [libcamera] kbingham@charm:~/iob/libcamera/build/gcc$ cam -c1 --metadata -C10\n> [1:44:39.464209549] [37696]  INFO IPAManager ipa_manager.cpp:137 libcamera is not installed. Adding '/home/kbingham/iob/libcamera/build/gcc/src/ipa' to the IPA search path\n> [1:44:39.471858239] [37696]  INFO Camera camera_manager.cpp:327 libcamera v0.4.0+149-628e8c80\n> [1:44:39.497573824] [37697]  WARN CameraSensor camera_sensor_legacy.cpp:616 'ov5675 24-0010': Rotation control not available, default to 0 degrees\n> [1:44:39.502155101] [37697]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n> [1:44:39.502180672] [37697]  WARN IPAProxy ipa_proxy.cpp:177 Configuration file 'ov5675.yaml' not found for IPA module 'simple', falling back to 'uncalibrated.yaml'\n> [1:44:39.502468206] [37697]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n> [1:44:39.512547578] [37697]  INFO Pipeline pipeline_handler.cpp:618 libcamera is not installed. Loading platform configuration file from '/home/kbingham/iob/libcamera/src/libcamera/pipeline/virtual/data/virtual.yaml'\n> Using camera /base/soc@0/cci@ac4c000/i2c-bus@1/camera@10 as cam0\n> [1:44:39.514127115] [37696]  INFO Camera camera.cpp:1203 configuring streams: (0) 2584x1944-ABGR8888\n> [1:44:39.520536247] [37697]  WARN CameraSensor camera_sensor_legacy.cpp:501 'ov5675 24-0010': No sensor delays found in static properties. Assuming unverified defaults.\n> [1:44:39.520899922] [37697]  INFO IPASoft soft_simple.cpp:251 IPASoft: Exposure 4-2016, gain 1-15.9922 (0.149922)\n> cam0: Capture 10 frames\n> 6279.664529 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 20093184\n> \tSensorTimestamp = 6279664529000\n> 6279.697607 (30.23 fps) cam0-stream0 seq: 000001 bytesused: 20093184\n> \tSensorTimestamp = 6279697607000\n> 6279.731336 (29.65 fps) cam0-stream0 seq: 000002 bytesused: 20093184\n> \tSensorTimestamp = 6279731336000\n> 6279.831491 (9.98 fps) cam0-stream0 seq: 000003 bytesused: 20093184\n> \tSensorTimestamp = 6279831491000\n> 6279.898368 (14.95 fps) cam0-stream0 seq: 000004 bytesused: 20093184\n> \tSensorTimestamp = 6279898368000\n> 6279.965133 (14.98 fps) cam0-stream0 seq: 000005 bytesused: 20093184\n> \tSensorTimestamp = 6279965133000\n> 6280.031911 (14.97 fps) cam0-stream0 seq: 000006 bytesused: 20093184\n> \tSensorTimestamp = 6280031911000\n> 6280.098577 (15.00 fps) cam0-stream0 seq: 000007 bytesused: 20093184\n> \tSensorTimestamp = 6280098577000\n> 6280.165320 (14.98 fps) cam0-stream0 seq: 000008 bytesused: 20093184\n> \tSensorTimestamp = 6280165320000\n> 6280.232225 (14.95 fps) cam0-stream0 seq: 000009 bytesused: 20093184\n> \tSensorTimestamp = 6280232225000\n>\n> (Note the 15 FPS), and pipewire/gstreamer/cheese are all 'streaming'...\n>\n>\n> But with this patch the rate jumps to a more reasonable 30 FPS seen by\n> qcam and cam:\n>\n> [libcamera] kbingham@charm:~/iob/libcamera/build/gcc$ cam -c1 --metadata -C10\n> [1:46:59.040578435] [38346]  INFO IPAManager ipa_manager.cpp:137 libcamera is not installed. Adding '/home/kbingham/iob/libcamera/build/gcc/src/ipa' to the IPA search path\n> [1:46:59.048420757] [38346]  INFO Camera camera_manager.cpp:327 libcamera v0.4.0+150-d0e1caa0\n> [1:46:59.074259713] [38347]  WARN CameraSensor camera_sensor_legacy.cpp:616 'ov5675 24-0010': Rotation control not available, default to 0 degrees\n> [1:46:59.078796773] [38347]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n> [1:46:59.078822605] [38347]  WARN IPAProxy ipa_proxy.cpp:177 Configuration file 'ov5675.yaml' not found for IPA module 'simple', falling back to 'uncalibrated.yaml'\n> [1:46:59.079110243] [38347]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n> [1:46:59.087987917] [38347]  INFO Pipeline pipeline_handler.cpp:618 libcamera is not installed. Loading platform configuration file from '/home/kbingham/iob/libcamera/src/libcamera/pipeline/virtual/data/virtual.yaml'\n> Using camera /base/soc@0/cci@ac4c000/i2c-bus@1/camera@10 as cam0\n> [1:46:59.089522196] [38346]  INFO Camera camera.cpp:1203 configuring streams: (0) 1288x972-ABGR8888\n> [1:46:59.096422962] [38347]  WARN CameraSensor camera_sensor_legacy.cpp:501 'ov5675 24-0010': No sensor delays found in static properties. Assuming unverified defaults.\n> [1:46:59.096786533] [38347]  INFO IPASoft soft_simple.cpp:251 IPASoft: Exposure 4-2016, gain 1-15.9922 (0.149922)\n> cam0: Capture 10 frames\n> 6419.234779 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 5007744\n> \tSensorTimestamp = 6419234779000\n> 6419.268213 (29.91 fps) cam0-stream0 seq: 000001 bytesused: 5007744\n> \tSensorTimestamp = 6419268213000\n> 6419.301359 (30.17 fps) cam0-stream0 seq: 000002 bytesused: 5007744\n> \tSensorTimestamp = 6419301359000\n> 6419.334744 (29.95 fps) cam0-stream0 seq: 000003 bytesused: 5007744\n> \tSensorTimestamp = 6419334744000\n> 6419.368129 (29.95 fps) cam0-stream0 seq: 000004 bytesused: 5007744\n> \tSensorTimestamp = 6419368129000\n> 6419.401516 (29.95 fps) cam0-stream0 seq: 000005 bytesused: 5007744\n> \tSensorTimestamp = 6419401516000\n> 6419.434902 (29.95 fps) cam0-stream0 seq: 000006 bytesused: 5007744\n> \tSensorTimestamp = 6419434902000\n> 6419.468289 (29.95 fps) cam0-stream0 seq: 000007 bytesused: 5007744\n> \tSensorTimestamp = 6419468289000\n> 6419.501673 (29.95 fps) cam0-stream0 seq: 000008 bytesused: 5007744\n> \tSensorTimestamp = 6419501673000\n> 6419.535058 (29.95 fps) cam0-stream0 seq: 000009 bytesused: 5007744\n> \tSensorTimestamp = 6419535058000\n>\n>\n> But alas I note that now gstreamer (and cheese, and pipewire) now fail:\n>\n> [libcamera] kbingham@charm:~/iob/libcamera/build/gcc$ gst-launch-1.0 libcamerasrc ! autovideosink\n> Setting pipeline to PAUSED ...\n> [1:46:09.897725501] [38325]  INFO IPAManager ipa_manager.cpp:137 libcamera is not installed. Adding '/home/kbingham/iob/libcamera/build/gcc/src/ipa' to the IPA search path\n> [1:46:09.903176776] [38325]  INFO Camera camera_manager.cpp:327 libcamera v0.4.0+150-d0e1caa0\n> [1:46:09.935374613] [38330]  WARN CameraSensor camera_sensor_legacy.cpp:616 'ov5675 24-0010': Rotation control not available, default to 0 degrees\n> [1:46:09.941677813] [38330]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n> [1:46:09.941734112] [38330]  WARN IPAProxy ipa_proxy.cpp:177 Configuration file 'ov5675.yaml' not found for IPA module 'simple', falling back to 'uncalibrated.yaml'\n> [1:46:09.942172574] [38330]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n> [1:46:09.949343846] [38330]  INFO Pipeline pipeline_handler.cpp:618 libcamera is not installed. Loading platform configuration file from '/home/kbingham/iob/libcamera/src/libcamera/pipeline/virtual/data/virtual.yaml'\n> Pipeline is live and does not need PREROLL ...\n> Pipeline is PREROLLED ...\n> Setting pipeline to PLAYING ...\n> New clock: GstSystemClock\n> [1:46:09.950895937] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n> [1:46:09.950940309] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n> [1:46:09.950962495] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n> [1:46:09.950982129] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n> [1:46:09.951001711] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n> [1:46:09.951020564] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n> ERROR: from element /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0: Internal data stream error.\n> Additional debug info:\n> ../../src/gstreamer/gstlibcamerasrc.cpp(662): gst_libcamera_src_task_enter (): /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0:\n> streaming stopped, reason not-negotiated (-4)\n> Execution ended after 0:00:00.000438306\n> Setting pipeline to NULL ...\n> Freeing pipeline ...\n>\n> Debugging a little, at stream.ccp:215\n>\n> diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\n> index 978d72752b00..22f348c2df87 100644\n> --- a/src/libcamera/stream.cpp\n> +++ b/src/libcamera/stream.cpp\n> @@ -213,6 +213,8 @@ std::vector<Size> StreamFormats::sizes(const PixelFormat &pixelformat) const\n>          if (!discrete) {\n>                  if (ranges.size() != 1) {\n>                          LOG(Stream, Error) << \"Range format is ambiguous\";\n> +                       for (auto range: ranges)\n> +                               LOG(Stream, Error) << range;\n>                          return {};\n>                  }\n>\n> Reports:\n>\n> [1:51:01.855863590] [40484] ERROR Stream stream.cpp:215 Range format is ambiguous\n> [1:51:01.855901452] [40484] ERROR Stream stream.cpp:217 (4x2)-(1288x972)/(+4,+2)\n> [1:51:01.855920305] [40484] ERROR Stream stream.cpp:217 (4x2)-(2584x1944)/(+4,+2)\n>\n> So we're somehow setting up the stream capabilities incorrectly here\n> which breaks things... (note that ranges.size is 2, not 1?)\n>\n> Perhaps we're incorrectly adding the raw stream sizes to the processed stream\n> sizes ?\n>\n> --\n> Kieran\n>\n>\n>> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n>> ---\n>>   src/libcamera/pipeline/simple/simple.cpp | 72 ++++++++++++++++--------\n>>   1 file changed, 49 insertions(+), 23 deletions(-)\n>>\n>> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n>> index 0c6e0f44..92b9608b 100644\n>> --- a/src/libcamera/pipeline/simple/simple.cpp\n>> +++ b/src/libcamera/pipeline/simple/simple.cpp\n>> @@ -25,6 +25,7 @@\n>>   #include <libcamera/base/log.h>\n>>   \n>>   #include <libcamera/camera.h>\n>> +#include <libcamera/color_space.h>\n>>   #include <libcamera/control_ids.h>\n>>   #include <libcamera/pixel_format.h>\n>>   #include <libcamera/request.h>\n>> @@ -389,6 +390,8 @@ private:\n>>          const MediaPad *acquirePipeline(SimpleCameraData *data);\n>>          void releasePipeline(SimpleCameraData *data);\n>>   \n>> +       void setUpFormatSizes(std::map<PixelFormat, std::vector<SizeRange>> formats);\n>> +\n>>          std::map<const MediaEntity *, EntityData> entities_;\n>>   \n>>          MediaDevice *converter_;\n>> @@ -1191,15 +1194,56 @@ SimplePipelineHandler::generateConfiguration(Camera *camera, Span<const StreamRo\n>>                          data->processedRequested_ = true;\n>>                  }\n>>   \n>> -       /* Create the formats map. */\n>> -       std::map<PixelFormat, std::vector<SizeRange>> formats;\n>> +       /* Create the formats maps. */\n>> +       std::map<PixelFormat, std::vector<SizeRange>> processedFormats;\n>> +       std::map<PixelFormat, std::vector<SizeRange>> rawFormats;\n>>   \n>>          for (const SimpleCameraData::Configuration &cfg : data->configs_)\n>> -               if (!cfg.raw)\n>> -                       for (PixelFormat format : cfg.outputFormats)\n>> -                               formats[format].push_back(cfg.outputSizes);\n>> +               for (PixelFormat format : cfg.outputFormats)\n>> +                       (cfg.raw ? rawFormats : processedFormats)[format].push_back(cfg.outputSizes);\n>> +\n>> +       if (data->processedRequested_ && processedFormats.empty()) {\n>> +               LOG(SimplePipeline, Error)\n>> +                       << \"Processed stream requsted but no corresponding output configuration found\";\n>> +               return nullptr;\n>> +       }\n>> +       if (data->rawRequested_ && rawFormats.empty()) {\n>> +               LOG(SimplePipeline, Error)\n>> +                       << \"Raw stream requsted but no corresponding output configuration found\";\n>> +               return nullptr;\n>> +       }\n>> +\n>> +       setUpFormatSizes(processedFormats);\n>> +       setUpFormatSizes(rawFormats);\n>> +\n>> +       /*\n>> +        * Create the stream configurations. Take the first entry in the formats\n>> +        * map as the default, for lack of a better option.\n>> +        *\n>> +        * \\todo Implement a better way to pick the default format\n>> +        */\n>> +       for (StreamRole role : roles) {\n>> +               bool raw = (role == StreamRole::Raw);\n>> +               auto formats = (raw ? rawFormats : processedFormats);\n>> +               StreamConfiguration cfg{ StreamFormats{ formats } };\n>> +               cfg.pixelFormat = formats.begin()->first;\n>> +               cfg.size = formats.begin()->second[0].max;\n>> +               if (raw)\n>> +                       cfg.colorSpace = ColorSpace::Raw;\n>> +\n>> +               config->addConfiguration(cfg);\n>> +       }\n>> +\n>> +       config->validate();\n>> +\n>> +       return config;\n>> +}\n>>   \n>> +void SimplePipelineHandler::setUpFormatSizes(\n>> +       std::map<PixelFormat, std::vector<SizeRange>> formats)\n>> +{\n>>          /* Sort the sizes and merge any consecutive overlapping ranges. */\n>> +\n>>          for (auto &[format, sizes] : formats) {\n>>                  std::sort(sizes.begin(), sizes.end(),\n>>                            [](SizeRange &a, SizeRange &b) {\n>> @@ -1219,24 +1263,6 @@ SimplePipelineHandler::generateConfiguration(Camera *camera, Span<const StreamRo\n>>   \n>>                  sizes.erase(++cur, sizes.end());\n>>          }\n>> -\n>> -       /*\n>> -        * Create the stream configurations. Take the first entry in the formats\n>> -        * map as the default, for lack of a better option.\n>> -        *\n>> -        * \\todo Implement a better way to pick the default format\n>> -        */\n>> -       for ([[maybe_unused]] StreamRole role : roles) {\n>> -               StreamConfiguration cfg{ StreamFormats{ formats } };\n>> -               cfg.pixelFormat = formats.begin()->first;\n>> -               cfg.size = formats.begin()->second[0].max;\n>> -\n>> -               config->addConfiguration(cfg);\n>> -       }\n>> -\n>> -       config->validate();\n>> -\n>> -       return config;\n>>   }\n>>   \n>>   int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n>> -- \n>> 2.48.1\n>>","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 27325C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 26 Mar 2025 22:54:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4DAD26896B;\n\tWed, 26 Mar 2025 23:54:51 +0100 (CET)","from sender4-op-o12.zoho.com (sender4-op-o12.zoho.com\n\t[136.143.188.12])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 103B768950\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Mar 2025 23:54:48 +0100 (CET)","by mx.zohomail.com with SMTPS id 1743029683420950.3712704188658;\n\tWed, 26 Mar 2025 15:54:43 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=collabora.com\n\theader.i=robert.mader@collabora.com header.b=\"K52uC5Ft\"; \n\tdkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1743029685; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=nlm0j5CDRBq4pU2ws3+btGUP6LR+EHl19zOaxfwEP+xVzuEKm1Y4Xnlp7FzDF+Vx7CH6jmZGIS+hvOBUEqSQZwRtxtqw5x8XYirqYxue82o1ock8Xn2o0hk3b9BsURlmC0TcPy1+HcbwTIJdiJES2a3m9Swq3Q70WeO7bYM8tGM=","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1743029685;\n\th=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To:Cc;\n\tbh=kCGcmn+RG+N2vz7UtWEQzS3gww3zcXq5UnW9FsOSJH4=; \n\tb=L8dgMzkEm1CtnI2+4C65u6u5yCA4GpU9gqO+2q1nSTaozDfhphrNpHPk4zU7ALcVNcHpibETsk9R823jO5PdEGly2Wpb2ae8wiaogmIZ7h7RkaPwFfFovqaIr3FNaOwWaL6alE0z/jsDl9wSA6LHg4dCGFEFwqLtArTbVPB8Q5w=","ARC-Authentication-Results":"i=1; mx.zohomail.com;\n\tdkim=pass  header.i=collabora.com;\n\tspf=pass  smtp.mailfrom=robert.mader@collabora.com;\n\tdmarc=pass header.from=<robert.mader@collabora.com>","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1743029685;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:References:From:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To:Cc;\n\tbh=kCGcmn+RG+N2vz7UtWEQzS3gww3zcXq5UnW9FsOSJH4=;\n\tb=K52uC5FtG7seIu7o6O8VP06oIDOB/ineIjOyYUnA1FBRFreCTrYneHmdVTsaFMP7\n\thOZb+Olm7EVqxrjkQC/lA22vvIYc49W0r421r5FwjW7P8GjT3GdkkipsICMmgKq12+M\n\tpk8FA+RsEbJrReFshObDX9UHS4dedyCOGH4KzULA=","Message-ID":"<df9758f6-46b9-4db1-97e5-79680db3ddc7@collabora.com>","Date":"Wed, 26 Mar 2025 23:54:41 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3 5/8] libcamera: simple: Consider raw output\n\tconfigurations","To":"libcamera-devel@lists.libcamera.org","References":"<20250305192617.18361-1-mzamazal@redhat.com>\n\t<20250305192617.18361-6-mzamazal@redhat.com>\n\t<174251063991.2222410.7500950803669680754@ping.linuxembedded.co.uk>","Content-Language":"en-US, de-DE, en-GB","From":"Robert Mader <robert.mader@collabora.com>","In-Reply-To":"<174251063991.2222410.7500950803669680754@ping.linuxembedded.co.uk>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":33899,"web_url":"https://patchwork.libcamera.org/comment/33899/","msgid":"<85r02av2jd.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-04-02T18:31:02","subject":"Re: [PATCH v3 5/8] libcamera: simple: Consider raw output\n\tconfigurations","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Hi Kieran,\n\nthank you for testing.\n\nKieran Bingham <kieran.bingham@ideasonboard.com> writes:\n\n> Quoting Milan Zamazal (2025-03-05 19:26:12)\n>> When generating simple pipeline configuration, raw output configurations\n>> are generated but later filtered out.  Let's include processed and/or\n>> raw output configurations depending on the requested stream roles.\n>> \n>> Raw and processed formats are handled separately.  The intention is that\n>> in case both raw and processed formats are requested then the raw\n>> formats should be left intact to the extent possible and not be\n>> influenced by the processed formats (implying that raw parameters\n>> compatible with the processed output requirements must be requested by\n>> the application).\n>> \n>> Raw output configurations are marked by setting their colorSpace to\n>> ColorSpace::Raw, which is the only place there suitable for the purpose.\n>> \n>> This is another preparatory patch without making raw outputs working.\n>\n> I've identified two interesting effects which I've bisected to this\n> patch:\n>\n> First:\n>\n> Without this patch on x13s:\n>\n> [libcamera] kbingham@charm:~/iob/libcamera/build/gcc$ cam -c1 --metadata -C10\n> [1:44:39.464209549] [37696]  INFO IPAManager ipa_manager.cpp:137 libcamera is not installed. Adding '/home/kbingham/iob/libcamera/build/gcc/src/ipa' to the IPA search path\n> [1:44:39.471858239] [37696]  INFO Camera camera_manager.cpp:327 libcamera v0.4.0+149-628e8c80\n> [1:44:39.497573824] [37697]  WARN CameraSensor camera_sensor_legacy.cpp:616 'ov5675 24-0010': Rotation control not available, default to 0 degrees\n> [1:44:39.502155101] [37697]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n> [1:44:39.502180672] [37697]  WARN IPAProxy ipa_proxy.cpp:177 Configuration file 'ov5675.yaml' not found for IPA module 'simple', falling back to 'uncalibrated.yaml'\n> [1:44:39.502468206] [37697]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n> [1:44:39.512547578] [37697]  INFO Pipeline pipeline_handler.cpp:618 libcamera is not installed. Loading platform configuration file from '/home/kbingham/iob/libcamera/src/libcamera/pipeline/virtual/data/virtual.yaml'\n> Using camera /base/soc@0/cci@ac4c000/i2c-bus@1/camera@10 as cam0\n> [1:44:39.514127115] [37696]  INFO Camera camera.cpp:1203 configuring streams: (0) 2584x1944-ABGR8888\n> [1:44:39.520536247] [37697]  WARN CameraSensor camera_sensor_legacy.cpp:501 'ov5675 24-0010': No sensor delays found in static properties. Assuming unverified defaults.\n> [1:44:39.520899922] [37697]  INFO IPASoft soft_simple.cpp:251 IPASoft: Exposure 4-2016, gain 1-15.9922 (0.149922)\n> cam0: Capture 10 frames\n> 6279.664529 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 20093184\n> \tSensorTimestamp = 6279664529000\n> 6279.697607 (30.23 fps) cam0-stream0 seq: 000001 bytesused: 20093184\n> \tSensorTimestamp = 6279697607000\n> 6279.731336 (29.65 fps) cam0-stream0 seq: 000002 bytesused: 20093184\n> \tSensorTimestamp = 6279731336000\n> 6279.831491 (9.98 fps) cam0-stream0 seq: 000003 bytesused: 20093184\n> \tSensorTimestamp = 6279831491000\n> 6279.898368 (14.95 fps) cam0-stream0 seq: 000004 bytesused: 20093184\n> \tSensorTimestamp = 6279898368000\n> 6279.965133 (14.98 fps) cam0-stream0 seq: 000005 bytesused: 20093184\n> \tSensorTimestamp = 6279965133000\n> 6280.031911 (14.97 fps) cam0-stream0 seq: 000006 bytesused: 20093184\n> \tSensorTimestamp = 6280031911000\n> 6280.098577 (15.00 fps) cam0-stream0 seq: 000007 bytesused: 20093184\n> \tSensorTimestamp = 6280098577000\n> 6280.165320 (14.98 fps) cam0-stream0 seq: 000008 bytesused: 20093184\n> \tSensorTimestamp = 6280165320000\n> 6280.232225 (14.95 fps) cam0-stream0 seq: 000009 bytesused: 20093184\n> \tSensorTimestamp = 6280232225000\n>\n> (Note the 15 FPS), and pipewire/gstreamer/cheese are all 'streaming'...\n>\n>\n> But with this patch the rate jumps to a more reasonable 30 FPS seen by\n> qcam and cam:\n\nWell, clearly because of the lower resolution.  I don't have an\nexplanation why the patch should make it different.\n\n> [libcamera] kbingham@charm:~/iob/libcamera/build/gcc$ cam -c1 --metadata -C10\n> [1:46:59.040578435] [38346]  INFO IPAManager ipa_manager.cpp:137 libcamera is not installed. Adding '/home/kbingham/iob/libcamera/build/gcc/src/ipa' to the IPA search path\n> [1:46:59.048420757] [38346]  INFO Camera camera_manager.cpp:327 libcamera v0.4.0+150-d0e1caa0\n> [1:46:59.074259713] [38347]  WARN CameraSensor camera_sensor_legacy.cpp:616 'ov5675 24-0010': Rotation control not available, default to 0 degrees\n> [1:46:59.078796773] [38347]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n> [1:46:59.078822605] [38347]  WARN IPAProxy ipa_proxy.cpp:177 Configuration file 'ov5675.yaml' not found for IPA module 'simple', falling back to 'uncalibrated.yaml'\n> [1:46:59.079110243] [38347]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n> [1:46:59.087987917] [38347]  INFO Pipeline pipeline_handler.cpp:618 libcamera is not installed. Loading platform configuration file from '/home/kbingham/iob/libcamera/src/libcamera/pipeline/virtual/data/virtual.yaml'\n> Using camera /base/soc@0/cci@ac4c000/i2c-bus@1/camera@10 as cam0\n> [1:46:59.089522196] [38346]  INFO Camera camera.cpp:1203 configuring streams: (0) 1288x972-ABGR8888\n> [1:46:59.096422962] [38347]  WARN CameraSensor camera_sensor_legacy.cpp:501 'ov5675 24-0010': No sensor delays found in static properties. Assuming unverified defaults.\n> [1:46:59.096786533] [38347]  INFO IPASoft soft_simple.cpp:251 IPASoft: Exposure 4-2016, gain 1-15.9922 (0.149922)\n> cam0: Capture 10 frames\n> 6419.234779 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 5007744\n> \tSensorTimestamp = 6419234779000\n> 6419.268213 (29.91 fps) cam0-stream0 seq: 000001 bytesused: 5007744\n> \tSensorTimestamp = 6419268213000\n> 6419.301359 (30.17 fps) cam0-stream0 seq: 000002 bytesused: 5007744\n> \tSensorTimestamp = 6419301359000\n> 6419.334744 (29.95 fps) cam0-stream0 seq: 000003 bytesused: 5007744\n> \tSensorTimestamp = 6419334744000\n> 6419.368129 (29.95 fps) cam0-stream0 seq: 000004 bytesused: 5007744\n> \tSensorTimestamp = 6419368129000\n> 6419.401516 (29.95 fps) cam0-stream0 seq: 000005 bytesused: 5007744\n> \tSensorTimestamp = 6419401516000\n> 6419.434902 (29.95 fps) cam0-stream0 seq: 000006 bytesused: 5007744\n> \tSensorTimestamp = 6419434902000\n> 6419.468289 (29.95 fps) cam0-stream0 seq: 000007 bytesused: 5007744\n> \tSensorTimestamp = 6419468289000\n> 6419.501673 (29.95 fps) cam0-stream0 seq: 000008 bytesused: 5007744\n> \tSensorTimestamp = 6419501673000\n> 6419.535058 (29.95 fps) cam0-stream0 seq: 000009 bytesused: 5007744\n> \tSensorTimestamp = 6419535058000\n>\n>\n> But alas I note that now gstreamer (and cheese, and pipewire) now fail:\n>\n> [libcamera] kbingham@charm:~/iob/libcamera/build/gcc$ gst-launch-1.0 libcamerasrc ! autovideosink\n> Setting pipeline to PAUSED ...\n> [1:46:09.897725501] [38325]  INFO IPAManager ipa_manager.cpp:137 libcamera is not installed. Adding '/home/kbingham/iob/libcamera/build/gcc/src/ipa' to the IPA search path\n> [1:46:09.903176776] [38325]  INFO Camera camera_manager.cpp:327 libcamera v0.4.0+150-d0e1caa0\n> [1:46:09.935374613] [38330]  WARN CameraSensor camera_sensor_legacy.cpp:616 'ov5675 24-0010': Rotation control not available, default to 0 degrees\n> [1:46:09.941677813] [38330]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n> [1:46:09.941734112] [38330]  WARN IPAProxy ipa_proxy.cpp:177 Configuration file 'ov5675.yaml' not found for IPA module 'simple', falling back to 'uncalibrated.yaml'\n> [1:46:09.942172574] [38330]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n> [1:46:09.949343846] [38330]  INFO Pipeline pipeline_handler.cpp:618 libcamera is not installed. Loading platform configuration file from '/home/kbingham/iob/libcamera/src/libcamera/pipeline/virtual/data/virtual.yaml'\n> Pipeline is live and does not need PREROLL ...\n> Pipeline is PREROLLED ...\n> Setting pipeline to PLAYING ...\n> New clock: GstSystemClock\n> [1:46:09.950895937] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n> [1:46:09.950940309] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n> [1:46:09.950962495] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n> [1:46:09.950982129] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n> [1:46:09.951001711] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n> [1:46:09.951020564] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n> ERROR: from element /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0: Internal data stream error.\n> Additional debug info:\n> ../../src/gstreamer/gstlibcamerasrc.cpp(662): gst_libcamera_src_task_enter (): /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0:\n> streaming stopped, reason not-negotiated (-4)\n> Execution ended after 0:00:00.000438306\n> Setting pipeline to NULL ...\n> Freeing pipeline ...\n>\n> Debugging a little, at stream.ccp:215\n>\n> diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\n> index 978d72752b00..22f348c2df87 100644\n> --- a/src/libcamera/stream.cpp\n> +++ b/src/libcamera/stream.cpp\n> @@ -213,6 +213,8 @@ std::vector<Size> StreamFormats::sizes(const PixelFormat &pixelformat) const\n>         if (!discrete) {\n>                 if (ranges.size() != 1) {\n>                         LOG(Stream, Error) << \"Range format is ambiguous\";\n> +                       for (auto range: ranges)\n> +                               LOG(Stream, Error) << range;\n>                         return {};\n>                 }\n>\n> Reports:\n>\n> [1:51:01.855863590] [40484] ERROR Stream stream.cpp:215 Range format is ambiguous\n> [1:51:01.855901452] [40484] ERROR Stream stream.cpp:217 (4x2)-(1288x972)/(+4,+2)\n> [1:51:01.855920305] [40484] ERROR Stream stream.cpp:217 (4x2)-(2584x1944)/(+4,+2)\n>\n> So we're somehow setting up the stream capabilities incorrectly here\n> which breaks things... (note that ranges.size is 2, not 1?)\n>\n> Perhaps we're incorrectly adding the raw stream sizes to the processed stream\n> sizes ?\n\nNo, it's a stupid (and not immediately visible) bug: passing formats to\nsetUpFormatSizes by value rather than by reference, see below.\n\n> --\n> Kieran\n>\n>\n>> \n>> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n>> ---\n>>  src/libcamera/pipeline/simple/simple.cpp | 72 ++++++++++++++++--------\n>>  1 file changed, 49 insertions(+), 23 deletions(-)\n>> \n>> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n>> index 0c6e0f44..92b9608b 100644\n>> --- a/src/libcamera/pipeline/simple/simple.cpp\n>> +++ b/src/libcamera/pipeline/simple/simple.cpp\n>> @@ -25,6 +25,7 @@\n>>  #include <libcamera/base/log.h>\n>>  \n>>  #include <libcamera/camera.h>\n>> +#include <libcamera/color_space.h>\n>>  #include <libcamera/control_ids.h>\n>>  #include <libcamera/pixel_format.h>\n>>  #include <libcamera/request.h>\n>> @@ -389,6 +390,8 @@ private:\n>>         const MediaPad *acquirePipeline(SimpleCameraData *data);\n>>         void releasePipeline(SimpleCameraData *data);\n>>  \n>> +       void setUpFormatSizes(std::map<PixelFormat, std::vector<SizeRange>> formats);\n\nShould be &formats.\n\n>> +\n>>         std::map<const MediaEntity *, EntityData> entities_;\n>>  \n>>         MediaDevice *converter_;\n>> @@ -1191,15 +1194,56 @@ SimplePipelineHandler::generateConfiguration(Camera *camera, Span<const StreamRo\n>>                         data->processedRequested_ = true;\n>>                 }\n>>  \n>> -       /* Create the formats map. */\n>> -       std::map<PixelFormat, std::vector<SizeRange>> formats;\n>> +       /* Create the formats maps. */\n>> +       std::map<PixelFormat, std::vector<SizeRange>> processedFormats;\n>> +       std::map<PixelFormat, std::vector<SizeRange>> rawFormats;\n>>  \n>>         for (const SimpleCameraData::Configuration &cfg : data->configs_)\n>> -               if (!cfg.raw)\n>> -                       for (PixelFormat format : cfg.outputFormats)\n>> -                               formats[format].push_back(cfg.outputSizes);\n>> +               for (PixelFormat format : cfg.outputFormats)\n>> +                       (cfg.raw ? rawFormats : processedFormats)[format].push_back(cfg.outputSizes);\n>> +\n>> +       if (data->processedRequested_ && processedFormats.empty()) {\n>> +               LOG(SimplePipeline, Error)\n>> +                       << \"Processed stream requsted but no corresponding output configuration found\";\n>> +               return nullptr;\n>> +       }\n>> +       if (data->rawRequested_ && rawFormats.empty()) {\n>> +               LOG(SimplePipeline, Error)\n>> +                       << \"Raw stream requsted but no corresponding output configuration found\";\n>> +               return nullptr;\n>> +       }\n>> +\n>> +       setUpFormatSizes(processedFormats);\n>> +       setUpFormatSizes(rawFormats);\n>> +\n>> +       /*\n>> +        * Create the stream configurations. Take the first entry in the formats\n>> +        * map as the default, for lack of a better option.\n>> +        *\n>> +        * \\todo Implement a better way to pick the default format\n>> +        */\n>> +       for (StreamRole role : roles) {\n>> +               bool raw = (role == StreamRole::Raw);\n>> +               auto formats = (raw ? rawFormats : processedFormats);\n>> +               StreamConfiguration cfg{ StreamFormats{ formats } };\n>> +               cfg.pixelFormat = formats.begin()->first;\n>> +               cfg.size = formats.begin()->second[0].max;\n>> +               if (raw)\n>> +                       cfg.colorSpace = ColorSpace::Raw;\n>> +\n>> +               config->addConfiguration(cfg);\n>> +       }\n>> +\n>> +       config->validate();\n>> +\n>> +       return config;\n>> +}\n>>  \n>> +void SimplePipelineHandler::setUpFormatSizes(\n>> +       std::map<PixelFormat, std::vector<SizeRange>> formats)\n\n&formats\n\n>> +{\n>>         /* Sort the sizes and merge any consecutive overlapping ranges. */\n>> +\n>>         for (auto &[format, sizes] : formats) {\n>>                 std::sort(sizes.begin(), sizes.end(),\n>>                           [](SizeRange &a, SizeRange &b) {\n>> @@ -1219,24 +1263,6 @@ SimplePipelineHandler::generateConfiguration(Camera *camera, Span<const StreamRo\n>>  \n>>                 sizes.erase(++cur, sizes.end());\n>>         }\n>> -\n>> -       /*\n>> -        * Create the stream configurations. Take the first entry in the formats\n>> -        * map as the default, for lack of a better option.\n>> -        *\n>> -        * \\todo Implement a better way to pick the default format\n>> -        */\n>> -       for ([[maybe_unused]] StreamRole role : roles) {\n>> -               StreamConfiguration cfg{ StreamFormats{ formats } };\n>> -               cfg.pixelFormat = formats.begin()->first;\n>> -               cfg.size = formats.begin()->second[0].max;\n>> -\n>> -               config->addConfiguration(cfg);\n>> -       }\n>> -\n>> -       config->validate();\n>> -\n>> -       return config;\n>>  }\n>>  \n>>  int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n>> -- \n>> 2.48.1\n>>","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 2EE5AC3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Apr 2025 18:31:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 546CD68994;\n\tWed,  2 Apr 2025 20:31:11 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 55F6168979\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Apr 2025 20:31:09 +0200 (CEST)","from mail-ej1-f70.google.com (mail-ej1-f70.google.com\n\t[209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-240-U846bBtSMoSjBZ5hlT8loQ-1; Wed, 02 Apr 2025 14:31:06 -0400","by mail-ej1-f70.google.com with SMTP id\n\ta640c23a62f3a-ac3df3f1193so3400666b.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 02 Apr 2025 11:31:06 -0700 (PDT)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\ta640c23a62f3a-ac71967fce9sm943550866b.130.2025.04.02.11.31.03\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 02 Apr 2025 11:31:03 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"iifAyH72\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1743618668;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=NQB2KF833Pauu90DaZGaOjjdZAd16SoIfqWKgYRNmrA=;\n\tb=iifAyH72Pvk5VeLWoBKCoJIA+DWCwsOOYv8PiCpMmAjhen1Z6/VN+l2RScmEXVbg5IK6/S\n\tqkvJw0M4P5CmprcNJREc2hN0X0Q4wxdvM5zp2TPeGqXyejNG+vT+8UQMiPEHCx1EMsZ2iy\n\tSuqNITaXv6aRKWrgGr3i3VcldZm+Zbg=","X-MC-Unique":"U846bBtSMoSjBZ5hlT8loQ-1","X-Mimecast-MFC-AGG-ID":"U846bBtSMoSjBZ5hlT8loQ_1743618665","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1743618665; x=1744223465;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=NQB2KF833Pauu90DaZGaOjjdZAd16SoIfqWKgYRNmrA=;\n\tb=Jzq71YDZiOeLzxMpEFkrG1K4/sB4gg/x2Fnod3JM+IIIHpFTPf98XIuWMLWgGjusxM\n\tKzNYfXOvRDZYWhDy1PeLiaRzbNE0l4K9VPQpr5hXwpm/VpK+ojVmZHVcyoTzfG5B9Dxc\n\t27lH3efMz4uCWyxdSzmSJ0GqyS07KuN8tt531S9BXW7yFBd4v9EWYT3JoSa5ujPINdhb\n\tDtfgqzIyDyZu0GyA8s4ytqmjrH3afXpR0jJ6lqRgNEfCC157Z9ErqWPj6L2yIk76XvNU\n\tYfPauCii+THJKdqWUJnWXr0KVtHTST4yGkdQl6wS9yf2sL35LxDV7M6+6NT7P45pKX5w\n\t307Q==","X-Gm-Message-State":"AOJu0YyRnlHZ1v5BB5d+/DPyImX2ErYGkrISn2ZPlna5u2wiYeosPGXw\n\tzw1vEu4639Vk8yePuBlmYjRX/gKfrshwEqGo0B7/oUV1KytsazRg2oCijjSgP0kfeT35dYRIWaM\n\tvY8t3CmIBVvWb7Q8Ktw2ixdLX6ITwj6fYlI0eUyAH64DjtRU0k1Ys//mrQXtlM2kPk8Dxc2I=","X-Gm-Gg":"ASbGnctwBqbGuetsIgRbWgSQXUBeJwfp81wU6KEU7D2qBT0/W/xmKifWBp+Nmjwfee3\n\t4qVuozudOTe3ZcptPLAT0lKnglz7gR4GUpkB+/unK6v7JZ/v10Q5izv2lWkNpR3pd/r4467LtUa\n\t6RJ0BEv1Ixcf1jGAKn4oVv3TV7KSDPXxHSlNrFU4AyHtbmeX31+6URQkGus+5Abtp7Gj1v7y80J\n\ts3oSdxOS8jSlEp1oVjn20ZSQxkjwrNwHMyGHsNyv1Z1A8sa9gEXw4sYmThU12RaQrW3zBsqgNI/\n\tDasQrX+Qik4b+ApX73ungowi83shcM7xEamxCT76QB4C8aytyFTGesP4HYhYUd9RP1b9","X-Received":["by 2002:a17:906:7955:b0:ac3:898a:f36d with SMTP id\n\ta640c23a62f3a-ac738a5a6aemr1579928166b.30.1743618665008; \n\tWed, 02 Apr 2025 11:31:05 -0700 (PDT)","by 2002:a17:906:7955:b0:ac3:898a:f36d with SMTP id\n\ta640c23a62f3a-ac738a5a6aemr1579925566b.30.1743618664412; \n\tWed, 02 Apr 2025 11:31:04 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IHGH2iUZYX/MpyauzhduZQJMudFgZ/+Rk6KIzGeJ0Ra9KsH3LcG7MqX9RToFuz3KUmCQjOZnQ==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,  Laurent Pinchart\n\t<laurent.pinchart@ideasonboard.com>","Subject":"Re: [PATCH v3 5/8] libcamera: simple: Consider raw output\n\tconfigurations","In-Reply-To":"<174251063991.2222410.7500950803669680754@ping.linuxembedded.co.uk>\n\t(Kieran Bingham's message of \"Thu, 20 Mar 2025 22:43:59 +0000\")","References":"<20250305192617.18361-1-mzamazal@redhat.com>\n\t<20250305192617.18361-6-mzamazal@redhat.com>\n\t<174251063991.2222410.7500950803669680754@ping.linuxembedded.co.uk>","Date":"Wed, 02 Apr 2025 20:31:02 +0200","Message-ID":"<85r02av2jd.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"w072DlRd-pLKO8xlCEL4lVDYkvBPqvjqG5tQ-0SDwZQ_1743618665","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":33900,"web_url":"https://patchwork.libcamera.org/comment/33900/","msgid":"<85mscyv1xs.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-04-02T18:43:59","subject":"Re: [PATCH v3 5/8] libcamera: simple: Consider raw output\n\tconfigurations","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Hi Robert,\n\nthank you for testing, see my response to Kieran what's the problem.\n\nRobert Mader <robert.mader@collabora.com> writes:\n\n> I just tried the series on the Librem5 (in order to check if Camshark) and run into the same issue, starting with this commit:\n>\n>> purism-librem5:~/git/libcamera$ cam -c 1 -I\n\nA really easy reproducer, thanks. :-)\n\n>> [0:12:04.495109800] [3837]  INFO Camera camera_manager.cpp:329 libcamera v0.4.0+194-06e2de17\n>> [0:12:04.611452658] [3838]  WARN IPASoft soft_simple.cpp:98 IPASoft: Failed to create camera sensor helper for hi846\n>> [0:12:04.622258198] [3838]  WARN CameraSensorProperties camera_sensor_properties.cpp:463 No static properties available for 's5k3l6xx'\n>> [0:12:04.622611614] [3838]  WARN CameraSensorProperties camera_sensor_properties.cpp:465 Please consider updating the camera sensor properties database\n>> [0:12:04.623478774] [3838]  WARN CameraSensor camera_sensor_legacy.cpp:669 's5k3l6xx 3-002d': Unsupported ancillary entity function 131074\n>> [0:12:04.635553373] [3838]  WARN IPASoft soft_simple.cpp:98 IPASoft: Failed to create camera sensor helper for s5k3l6xx\n>> Using camera /base/soc@0/bus@30800000/i2c@30a40000/camera@20 as cam0\n>> 0: 636x480-ABGR8888\n>>  * Pixelformat: ABGR8888 (2x2)-(1628x1224)/(+0,+0)\n>> [0:12:04.643438097] [3837] ERROR Stream stream.cpp:215 Range format is ambiguous\n>>  * Pixelformat: XBGR8888 (2x2)-(1628x1224)/(+0,+0)\n>> [0:12:04.643696229] [3837] ERROR Stream stream.cpp:215 Range format is ambiguous\n>>  * Pixelformat: BGR888 (2x2)-(1628x1224)/(+0,+0)\n>> [0:12:04.643748792] [3837] ERROR Stream stream.cpp:215 Range format is ambiguous\n>>  * Pixelformat: RGB888 (2x2)-(1628x1224)/(+0,+0)\n>> [0:12:04.643861237] [3837] ERROR Stream stream.cpp:215 Range format is ambiguous\n>>  * Pixelformat: ARGB8888 (2x2)-(1628x1224)/(+0,+0)\n>> [0:12:04.643918479] [3837] ERROR Stream stream.cpp:215 Range format is ambiguous\n>>  * Pixelformat: XRGB8888 (2x2)-(1628x1224)/(+0,+0)\n>> [0:12:04.643971162] [3837] ERROR Stream stream.cpp:215 Range format is ambiguous\n>\n> Interestingly I don't see the same on the OP6 - i.e. not every sensor appears to be affected.\n>\n> On 20.03.25 23:43, Kieran Bingham wrote:\n>> Quoting Milan Zamazal (2025-03-05 19:26:12)\n>>> When generating simple pipeline configuration, raw output configurations\n>>> are generated but later filtered out.  Let's include processed and/or\n>>> raw output configurations depending on the requested stream roles.\n>>>\n>>> Raw and processed formats are handled separately.  The intention is that\n>>> in case both raw and processed formats are requested then the raw\n>>> formats should be left intact to the extent possible and not be\n>>> influenced by the processed formats (implying that raw parameters\n>>> compatible with the processed output requirements must be requested by\n>>> the application).\n>>>\n>>> Raw output configurations are marked by setting their colorSpace to\n>>> ColorSpace::Raw, which is the only place there suitable for the purpose.\n>>>\n>>> This is another preparatory patch without making raw outputs working.\n>> I've identified two interesting effects which I've bisected to this\n>> patch:\n>>\n>> First:\n>>\n>> Without this patch on x13s:\n>>\n>> [libcamera] kbingham@charm:~/iob/libcamera/build/gcc$ cam -c1 --metadata -C10\n>> [1:44:39.464209549] [37696]  INFO IPAManager ipa_manager.cpp:137 libcamera is not installed. Adding '/home/kbingham/iob/libcamera/build/gcc/src/ipa' to the IPA search path\n>> [1:44:39.471858239] [37696]  INFO Camera camera_manager.cpp:327 libcamera v0.4.0+149-628e8c80\n>> [1:44:39.497573824] [37697]  WARN CameraSensor camera_sensor_legacy.cpp:616 'ov5675 24-0010': Rotation control not available, default to 0 degrees\n>> [1:44:39.502155101] [37697]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n>> [1:44:39.502180672] [37697]  WARN IPAProxy ipa_proxy.cpp:177 Configuration file 'ov5675.yaml' not found for IPA module 'simple', falling back to 'uncalibrated.yaml'\n>> [1:44:39.502468206] [37697]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n>> [1:44:39.512547578] [37697]  INFO Pipeline pipeline_handler.cpp:618 libcamera is not installed. Loading platform configuration file from '/home/kbingham/iob/libcamera/src/libcamera/pipeline/virtual/data/virtual.yaml'\n>> Using camera /base/soc@0/cci@ac4c000/i2c-bus@1/camera@10 as cam0\n>> [1:44:39.514127115] [37696]  INFO Camera camera.cpp:1203 configuring streams: (0) 2584x1944-ABGR8888\n>> [1:44:39.520536247] [37697]  WARN CameraSensor camera_sensor_legacy.cpp:501 'ov5675 24-0010': No sensor delays found in static properties. Assuming unverified defaults.\n>> [1:44:39.520899922] [37697]  INFO IPASoft soft_simple.cpp:251 IPASoft: Exposure 4-2016, gain 1-15.9922 (0.149922)\n>> cam0: Capture 10 frames\n>> 6279.664529 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 20093184\n>> \tSensorTimestamp = 6279664529000\n>> 6279.697607 (30.23 fps) cam0-stream0 seq: 000001 bytesused: 20093184\n>> \tSensorTimestamp = 6279697607000\n>> 6279.731336 (29.65 fps) cam0-stream0 seq: 000002 bytesused: 20093184\n>> \tSensorTimestamp = 6279731336000\n>> 6279.831491 (9.98 fps) cam0-stream0 seq: 000003 bytesused: 20093184\n>> \tSensorTimestamp = 6279831491000\n>> 6279.898368 (14.95 fps) cam0-stream0 seq: 000004 bytesused: 20093184\n>> \tSensorTimestamp = 6279898368000\n>> 6279.965133 (14.98 fps) cam0-stream0 seq: 000005 bytesused: 20093184\n>> \tSensorTimestamp = 6279965133000\n>> 6280.031911 (14.97 fps) cam0-stream0 seq: 000006 bytesused: 20093184\n>> \tSensorTimestamp = 6280031911000\n>> 6280.098577 (15.00 fps) cam0-stream0 seq: 000007 bytesused: 20093184\n>> \tSensorTimestamp = 6280098577000\n>> 6280.165320 (14.98 fps) cam0-stream0 seq: 000008 bytesused: 20093184\n>> \tSensorTimestamp = 6280165320000\n>> 6280.232225 (14.95 fps) cam0-stream0 seq: 000009 bytesused: 20093184\n>> \tSensorTimestamp = 6280232225000\n>>\n>> (Note the 15 FPS), and pipewire/gstreamer/cheese are all 'streaming'...\n>>\n>>\n>> But with this patch the rate jumps to a more reasonable 30 FPS seen by\n>> qcam and cam:\n>>\n>> [libcamera] kbingham@charm:~/iob/libcamera/build/gcc$ cam -c1 --metadata -C10\n>> [1:46:59.040578435] [38346]  INFO IPAManager ipa_manager.cpp:137 libcamera is not installed. Adding '/home/kbingham/iob/libcamera/build/gcc/src/ipa' to the IPA search path\n>> [1:46:59.048420757] [38346]  INFO Camera camera_manager.cpp:327 libcamera v0.4.0+150-d0e1caa0\n>> [1:46:59.074259713] [38347]  WARN CameraSensor camera_sensor_legacy.cpp:616 'ov5675 24-0010': Rotation control not available, default to 0 degrees\n>> [1:46:59.078796773] [38347]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n>> [1:46:59.078822605] [38347]  WARN IPAProxy ipa_proxy.cpp:177 Configuration file 'ov5675.yaml' not found for IPA module 'simple', falling back to 'uncalibrated.yaml'\n>> [1:46:59.079110243] [38347]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n>> [1:46:59.087987917] [38347]  INFO Pipeline pipeline_handler.cpp:618 libcamera is not installed. Loading platform configuration file from '/home/kbingham/iob/libcamera/src/libcamera/pipeline/virtual/data/virtual.yaml'\n>> Using camera /base/soc@0/cci@ac4c000/i2c-bus@1/camera@10 as cam0\n>> [1:46:59.089522196] [38346]  INFO Camera camera.cpp:1203 configuring streams: (0) 1288x972-ABGR8888\n>> [1:46:59.096422962] [38347]  WARN CameraSensor camera_sensor_legacy.cpp:501 'ov5675 24-0010': No sensor delays found in static properties. Assuming unverified defaults.\n>> [1:46:59.096786533] [38347]  INFO IPASoft soft_simple.cpp:251 IPASoft: Exposure 4-2016, gain 1-15.9922 (0.149922)\n>> cam0: Capture 10 frames\n>> 6419.234779 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 5007744\n>> \tSensorTimestamp = 6419234779000\n>> 6419.268213 (29.91 fps) cam0-stream0 seq: 000001 bytesused: 5007744\n>> \tSensorTimestamp = 6419268213000\n>> 6419.301359 (30.17 fps) cam0-stream0 seq: 000002 bytesused: 5007744\n>> \tSensorTimestamp = 6419301359000\n>> 6419.334744 (29.95 fps) cam0-stream0 seq: 000003 bytesused: 5007744\n>> \tSensorTimestamp = 6419334744000\n>> 6419.368129 (29.95 fps) cam0-stream0 seq: 000004 bytesused: 5007744\n>> \tSensorTimestamp = 6419368129000\n>> 6419.401516 (29.95 fps) cam0-stream0 seq: 000005 bytesused: 5007744\n>> \tSensorTimestamp = 6419401516000\n>> 6419.434902 (29.95 fps) cam0-stream0 seq: 000006 bytesused: 5007744\n>> \tSensorTimestamp = 6419434902000\n>> 6419.468289 (29.95 fps) cam0-stream0 seq: 000007 bytesused: 5007744\n>> \tSensorTimestamp = 6419468289000\n>> 6419.501673 (29.95 fps) cam0-stream0 seq: 000008 bytesused: 5007744\n>> \tSensorTimestamp = 6419501673000\n>> 6419.535058 (29.95 fps) cam0-stream0 seq: 000009 bytesused: 5007744\n>> \tSensorTimestamp = 6419535058000\n>>\n>>\n>> But alas I note that now gstreamer (and cheese, and pipewire) now fail:\n>>\n>> [libcamera] kbingham@charm:~/iob/libcamera/build/gcc$ gst-launch-1.0 libcamerasrc ! autovideosink\n>> Setting pipeline to PAUSED ...\n>> [1:46:09.897725501] [38325]  INFO IPAManager ipa_manager.cpp:137 libcamera is not installed. Adding '/home/kbingham/iob/libcamera/build/gcc/src/ipa' to the IPA search path\n>> [1:46:09.903176776] [38325]  INFO Camera camera_manager.cpp:327 libcamera v0.4.0+150-d0e1caa0\n>> [1:46:09.935374613] [38330]  WARN CameraSensor camera_sensor_legacy.cpp:616 'ov5675 24-0010': Rotation control not available, default to 0 degrees\n>> [1:46:09.941677813] [38330]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n>> [1:46:09.941734112] [38330]  WARN IPAProxy ipa_proxy.cpp:177 Configuration file 'ov5675.yaml' not found for IPA module 'simple', falling back to 'uncalibrated.yaml'\n>> [1:46:09.942172574] [38330]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n>> [1:46:09.949343846] [38330]  INFO Pipeline pipeline_handler.cpp:618 libcamera is not installed. Loading platform configuration file from '/home/kbingham/iob/libcamera/src/libcamera/pipeline/virtual/data/virtual.yaml'\n>> Pipeline is live and does not need PREROLL ...\n>> Pipeline is PREROLLED ...\n>> Setting pipeline to PLAYING ...\n>> New clock: GstSystemClock\n>> [1:46:09.950895937] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n>> [1:46:09.950940309] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n>> [1:46:09.950962495] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n>> [1:46:09.950982129] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n>> [1:46:09.951001711] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n>> [1:46:09.951020564] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n>> ERROR: from element /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0: Internal data stream error.\n>> Additional debug info:\n>> ../../src/gstreamer/gstlibcamerasrc.cpp(662): gst_libcamera_src_task_enter (): /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0:\n>> streaming stopped, reason not-negotiated (-4)\n>> Execution ended after 0:00:00.000438306\n>> Setting pipeline to NULL ...\n>> Freeing pipeline ...\n>>\n>> Debugging a little, at stream.ccp:215\n>>\n>> diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\n>> index 978d72752b00..22f348c2df87 100644\n>> --- a/src/libcamera/stream.cpp\n>> +++ b/src/libcamera/stream.cpp\n>> @@ -213,6 +213,8 @@ std::vector<Size> StreamFormats::sizes(const PixelFormat &pixelformat) const\n>>          if (!discrete) {\n>>                  if (ranges.size() != 1) {\n>>                          LOG(Stream, Error) << \"Range format is ambiguous\";\n>> +                       for (auto range: ranges)\n>> +                               LOG(Stream, Error) << range;\n>>                          return {};\n>>                  }\n>>\n>> Reports:\n>>\n>> [1:51:01.855863590] [40484] ERROR Stream stream.cpp:215 Range format is ambiguous\n>> [1:51:01.855901452] [40484] ERROR Stream stream.cpp:217 (4x2)-(1288x972)/(+4,+2)\n>> [1:51:01.855920305] [40484] ERROR Stream stream.cpp:217 (4x2)-(2584x1944)/(+4,+2)\n>>\n>> So we're somehow setting up the stream capabilities incorrectly here\n>> which breaks things... (note that ranges.size is 2, not 1?)\n>>\n>> Perhaps we're incorrectly adding the raw stream sizes to the processed stream\n>> sizes ?\n>>\n>> --\n>> Kieran\n>>\n>>\n>>> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n>>> ---\n>>>   src/libcamera/pipeline/simple/simple.cpp | 72 ++++++++++++++++--------\n>>>   1 file changed, 49 insertions(+), 23 deletions(-)\n>>>\n>>> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n>>> index 0c6e0f44..92b9608b 100644\n>>> --- a/src/libcamera/pipeline/simple/simple.cpp\n>>> +++ b/src/libcamera/pipeline/simple/simple.cpp\n>>> @@ -25,6 +25,7 @@\n>>>   #include <libcamera/base/log.h>\n>>>     #include <libcamera/camera.h>\n>>> +#include <libcamera/color_space.h>\n>>>   #include <libcamera/control_ids.h>\n>>>   #include <libcamera/pixel_format.h>\n>>>   #include <libcamera/request.h>\n>>> @@ -389,6 +390,8 @@ private:\n>>>          const MediaPad *acquirePipeline(SimpleCameraData *data);\n>>>          void releasePipeline(SimpleCameraData *data);\n>>>   +       void setUpFormatSizes(std::map<PixelFormat, std::vector<SizeRange>> formats);\n>>> +\n>>>          std::map<const MediaEntity *, EntityData> entities_;\n>>>            MediaDevice *converter_;\n>>> @@ -1191,15 +1194,56 @@ SimplePipelineHandler::generateConfiguration(Camera *camera, Span<const StreamRo\n>>>                          data->processedRequested_ = true;\n>>>                  }\n>>>   -       /* Create the formats map. */\n>>> -       std::map<PixelFormat, std::vector<SizeRange>> formats;\n>>> +       /* Create the formats maps. */\n>>> +       std::map<PixelFormat, std::vector<SizeRange>> processedFormats;\n>>> +       std::map<PixelFormat, std::vector<SizeRange>> rawFormats;\n>>>            for (const SimpleCameraData::Configuration &cfg : data->configs_)\n>>> -               if (!cfg.raw)\n>>> -                       for (PixelFormat format : cfg.outputFormats)\n>>> -                               formats[format].push_back(cfg.outputSizes);\n>>> +               for (PixelFormat format : cfg.outputFormats)\n>>> +                       (cfg.raw ? rawFormats : processedFormats)[format].push_back(cfg.outputSizes);\n>>> +\n>>> +       if (data->processedRequested_ && processedFormats.empty()) {\n>>> +               LOG(SimplePipeline, Error)\n>>> +                       << \"Processed stream requsted but no corresponding output configuration found\";\n>>> +               return nullptr;\n>>> +       }\n>>> +       if (data->rawRequested_ && rawFormats.empty()) {\n>>> +               LOG(SimplePipeline, Error)\n>>> +                       << \"Raw stream requsted but no corresponding output configuration found\";\n>>> +               return nullptr;\n>>> +       }\n>>> +\n>>> +       setUpFormatSizes(processedFormats);\n>>> +       setUpFormatSizes(rawFormats);\n>>> +\n>>> +       /*\n>>> +        * Create the stream configurations. Take the first entry in the formats\n>>> +        * map as the default, for lack of a better option.\n>>> +        *\n>>> +        * \\todo Implement a better way to pick the default format\n>>> +        */\n>>> +       for (StreamRole role : roles) {\n>>> +               bool raw = (role == StreamRole::Raw);\n>>> +               auto formats = (raw ? rawFormats : processedFormats);\n>>> +               StreamConfiguration cfg{ StreamFormats{ formats } };\n>>> +               cfg.pixelFormat = formats.begin()->first;\n>>> +               cfg.size = formats.begin()->second[0].max;\n>>> +               if (raw)\n>>> +                       cfg.colorSpace = ColorSpace::Raw;\n>>> +\n>>> +               config->addConfiguration(cfg);\n>>> +       }\n>>> +\n>>> +       config->validate();\n>>> +\n>>> +       return config;\n>>> +}\n>>>   +void SimplePipelineHandler::setUpFormatSizes(\n>>> +       std::map<PixelFormat, std::vector<SizeRange>> formats)\n>>> +{\n>>>          /* Sort the sizes and merge any consecutive overlapping ranges. */\n>>> +\n>>>          for (auto &[format, sizes] : formats) {\n>>>                  std::sort(sizes.begin(), sizes.end(),\n>>>                            [](SizeRange &a, SizeRange &b) {\n>>> @@ -1219,24 +1263,6 @@ SimplePipelineHandler::generateConfiguration(Camera *camera, Span<const StreamRo\n>>>                    sizes.erase(++cur, sizes.end());\n>>>          }\n>>> -\n>>> -       /*\n>>> -        * Create the stream configurations. Take the first entry in the formats\n>>> -        * map as the default, for lack of a better option.\n>>> -        *\n>>> -        * \\todo Implement a better way to pick the default format\n>>> -        */\n>>> -       for ([[maybe_unused]] StreamRole role : roles) {\n>>> -               StreamConfiguration cfg{ StreamFormats{ formats } };\n>>> -               cfg.pixelFormat = formats.begin()->first;\n>>> -               cfg.size = formats.begin()->second[0].max;\n>>> -\n>>> -               config->addConfiguration(cfg);\n>>> -       }\n>>> -\n>>> -       config->validate();\n>>> -\n>>> -       return config;\n>>>   }\n>>>     int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n>>> -- 2.48.1\n>>>","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 B0A15C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Apr 2025 18:44:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0164568994;\n\tWed,  2 Apr 2025 20:44:07 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EE0D36897E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Apr 2025 20:44:04 +0200 (CEST)","from mail-wm1-f71.google.com (mail-wm1-f71.google.com\n\t[209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-99-oPlQNTaiPvKfjvdvdZtf2g-1; Wed, 02 Apr 2025 14:44:02 -0400","by mail-wm1-f71.google.com with SMTP id\n\t5b1f17b1804b1-43ea256f039so500925e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 02 Apr 2025 11:44:02 -0700 (PDT)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-43eb6190bb9sm28787165e9.29.2025.04.02.11.43.59\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 02 Apr 2025 11:43:59 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"DUjlniMC\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1743619443;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=BaKczFj9XBJ0zOZ2c+9zaiMEkWRo8A0QviIH+vFHxZU=;\n\tb=DUjlniMCgOEcip91OOKAyjUKjg3wuudey5DnzLHxqEpH/4uxrTh+418tuReX26yfDs0raw\n\tIG2vpMMHYHeyEhfmB4lWFST5sG3XdRQmbaAcLQfCPksC/Yfq1xts/BQdJVyVo4Ao5+VxPe\n\tE8VWzLDf+fY3XH7oa/zvugF4OVZfcPI=","X-MC-Unique":"oPlQNTaiPvKfjvdvdZtf2g-1","X-Mimecast-MFC-AGG-ID":"oPlQNTaiPvKfjvdvdZtf2g_1743619441","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1743619441; x=1744224241;\n\th=content-transfer-encoding:mime-version:user-agent:message-id:date\n\t:references:in-reply-to:subject:cc:to:from:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=LRDkISft5zgianfAVhteXOa2oCOjWlqFwCiYcg9sCDw=;\n\tb=RzVT8z4Fn+PfKlPlk8x9VWkV4RHTCZjmumWJ/sBdEntzzNczyDNFY57HxKspLzH0Cg\n\tpscRB+GQIuwfbGiGBaVQO8Gnw5qMyZH0dUtBeAIQFKH0ARyyPNd9UepaDaLcDhtSnxx5\n\tLNuID6NMGyFW8VIoLH469XislB4MOpTGfGu3MYlvZtJlX5P9qtA1Z68w3FUkO/pa5uOD\n\trAU8ruWdeWsSvihL7TbWDMYtkJxXKusLqrLdkp02SBZFdWejpn5t/WVx9/ShCFy6lyGQ\n\tH/U+x1KqTCqxdIJcsakw5CdcJ4Ck/YnS0Ug8pSR+AUgyB9NFALK3bPgSIplAHp7aFmym\n\tD7Mw==","X-Gm-Message-State":"AOJu0YyNxFSKvQe/94pJYbk3IdX627XsjuWnHEovG3hbyDcT+YVJIW3s\n\tZhazTAXfR4WqFVd+Ni5aTV5nrVldfQondaanSD+ReS0h666vizitJvaWJZ0NjT9tX2mJHFWhWJ5\n\tFoSjUowImyseLtmU2A2NPhE/wswBMmb09/lAI5VCAVf5gMEYq4qnMEXajOrwT62TnQVbtzutCHH\n\t+UFeF2h2RQZmrj+9stQECKswaVmuXwU9HYUImdYBJL4qHbogPY9UQr+Zz9/w==","X-Gm-Gg":"ASbGncuhxsnl2SpFLcUru+GrbNETNMGzEAz8SKulN2mmexYN0elhc5S5dXkosAwt1mN\n\ttRaaPeJRVCYp+cc/85+8M8TVCrKUYeP6eG+R15UaPk+LD5e9ak6plnXVkBF8vd6gs/YEbPw9BYz\n\tcjK6FOOncyRoOL6EX3qEFkVLW6jUjKEQ0BbBQ4bE5yFul4WgNo1/uR7Xn28gIOWmBXbHvDhKfy6\n\t4qDmzPxoUSbItAGWmIM1AV7mKHLn5YbDPgwsKx1A2FRx5fwRLZJ1hTxldbZNgVKgtiln28gNFsE\n\t81gVw/80V+FB9VFL2ZW4gw5o1WP4QRN4gbjRBsFBFca7R/JrLMYwii85ySBkTAciWYSN","X-Received":["by 2002:a05:600c:1f17:b0:439:643a:c8d5 with SMTP id\n\t5b1f17b1804b1-43e99ab533cmr156200035e9.0.1743619440849; \n\tWed, 02 Apr 2025 11:44:00 -0700 (PDT)","by 2002:a05:600c:1f17:b0:439:643a:c8d5 with SMTP id\n\t5b1f17b1804b1-43e99ab533cmr156199645e9.0.1743619440250; \n\tWed, 02 Apr 2025 11:44:00 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IFophN9H+UJMCpVea8P4FUcRb/Q4x6o6O9fba61O7uk3Ny0R+Dlf21ze/FIVV+4OXyIWVgJtg==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Robert Mader <robert.mader@collabora.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v3 5/8] libcamera: simple: Consider raw output\n\tconfigurations","In-Reply-To":"<df9758f6-46b9-4db1-97e5-79680db3ddc7@collabora.com> (Robert\n\tMader's message of \"Wed, 26 Mar 2025 23:54:41 +0100\")","References":"<20250305192617.18361-1-mzamazal@redhat.com>\n\t<20250305192617.18361-6-mzamazal@redhat.com>\n\t<174251063991.2222410.7500950803669680754@ping.linuxembedded.co.uk>\n\t<df9758f6-46b9-4db1-97e5-79680db3ddc7@collabora.com>","Date":"Wed, 02 Apr 2025 20:43:59 +0200","Message-ID":"<85mscyv1xs.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"TaB0A-sD7PMBQP-3RPBveRmDU9LRsN5V43PzPfh-uYA_1743619441","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":33901,"web_url":"https://patchwork.libcamera.org/comment/33901/","msgid":"<174361997340.4076747.13551042003308371893@ping.linuxembedded.co.uk>","date":"2025-04-02T18:52:53","subject":"Re: [PATCH v3 5/8] libcamera: simple: Consider raw output\n\tconfigurations","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Milan Zamazal (2025-04-02 19:31:02)\n> Hi Kieran,\n> \n> thank you for testing.\n> \n> Kieran Bingham <kieran.bingham@ideasonboard.com> writes:\n> \n> > Quoting Milan Zamazal (2025-03-05 19:26:12)\n> >> When generating simple pipeline configuration, raw output configurations\n> >> are generated but later filtered out.  Let's include processed and/or\n> >> raw output configurations depending on the requested stream roles.\n> >> \n> >> Raw and processed formats are handled separately.  The intention is that\n> >> in case both raw and processed formats are requested then the raw\n> >> formats should be left intact to the extent possible and not be\n> >> influenced by the processed formats (implying that raw parameters\n> >> compatible with the processed output requirements must be requested by\n> >> the application).\n> >> \n> >> Raw output configurations are marked by setting their colorSpace to\n> >> ColorSpace::Raw, which is the only place there suitable for the purpose.\n> >> \n> >> This is another preparatory patch without making raw outputs working.\n> >\n> > I've identified two interesting effects which I've bisected to this\n> > patch:\n> >\n> > First:\n> >\n> > Without this patch on x13s:\n> >\n> > [libcamera] kbingham@charm:~/iob/libcamera/build/gcc$ cam -c1 --metadata -C10\n> > [1:44:39.464209549] [37696]  INFO IPAManager ipa_manager.cpp:137 libcamera is not installed. Adding '/home/kbingham/iob/libcamera/build/gcc/src/ipa' to the IPA search path\n> > [1:44:39.471858239] [37696]  INFO Camera camera_manager.cpp:327 libcamera v0.4.0+149-628e8c80\n> > [1:44:39.497573824] [37697]  WARN CameraSensor camera_sensor_legacy.cpp:616 'ov5675 24-0010': Rotation control not available, default to 0 degrees\n> > [1:44:39.502155101] [37697]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n> > [1:44:39.502180672] [37697]  WARN IPAProxy ipa_proxy.cpp:177 Configuration file 'ov5675.yaml' not found for IPA module 'simple', falling back to 'uncalibrated.yaml'\n> > [1:44:39.502468206] [37697]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n> > [1:44:39.512547578] [37697]  INFO Pipeline pipeline_handler.cpp:618 libcamera is not installed. Loading platform configuration file from '/home/kbingham/iob/libcamera/src/libcamera/pipeline/virtual/data/virtual.yaml'\n> > Using camera /base/soc@0/cci@ac4c000/i2c-bus@1/camera@10 as cam0\n> > [1:44:39.514127115] [37696]  INFO Camera camera.cpp:1203 configuring streams: (0) 2584x1944-ABGR8888\n> > [1:44:39.520536247] [37697]  WARN CameraSensor camera_sensor_legacy.cpp:501 'ov5675 24-0010': No sensor delays found in static properties. Assuming unverified defaults.\n> > [1:44:39.520899922] [37697]  INFO IPASoft soft_simple.cpp:251 IPASoft: Exposure 4-2016, gain 1-15.9922 (0.149922)\n> > cam0: Capture 10 frames\n> > 6279.664529 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 20093184\n> >       SensorTimestamp = 6279664529000\n> > 6279.697607 (30.23 fps) cam0-stream0 seq: 000001 bytesused: 20093184\n> >       SensorTimestamp = 6279697607000\n> > 6279.731336 (29.65 fps) cam0-stream0 seq: 000002 bytesused: 20093184\n> >       SensorTimestamp = 6279731336000\n> > 6279.831491 (9.98 fps) cam0-stream0 seq: 000003 bytesused: 20093184\n> >       SensorTimestamp = 6279831491000\n> > 6279.898368 (14.95 fps) cam0-stream0 seq: 000004 bytesused: 20093184\n> >       SensorTimestamp = 6279898368000\n> > 6279.965133 (14.98 fps) cam0-stream0 seq: 000005 bytesused: 20093184\n> >       SensorTimestamp = 6279965133000\n> > 6280.031911 (14.97 fps) cam0-stream0 seq: 000006 bytesused: 20093184\n> >       SensorTimestamp = 6280031911000\n> > 6280.098577 (15.00 fps) cam0-stream0 seq: 000007 bytesused: 20093184\n> >       SensorTimestamp = 6280098577000\n> > 6280.165320 (14.98 fps) cam0-stream0 seq: 000008 bytesused: 20093184\n> >       SensorTimestamp = 6280165320000\n> > 6280.232225 (14.95 fps) cam0-stream0 seq: 000009 bytesused: 20093184\n> >       SensorTimestamp = 6280232225000\n> >\n> > (Note the 15 FPS), and pipewire/gstreamer/cheese are all 'streaming'...\n> >\n> >\n> > But with this patch the rate jumps to a more reasonable 30 FPS seen by\n> > qcam and cam:\n> \n> Well, clearly because of the lower resolution.  I don't have an\n> explanation why the patch should make it different.\n\nAha - I completley missed that! But yes, that's a good reason at least\nfor the speed difference ;-)\n\n\n> \n> > [libcamera] kbingham@charm:~/iob/libcamera/build/gcc$ cam -c1 --metadata -C10\n> > [1:46:59.040578435] [38346]  INFO IPAManager ipa_manager.cpp:137 libcamera is not installed. Adding '/home/kbingham/iob/libcamera/build/gcc/src/ipa' to the IPA search path\n> > [1:46:59.048420757] [38346]  INFO Camera camera_manager.cpp:327 libcamera v0.4.0+150-d0e1caa0\n> > [1:46:59.074259713] [38347]  WARN CameraSensor camera_sensor_legacy.cpp:616 'ov5675 24-0010': Rotation control not available, default to 0 degrees\n> > [1:46:59.078796773] [38347]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n> > [1:46:59.078822605] [38347]  WARN IPAProxy ipa_proxy.cpp:177 Configuration file 'ov5675.yaml' not found for IPA module 'simple', falling back to 'uncalibrated.yaml'\n> > [1:46:59.079110243] [38347]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n> > [1:46:59.087987917] [38347]  INFO Pipeline pipeline_handler.cpp:618 libcamera is not installed. Loading platform configuration file from '/home/kbingham/iob/libcamera/src/libcamera/pipeline/virtual/data/virtual.yaml'\n> > Using camera /base/soc@0/cci@ac4c000/i2c-bus@1/camera@10 as cam0\n> > [1:46:59.089522196] [38346]  INFO Camera camera.cpp:1203 configuring streams: (0) 1288x972-ABGR8888\n> > [1:46:59.096422962] [38347]  WARN CameraSensor camera_sensor_legacy.cpp:501 'ov5675 24-0010': No sensor delays found in static properties. Assuming unverified defaults.\n> > [1:46:59.096786533] [38347]  INFO IPASoft soft_simple.cpp:251 IPASoft: Exposure 4-2016, gain 1-15.9922 (0.149922)\n> > cam0: Capture 10 frames\n> > 6419.234779 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 5007744\n> >       SensorTimestamp = 6419234779000\n> > 6419.268213 (29.91 fps) cam0-stream0 seq: 000001 bytesused: 5007744\n> >       SensorTimestamp = 6419268213000\n> > 6419.301359 (30.17 fps) cam0-stream0 seq: 000002 bytesused: 5007744\n> >       SensorTimestamp = 6419301359000\n> > 6419.334744 (29.95 fps) cam0-stream0 seq: 000003 bytesused: 5007744\n> >       SensorTimestamp = 6419334744000\n> > 6419.368129 (29.95 fps) cam0-stream0 seq: 000004 bytesused: 5007744\n> >       SensorTimestamp = 6419368129000\n> > 6419.401516 (29.95 fps) cam0-stream0 seq: 000005 bytesused: 5007744\n> >       SensorTimestamp = 6419401516000\n> > 6419.434902 (29.95 fps) cam0-stream0 seq: 000006 bytesused: 5007744\n> >       SensorTimestamp = 6419434902000\n> > 6419.468289 (29.95 fps) cam0-stream0 seq: 000007 bytesused: 5007744\n> >       SensorTimestamp = 6419468289000\n> > 6419.501673 (29.95 fps) cam0-stream0 seq: 000008 bytesused: 5007744\n> >       SensorTimestamp = 6419501673000\n> > 6419.535058 (29.95 fps) cam0-stream0 seq: 000009 bytesused: 5007744\n> >       SensorTimestamp = 6419535058000\n> >\n> >\n> > But alas I note that now gstreamer (and cheese, and pipewire) now fail:\n> >\n> > [libcamera] kbingham@charm:~/iob/libcamera/build/gcc$ gst-launch-1.0 libcamerasrc ! autovideosink\n> > Setting pipeline to PAUSED ...\n> > [1:46:09.897725501] [38325]  INFO IPAManager ipa_manager.cpp:137 libcamera is not installed. Adding '/home/kbingham/iob/libcamera/build/gcc/src/ipa' to the IPA search path\n> > [1:46:09.903176776] [38325]  INFO Camera camera_manager.cpp:327 libcamera v0.4.0+150-d0e1caa0\n> > [1:46:09.935374613] [38330]  WARN CameraSensor camera_sensor_legacy.cpp:616 'ov5675 24-0010': Rotation control not available, default to 0 degrees\n> > [1:46:09.941677813] [38330]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n> > [1:46:09.941734112] [38330]  WARN IPAProxy ipa_proxy.cpp:177 Configuration file 'ov5675.yaml' not found for IPA module 'simple', falling back to 'uncalibrated.yaml'\n> > [1:46:09.942172574] [38330]  INFO IPAProxy ipa_proxy.cpp:151 libcamera is not installed. Loading IPA configuration from '/home/kbingham/iob/libcamera/src/ipa/simple/data'\n> > [1:46:09.949343846] [38330]  INFO Pipeline pipeline_handler.cpp:618 libcamera is not installed. Loading platform configuration file from '/home/kbingham/iob/libcamera/src/libcamera/pipeline/virtual/data/virtual.yaml'\n> > Pipeline is live and does not need PREROLL ...\n> > Pipeline is PREROLLED ...\n> > Setting pipeline to PLAYING ...\n> > New clock: GstSystemClock\n> > [1:46:09.950895937] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n> > [1:46:09.950940309] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n> > [1:46:09.950962495] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n> > [1:46:09.950982129] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n> > [1:46:09.951001711] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n> > [1:46:09.951020564] [38331] ERROR Stream stream.cpp:215 Range format is ambiguous\n> > ERROR: from element /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0: Internal data stream error.\n> > Additional debug info:\n> > ../../src/gstreamer/gstlibcamerasrc.cpp(662): gst_libcamera_src_task_enter (): /GstPipeline:pipeline0/GstLibcameraSrc:libcamerasrc0:\n> > streaming stopped, reason not-negotiated (-4)\n> > Execution ended after 0:00:00.000438306\n> > Setting pipeline to NULL ...\n> > Freeing pipeline ...\n> >\n> > Debugging a little, at stream.ccp:215\n> >\n> > diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\n> > index 978d72752b00..22f348c2df87 100644\n> > --- a/src/libcamera/stream.cpp\n> > +++ b/src/libcamera/stream.cpp\n> > @@ -213,6 +213,8 @@ std::vector<Size> StreamFormats::sizes(const PixelFormat &pixelformat) const\n> >         if (!discrete) {\n> >                 if (ranges.size() != 1) {\n> >                         LOG(Stream, Error) << \"Range format is ambiguous\";\n> > +                       for (auto range: ranges)\n> > +                               LOG(Stream, Error) << range;\n> >                         return {};\n> >                 }\n> >\n> > Reports:\n> >\n> > [1:51:01.855863590] [40484] ERROR Stream stream.cpp:215 Range format is ambiguous\n> > [1:51:01.855901452] [40484] ERROR Stream stream.cpp:217 (4x2)-(1288x972)/(+4,+2)\n> > [1:51:01.855920305] [40484] ERROR Stream stream.cpp:217 (4x2)-(2584x1944)/(+4,+2)\n> >\n> > So we're somehow setting up the stream capabilities incorrectly here\n> > which breaks things... (note that ranges.size is 2, not 1?)\n> >\n> > Perhaps we're incorrectly adding the raw stream sizes to the processed stream\n> > sizes ?\n> \n> No, it's a stupid (and not immediately visible) bug: passing formats to\n> setUpFormatSizes by value rather than by reference, see below.\n> \n> > --\n> > Kieran\n> >\n> >\n> >> \n> >> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> >> ---\n> >>  src/libcamera/pipeline/simple/simple.cpp | 72 ++++++++++++++++--------\n> >>  1 file changed, 49 insertions(+), 23 deletions(-)\n> >> \n> >> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\n> >> index 0c6e0f44..92b9608b 100644\n> >> --- a/src/libcamera/pipeline/simple/simple.cpp\n> >> +++ b/src/libcamera/pipeline/simple/simple.cpp\n> >> @@ -25,6 +25,7 @@\n> >>  #include <libcamera/base/log.h>\n> >>  \n> >>  #include <libcamera/camera.h>\n> >> +#include <libcamera/color_space.h>\n> >>  #include <libcamera/control_ids.h>\n> >>  #include <libcamera/pixel_format.h>\n> >>  #include <libcamera/request.h>\n> >> @@ -389,6 +390,8 @@ private:\n> >>         const MediaPad *acquirePipeline(SimpleCameraData *data);\n> >>         void releasePipeline(SimpleCameraData *data);\n> >>  \n> >> +       void setUpFormatSizes(std::map<PixelFormat, std::vector<SizeRange>> formats);\n> \n> Should be &formats.\n\nYikes - yeah - I wouldn't have noticed that either ;-)\n\nI'll retest my side this evening too.\n\n--\nKieran\n\n> \n> >> +\n> >>         std::map<const MediaEntity *, EntityData> entities_;\n> >>  \n> >>         MediaDevice *converter_;\n> >> @@ -1191,15 +1194,56 @@ SimplePipelineHandler::generateConfiguration(Camera *camera, Span<const StreamRo\n> >>                         data->processedRequested_ = true;\n> >>                 }\n> >>  \n> >> -       /* Create the formats map. */\n> >> -       std::map<PixelFormat, std::vector<SizeRange>> formats;\n> >> +       /* Create the formats maps. */\n> >> +       std::map<PixelFormat, std::vector<SizeRange>> processedFormats;\n> >> +       std::map<PixelFormat, std::vector<SizeRange>> rawFormats;\n> >>  \n> >>         for (const SimpleCameraData::Configuration &cfg : data->configs_)\n> >> -               if (!cfg.raw)\n> >> -                       for (PixelFormat format : cfg.outputFormats)\n> >> -                               formats[format].push_back(cfg.outputSizes);\n> >> +               for (PixelFormat format : cfg.outputFormats)\n> >> +                       (cfg.raw ? rawFormats : processedFormats)[format].push_back(cfg.outputSizes);\n> >> +\n> >> +       if (data->processedRequested_ && processedFormats.empty()) {\n> >> +               LOG(SimplePipeline, Error)\n> >> +                       << \"Processed stream requsted but no corresponding output configuration found\";\n> >> +               return nullptr;\n> >> +       }\n> >> +       if (data->rawRequested_ && rawFormats.empty()) {\n> >> +               LOG(SimplePipeline, Error)\n> >> +                       << \"Raw stream requsted but no corresponding output configuration found\";\n> >> +               return nullptr;\n> >> +       }\n> >> +\n> >> +       setUpFormatSizes(processedFormats);\n> >> +       setUpFormatSizes(rawFormats);\n> >> +\n> >> +       /*\n> >> +        * Create the stream configurations. Take the first entry in the formats\n> >> +        * map as the default, for lack of a better option.\n> >> +        *\n> >> +        * \\todo Implement a better way to pick the default format\n> >> +        */\n> >> +       for (StreamRole role : roles) {\n> >> +               bool raw = (role == StreamRole::Raw);\n> >> +               auto formats = (raw ? rawFormats : processedFormats);\n> >> +               StreamConfiguration cfg{ StreamFormats{ formats } };\n> >> +               cfg.pixelFormat = formats.begin()->first;\n> >> +               cfg.size = formats.begin()->second[0].max;\n> >> +               if (raw)\n> >> +                       cfg.colorSpace = ColorSpace::Raw;\n> >> +\n> >> +               config->addConfiguration(cfg);\n> >> +       }\n> >> +\n> >> +       config->validate();\n> >> +\n> >> +       return config;\n> >> +}\n> >>  \n> >> +void SimplePipelineHandler::setUpFormatSizes(\n> >> +       std::map<PixelFormat, std::vector<SizeRange>> formats)\n> \n> &formats\n> \n> >> +{\n> >>         /* Sort the sizes and merge any consecutive overlapping ranges. */\n> >> +\n> >>         for (auto &[format, sizes] : formats) {\n> >>                 std::sort(sizes.begin(), sizes.end(),\n> >>                           [](SizeRange &a, SizeRange &b) {\n> >> @@ -1219,24 +1263,6 @@ SimplePipelineHandler::generateConfiguration(Camera *camera, Span<const StreamRo\n> >>  \n> >>                 sizes.erase(++cur, sizes.end());\n> >>         }\n> >> -\n> >> -       /*\n> >> -        * Create the stream configurations. Take the first entry in the formats\n> >> -        * map as the default, for lack of a better option.\n> >> -        *\n> >> -        * \\todo Implement a better way to pick the default format\n> >> -        */\n> >> -       for ([[maybe_unused]] StreamRole role : roles) {\n> >> -               StreamConfiguration cfg{ StreamFormats{ formats } };\n> >> -               cfg.pixelFormat = formats.begin()->first;\n> >> -               cfg.size = formats.begin()->second[0].max;\n> >> -\n> >> -               config->addConfiguration(cfg);\n> >> -       }\n> >> -\n> >> -       config->validate();\n> >> -\n> >> -       return config;\n> >>  }\n> >>  \n> >>  int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n> >> -- \n> >> 2.48.1\n> >>\n>","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 B5CA8C3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  2 Apr 2025 18:52:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2338468985;\n\tWed,  2 Apr 2025 20:52:58 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 00C476897E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  2 Apr 2025 20:52:55 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CD3FF7E0;\n\tWed,  2 Apr 2025 20:51:02 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"n7vH0d7F\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1743619862;\n\tbh=hxYNvCtnktHuuqvtzXF1/WnBbhB2Hge5PmrpIeckwbA=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=n7vH0d7FeOgG9AB/82YVSdweuNXmVxQHkyXAgyCo6k4uKcTeyMal2Ql15md0jU8p3\n\tvmLkhuNxEMHZgZspovSkoU8YMWnzb7odY7Gy/dwG4RhIaZdZvmEhArJ+xWGuGSSQ5z\n\tHOqMt24dllrrlQYc6vSt3MOJhA0JgJuWCYIBuSTg=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<85r02av2jd.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","References":"<20250305192617.18361-1-mzamazal@redhat.com>\n\t<20250305192617.18361-6-mzamazal@redhat.com>\n\t<174251063991.2222410.7500950803669680754@ping.linuxembedded.co.uk>\n\t<85r02av2jd.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","Subject":"Re: [PATCH v3 5/8] libcamera: simple: Consider raw output\n\tconfigurations","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>","Date":"Wed, 02 Apr 2025 19:52:53 +0100","Message-ID":"<174361997340.4076747.13551042003308371893@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]