[{"id":36494,"web_url":"https://patchwork.libcamera.org/comment/36494/","msgid":"<176157892211.61331.16013694580537456992@isaac-ThinkPad-T16-Gen-2>","date":"2025-10-27T15:28:42","subject":"Re: [PATCH v2 12/35] libcamera: converter_v4l2_m2m: Add helper to\n\tapply controls","submitter":{"id":215,"url":"https://patchwork.libcamera.org/api/people/215/","name":"Isaac Scott","email":"isaac.scott@ideasonboard.com"},"content":"Hi Stefan,\n\nThank you for the patch!\n\nQuoting Stefan Klug (2025-10-23 15:48:13)\n> From: Umang Jain <umang.jain@ideasonboard.com>\n> \n> Add applyControls() helper to apply controls for a stream.\n> \n> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> \n> ---\n> \n> Changes in v2:\n> - Removed stray semicolon\n> - Added documentation\n> \n> Changes in v0.9\n> - Include request support in applyControls\n> ---\n>  .../internal/converter/converter_v4l2_m2m.h   |  5 +++\n>  .../converter/converter_v4l2_m2m.cpp          | 34 +++++++++++++++++++\n>  2 files changed, 39 insertions(+)\n> \n> diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h\n> index bc85bff7a07b..6d2453bb9e06 100644\n> --- a/include/libcamera/internal/converter/converter_v4l2_m2m.h\n> +++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h\n> @@ -24,6 +24,7 @@\n>  \n>  namespace libcamera {\n>  \n> +class ControlList;\n>  class FrameBuffer;\n>  class MediaDevice;\n>  class Size;\n> @@ -73,6 +74,8 @@ public:\n>         std::pair<Rectangle, Rectangle> inputCropBounds() override { return inputCropBounds_; }\n>         std::pair<Rectangle, Rectangle> inputCropBounds(const Stream *stream) override;\n>  \n> +       int applyControls(const Stream *stream, ControlList &ctrls, const V4L2Request *request = nullptr);\n> +\n>         int allocateRequests(unsigned int count,\n>                              std::vector<std::unique_ptr<V4L2Request>> *requests);\n>  \n> @@ -94,6 +97,8 @@ private:\n>                 int start();\n>                 void stop();\n>  \n> +               int applyControls(ControlList &ctrls, const V4L2Request *request = nullptr);\n> +\n\nReviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>\n\nBest wishes,\nIsaac\n\n>                 int queueBuffers(FrameBuffer *input, FrameBuffer *output,\n>                                  const V4L2Request *request = nullptr);\n>  \n> diff --git a/src/libcamera/converter/converter_v4l2_m2m.cpp b/src/libcamera/converter/converter_v4l2_m2m.cpp\n> index e57db8a438ab..48e49f143cf1 100644\n> --- a/src/libcamera/converter/converter_v4l2_m2m.cpp\n> +++ b/src/libcamera/converter/converter_v4l2_m2m.cpp\n> @@ -18,6 +18,7 @@\n>  #include <libcamera/base/signal.h>\n>  #include <libcamera/base/utils.h>\n>  \n> +#include <libcamera/controls.h>\n>  #include <libcamera/framebuffer.h>\n>  #include <libcamera/geometry.h>\n>  #include <libcamera/stream.h>\n> @@ -251,6 +252,20 @@ void V4L2M2MConverter::V4L2M2MStream::captureBufferReady(FrameBuffer *buffer)\n>         converter_->outputBufferReady.emit(buffer);\n>  }\n>  \n> +/**\n> + * \\brief Apply controls\n> + * \\param[in] ctrls The controls to apply\n> + * \\param[in] request An optional request\n> + *\n> + * \\return 0 on success or a negative error code otherwise\n> + * \\see V4L2Device::setControls()\n> + */\n> +int V4L2M2MConverter::V4L2M2MStream::applyControls(ControlList &ctrls,\n> +                                                  const V4L2Request *request)\n> +{\n> +       return m2m_->capture()->setControls(&ctrls, request);\n> +}\n> +\n>  /* -----------------------------------------------------------------------------\n>   * V4L2M2MConverter\n>   */\n> @@ -744,6 +759,25 @@ int V4L2M2MConverter::queueBuffers(FrameBuffer *input,\n>         return 0;\n>  }\n>  \n> +/**\n> + * \\brief Apply controls\n> + * \\param[in] stream The stream on which to apply the controls\n> + * \\param[in] ctrls The controls to apply\n> + * \\param[in] request An optional request\n> + *\n> + * \\return 0 on success or a negative error code otherwise\n> + * \\see V4L2Device::setControls()\n> + */\n> +int V4L2M2MConverter::applyControls(const Stream *stream, ControlList &ctrls,\n> +                                   const V4L2Request *request)\n> +{\n> +       auto iter = streams_.find(stream);\n> +       if (iter == streams_.end())\n> +               return -EINVAL;\n> +\n> +       return iter->second->applyControls(ctrls, request);\n> +}\n> +\n>  /**\n>   * \\copydoc libcamera::MediaDevice::allocateRequests\n>   */\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 24B23C3259\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Oct 2025 15:28:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 219B860765;\n\tMon, 27 Oct 2025 16:28:47 +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 A824E6069A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Oct 2025 16:28:45 +0100 (CET)","from thinkpad.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 9530DE1F;\n\tMon, 27 Oct 2025 16:26:57 +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=\"FNOxE2pX\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1761578817;\n\tbh=nFaiVKMAvzU5K/+pb+JcZvSwH/V7r2pKIvblHZ+SdT8=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=FNOxE2pXyfebdBlwdpNiYdU4EYfnVM1Ay/ugoiwfwnxUz8ePunp1uXEyaKkMXqCHo\n\tfGpJbhC915wn8theOT6RSYHFMCcRDvfddU8fvVn0vzhzRlgqyTzrgi9gHbuVudgiF4\n\tG9Fn4fP6FcbUXR2FVwoNOCRwsedZl2k4Qx8JRfew=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20251023144841.403689-13-stefan.klug@ideasonboard.com>","References":"<20251023144841.403689-1-stefan.klug@ideasonboard.com>\n\t<20251023144841.403689-13-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH v2 12/35] libcamera: converter_v4l2_m2m: Add helper to\n\tapply controls","From":"Isaac Scott <isaac.scott@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tUmang Jain <umang.jain@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 27 Oct 2025 15:28:42 +0000","Message-ID":"<176157892211.61331.16013694580537456992@isaac-ThinkPad-T16-Gen-2>","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":36713,"web_url":"https://patchwork.libcamera.org/comment/36713/","msgid":"<176236122202.2116251.14496705024297347590@neptunite.rasen.tech>","date":"2025-11-05T16:47:02","subject":"Re: [PATCH v2 12/35] libcamera: converter_v4l2_m2m: Add helper to\n\tapply controls","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Quoting Stefan Klug (2025-10-23 23:48:13)\n> From: Umang Jain <umang.jain@ideasonboard.com>\n> \n> Add applyControls() helper to apply controls for a stream.\n> \n> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> \n> ---\n> \n> Changes in v2:\n> - Removed stray semicolon\n> - Added documentation\n> \n> Changes in v0.9\n> - Include request support in applyControls\n> ---\n>  .../internal/converter/converter_v4l2_m2m.h   |  5 +++\n>  .../converter/converter_v4l2_m2m.cpp          | 34 +++++++++++++++++++\n>  2 files changed, 39 insertions(+)\n> \n> diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h\n> index bc85bff7a07b..6d2453bb9e06 100644\n> --- a/include/libcamera/internal/converter/converter_v4l2_m2m.h\n> +++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h\n> @@ -24,6 +24,7 @@\n>  \n>  namespace libcamera {\n>  \n> +class ControlList;\n>  class FrameBuffer;\n>  class MediaDevice;\n>  class Size;\n> @@ -73,6 +74,8 @@ public:\n>         std::pair<Rectangle, Rectangle> inputCropBounds() override { return inputCropBounds_; }\n>         std::pair<Rectangle, Rectangle> inputCropBounds(const Stream *stream) override;\n>  \n> +       int applyControls(const Stream *stream, ControlList &ctrls, const V4L2Request *request = nullptr);\n> +\n>         int allocateRequests(unsigned int count,\n>                              std::vector<std::unique_ptr<V4L2Request>> *requests);\n>  \n> @@ -94,6 +97,8 @@ private:\n>                 int start();\n>                 void stop();\n>  \n> +               int applyControls(ControlList &ctrls, const V4L2Request *request = nullptr);\n> +\n>                 int queueBuffers(FrameBuffer *input, FrameBuffer *output,\n>                                  const V4L2Request *request = nullptr);\n>  \n> diff --git a/src/libcamera/converter/converter_v4l2_m2m.cpp b/src/libcamera/converter/converter_v4l2_m2m.cpp\n> index e57db8a438ab..48e49f143cf1 100644\n> --- a/src/libcamera/converter/converter_v4l2_m2m.cpp\n> +++ b/src/libcamera/converter/converter_v4l2_m2m.cpp\n> @@ -18,6 +18,7 @@\n>  #include <libcamera/base/signal.h>\n>  #include <libcamera/base/utils.h>\n>  \n> +#include <libcamera/controls.h>\n>  #include <libcamera/framebuffer.h>\n>  #include <libcamera/geometry.h>\n>  #include <libcamera/stream.h>\n> @@ -251,6 +252,20 @@ void V4L2M2MConverter::V4L2M2MStream::captureBufferReady(FrameBuffer *buffer)\n>         converter_->outputBufferReady.emit(buffer);\n>  }\n>  \n> +/**\n> + * \\brief Apply controls\n> + * \\param[in] ctrls The controls to apply\n> + * \\param[in] request An optional request\n> + *\n> + * \\return 0 on success or a negative error code otherwise\n> + * \\see V4L2Device::setControls()\n> + */\n> +int V4L2M2MConverter::V4L2M2MStream::applyControls(ControlList &ctrls,\n> +                                                  const V4L2Request *request)\n> +{\n> +       return m2m_->capture()->setControls(&ctrls, request);\n> +}\n> +\n>  /* -----------------------------------------------------------------------------\n>   * V4L2M2MConverter\n>   */\n> @@ -744,6 +759,25 @@ int V4L2M2MConverter::queueBuffers(FrameBuffer *input,\n>         return 0;\n>  }\n>  \n> +/**\n> + * \\brief Apply controls\n> + * \\param[in] stream The stream on which to apply the controls\n> + * \\param[in] ctrls The controls to apply\n> + * \\param[in] request An optional request\n> + *\n> + * \\return 0 on success or a negative error code otherwise\n> + * \\see V4L2Device::setControls()\n> + */\n> +int V4L2M2MConverter::applyControls(const Stream *stream, ControlList &ctrls,\n> +                                   const V4L2Request *request)\n> +{\n> +       auto iter = streams_.find(stream);\n> +       if (iter == streams_.end())\n> +               return -EINVAL;\n> +\n> +       return iter->second->applyControls(ctrls, request);\n> +}\n> +\n>  /**\n>   * \\copydoc libcamera::MediaDevice::allocateRequests\n>   */\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 3A2B9C3259\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Nov 2025 16:47:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D673660AA4;\n\tWed,  5 Nov 2025 17:47:17 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 28E7060805\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Nov 2025 17:47:08 +0100 (CET)","from neptunite.rasen.tech (unknown\n\t[IPv6:2404:7a81:160:2100:d4d0:27ea:7a74:8a9e])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 59612129;\n\tWed,  5 Nov 2025 17:45:13 +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=\"aU3sidg7\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1762361113;\n\tbh=1a6ZNAqdrOOtsgdUL+22Ik+l9dhnQuqlG5WGUKpPKgc=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=aU3sidg7d8zXxeXQ5bZnSGejCqKGIBlT96gNt4H+jmxaDoi7RQz3QENKfvwO3+wOy\n\tYQJV6lw3aNZ1zWaoZ+RZ7PFxeDHx3cU/2wwH34SnpsvdGQfg9RJQcCgQnepNzLiqaX\n\tmKXCHu/r2TAfCMPQLZ3kwDupgrjNKrAyo226halo=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20251023144841.403689-13-stefan.klug@ideasonboard.com>","References":"<20251023144841.403689-1-stefan.klug@ideasonboard.com>\n\t<20251023144841.403689-13-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH v2 12/35] libcamera: converter_v4l2_m2m: Add helper to\n\tapply controls","From":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tUmang Jain <umang.jain@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 06 Nov 2025 01:47:02 +0900","Message-ID":"<176236122202.2116251.14496705024297347590@neptunite.rasen.tech>","User-Agent":"alot/0.0.0","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>"}}]