Patch Detail
Show a patch.
GET /api/1.1/patches/25600/?format=api
{ "id": 25600, "url": "https://patchwork.libcamera.org/api/1.1/patches/25600/?format=api", "web_url": "https://patchwork.libcamera.org/patch/25600/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20251217153808.3447066-1-barnabas.pocze@ideasonboard.com>", "date": "2025-12-17T15:38:08", "name": "[v1] Documentation: guides: pipeline-handler: Refresh", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "79c94dca9e0313e612b7bd252cd9890768e4c800", "submitter": { "id": 216, "url": "https://patchwork.libcamera.org/api/1.1/people/216/?format=api", "name": "Barnabás Pőcze", "email": "barnabas.pocze@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/25600/mbox/", "series": [ { "id": 5670, "url": "https://patchwork.libcamera.org/api/1.1/series/5670/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5670", "date": "2025-12-17T15:38:08", "name": "[v1] Documentation: guides: pipeline-handler: Refresh", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5670/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/25600/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/25600/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 828A1BD7D8\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 17 Dec 2025 15:38:14 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 56AD761A65;\n\tWed, 17 Dec 2025 16:38:13 +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 AF58E61A35\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Dec 2025 16:38:12 +0100 (CET)", "from pb-laptop.local (185.221.143.114.nat.pool.zt.hu\n\t[185.221.143.114])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0A59C581\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Dec 2025 16:38:06 +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=\"lr94zIYY\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1765985886;\n\tbh=wBfzfruHS7uomyPeixrft2ySl3U4dQ3uvqh9dRzwPwU=;\n\th=From:To:Subject:Date:From;\n\tb=lr94zIYYwPEjTZ7xm6OdaqQ/tmZDXqWjXgAPhZEbmCuVFCXVxylNQrEJTYcLlHRl9\n\tb5/cw1nYTKdDFs7838/03pklhKvrJ6BQx1rD/FxQ6gFamK4zga7u6nUDZopNRgZOJ1\n\t+ASZgvOYlg2RJWNKFke8yCzXtb2S205O3BFJqyOM=", "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[PATCH v1] Documentation: guides: pipeline-handler: Refresh", "Date": "Wed, 17 Dec 2025 16:38:08 +0100", "Message-ID": "<20251217153808.3447066-1-barnabas.pocze@ideasonboard.com>", "X-Mailer": "git-send-email 2.52.0", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "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>" }, "content": "Update the guide to be compatible with the current version of\nlibcamera, as well as sync the code snippets with [0].\n\nApart from libcamera related changes, `meson build` is replaced with\n`meson setup build`, and direct `ninja` calls are replaced with\n`meson compile -C build`.\n\n[0]: https://git.libcamera.org/libcamera/vivid.git\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n Documentation/guides/pipeline-handler.rst | 68 +++++++++++------------\n 1 file changed, 31 insertions(+), 37 deletions(-)", "diff": "diff --git a/Documentation/guides/pipeline-handler.rst b/Documentation/guides/pipeline-handler.rst\nindex 85d9cc870..deca75376 100644\n--- a/Documentation/guides/pipeline-handler.rst\n+++ b/Documentation/guides/pipeline-handler.rst\n@@ -170,7 +170,7 @@ a comma separated list with ``-Dpipelines`` when generating a build directory:\n \n .. code-block:: shell\n \n- meson build -Dpipelines=ipu3,uvcvideo,vivid\n+ meson setup build -Dpipelines=ipu3,uvcvideo,vivid\n \n Read the `Meson build configuration`_ documentation for more information on\n configuring a build directory.\n@@ -201,12 +201,12 @@ stub implementations for the overridden class members.\n public:\n PipelineHandlerVivid(CameraManager *manager);\n \n- CameraConfiguration *generateConfiguration(Camera *camera,\n- Span<const StreamRole> roles) override;\n+ std::unique_ptr<CameraConfiguration>\n+ generateConfiguration(Camera *camera, Span<const StreamRole> roles) override;\n int configure(Camera *camera, CameraConfiguration *config) override;\n \n int exportFrameBuffers(Camera *camera, Stream *stream,\n- std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;\n+ std::vector<std::unique_ptr<FrameBuffer>> *buffers) override;\n \n int start(Camera *camera, const ControlList *controls) override;\n void stopDevice(Camera *camera) override;\n@@ -293,8 +293,7 @@ Run the following commands:\n \n .. code-block:: shell\n \n- meson build\n- ninja -C build\n+ meson compile -C build\n \n To build the libcamera code base, and confirm that the build system found the\n new pipeline handler by running:\n@@ -307,7 +306,7 @@ And you should see output like the below:\n \n .. code-block:: shell\n \n- DEBUG Camera camera_manager.cpp:148 Found registered pipeline handler 'PipelineHandlerVivid'\n+ DEBUG Camera camera_manager.cpp:143 Found registered pipeline handler 'vivid\n \n Matching devices\n ~~~~~~~~~~~~~~~~\n@@ -352,7 +351,7 @@ Add the following below ``dm.add(\"vivid-000-vid-cap\");``:\n \n .. code-block:: cpp\n \n- MediaDevice *media = acquireMediaDevice(enumerator, dm);\n+ std::shared_ptr<MediaDevice> media = acquireMediaDevice(enumerator, dm);\n if (!media)\n return false;\n \n@@ -382,7 +381,7 @@ running\n \n .. code-block:: shell\n \n- ninja -C build\n+ meson compile -C build\n LIBCAMERA_LOG_LEVELS=Pipeline,VIVID:0 ./build/src/cam/cam -l\n \n And you should see output like the below:\n@@ -423,21 +422,15 @@ it will be used:\n class VividCameraData : public Camera::Private\n {\n public:\n- VividCameraData(PipelineHandler *pipe, MediaDevice *media)\n- : Camera::Private(pipe), media_(media), video_(nullptr)\n+ VividCameraData(PipelineHandler *pipe)\n+ : Camera::Private(pipe)\n {\n }\n \n- ~VividCameraData()\n- {\n- delete video_;\n- }\n-\n- int init();\n+ int init(const MediaDevice *media);\n void bufferReady(FrameBuffer *buffer);\n \n- MediaDevice *media_;\n- V4L2VideoDevice *video_;\n+ std::unique_ptr<V4L2VideoDevice> video_;\n Stream stream_;\n };\n \n@@ -466,9 +459,9 @@ open a single capture device named 'vivid-000-vid-cap' by the device.\n \n .. code-block:: cpp\n \n- int VividCameraData::init()\n+ int VividCameraData::init(const MediaDevice *media)\n {\n- video_ = new V4L2VideoDevice(media_->getEntityByName(\"vivid-000-vid-cap\"));\n+ video_ = std::make_unique<V4L2VideoDevice>(media->getEntityByName(\"vivid-000-vid-cap\"));\n if (video_->open())\n return -ENODEV;\n \n@@ -487,9 +480,9 @@ handler.\n \n .. code-block:: cpp\n \n- std::unique_ptr<VividCameraData> data = std::make_unique<VividCameraData>(this, media);\n+ std::unique_ptr<VividCameraData> data = std::make_unique<VividCameraData>(this);\n \n- if (data->init())\n+ if (data->init(media.get()))\n return false;\n \n \n@@ -506,7 +499,8 @@ PipelineHandler successfully matched and constructed a device.\n .. code-block:: cpp\n \n std::set<Stream *> streams{ &data->stream_ };\n- std::shared_ptr<Camera> camera = Camera::create(std::move(data), data->video_->deviceName(), streams);\n+ const char *id = data->video_->deviceName();\n+ std::shared_ptr<Camera> camera = Camera::create(std::move(data), id, streams);\n registerCamera(std::move(camera));\n \n return true;\n@@ -521,19 +515,20 @@ Our match function should now look like the following:\n \tDeviceMatch dm(\"vivid\");\n \tdm.add(\"vivid-000-vid-cap\");\n \n- \tMediaDevice *media = acquireMediaDevice(enumerator, dm);\n+ \tstd::shared_ptr<MediaDevice> media = acquireMediaDevice(enumerator, dm);\n \tif (!media)\n \t\treturn false;\n \n- \tstd::unique_ptr<VividCameraData> data = std::make_unique<VividCameraData>(this, media);\n+ \tstd::unique_ptr<VividCameraData> data = std::make_unique<VividCameraData>(this);\n \n \t/* Locate and open the capture video node. */\n- \tif (data->init())\n+ \tif (data->init(media.get()))\n \t\treturn false;\n \n \t/* Create and register the camera. */\n \tstd::set<Stream *> streams{ &data->stream_ };\n- \tstd::shared_ptr<Camera> camera = Camera::create(std::move(data), data->video_->deviceName(), streams);\n+ \tconst char *id = data->video_->deviceName();\n+ \tstd::shared_ptr<Camera> camera = Camera::create(std::move(data), id, streams);\n \tregisterCamera(std::move(camera));\n \n \treturn true;\n@@ -897,7 +892,7 @@ Add the following function implementation to your file:\n const std::vector<libcamera::PixelFormat> &formats = cfg.formats().pixelformats();\n if (std::find(formats.begin(), formats.end(), cfg.pixelFormat) == formats.end()) {\n cfg.pixelFormat = formats[0];\n- LOG(VIVID, Debug) << \"Adjusting format to \" << cfg.pixelFormat.toString();\n+ LOG(VIVID, Debug) << \"Adjusting format to \" << cfg.pixelFormat;\n status = Adjusted;\n }\n \n@@ -912,7 +907,7 @@ codebase, and test:\n \n .. code-block:: shell\n \n- ninja -C build\n+ meson compile -C build\n LIBCAMERA_LOG_LEVELS=Pipeline,VIVID:0 ./build/src/cam/cam -c vivid -I\n \n You should see the following output showing the capabilites of our new pipeline\n@@ -989,8 +984,9 @@ Add the following code beneath the code from above:\n \n .. code-block:: cpp\n \n+ const V4L2PixelFormat fourcc = data->video_->toV4L2PixelFormat(cfg.pixelFormat);\n V4L2DeviceFormat format = {};\n- format.fourcc = data->video_->toV4L2PixelFormat(cfg.pixelFormat);\n+ format.fourcc = fourcc;\n format.size = cfg.size;\n \n Set the video device format defined above using the\n@@ -1007,8 +1003,7 @@ Continue the implementation with the following code:\n if (ret)\n return ret;\n \n- if (format.size != cfg.size ||\n- format.fourcc != data->video_->toV4L2PixelFormat(cfg.pixelFormat))\n+ if (format.size != cfg.size || format.fourcc != fourcc)\n return -EINVAL;\n \n Finally, store and set stream-specific data reflecting the state of the stream.\n@@ -1262,8 +1257,7 @@ before being set.\n {\n ControlList controls(data->video_->controls());\n \n- for (auto it : request->controls()) {\n- unsigned int id = it.first;\n+ for (const auto &[id, v] : request->controls()) {\n unsigned int offset;\n uint32_t cid;\n \n@@ -1280,7 +1274,7 @@ before being set.\n continue;\n }\n \n- int32_t value = std::lround(it.second.get<float>() * 128 + offset);\n+ int32_t value = std::lround(v.get<float>() * 128 + offset);\n controls.set(cid, std::clamp(value, 0, 255));\n }\n \n@@ -1421,7 +1415,7 @@ capture through the pipeline through both of the cam and qcam utilities.\n \n .. code-block:: shell\n \n- ninja -C build\n+ meson compile -C build\n ./build/src/cam/cam -c vivid -C5\n \n To test that the pipeline handler can detect a device, and capture input.\n", "prefixes": [ "v1" ] }