[{"id":4616,"web_url":"https://patchwork.libcamera.org/comment/4616/","msgid":"<20200428114928.3cvyyhpfgu2vnlmz@uno.localdomain>","date":"2020-04-28T11:49:28","subject":"Re: [libcamera-devel] [PATCH v5 2/7] libcamera: v4l2_videodevice:\n\tExpose setSelection()","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hello,\n\nOn Tue, Apr 28, 2020 at 11:19:29AM +0200, Jacopo Mondi wrote:\n> Expose V4L2Videodevice::setSelection() method and drop\n> V4L2Videodevice::setCrop() and V4L2Videodevice::setComopse() as wrapping\n> each target with a single function does not provide any benefit.\n>\n> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/include/v4l2_videodevice.h |  5 +----\n>  src/libcamera/v4l2_videodevice.cpp       | 20 +++-----------------\n>  2 files changed, 4 insertions(+), 21 deletions(-)\n>\n> diff --git a/src/libcamera/include/v4l2_videodevice.h b/src/libcamera/include/v4l2_videodevice.h\n> index a0409e59c08f..976ef9b6dc50 100644\n> --- a/src/libcamera/include/v4l2_videodevice.h\n> +++ b/src/libcamera/include/v4l2_videodevice.h\n> @@ -211,8 +211,7 @@ public:\n>  \tint setFormat(V4L2DeviceFormat *format);\n>  \tstd::map<V4L2PixelFormat, std::vector<SizeRange>> formats();\n>\n> -\tint setCrop(Rectangle *rect);\n> -\tint setCompose(Rectangle *rect);\n> +\tint setSelection(unsigned int target, Rectangle *rect);\n>\n>  \tint allocateBuffers(unsigned int count,\n>  \t\t\t    std::vector<std::unique_ptr<FrameBuffer>> *buffers);\n> @@ -254,8 +253,6 @@ private:\n>  \tstd::vector<V4L2PixelFormat> enumPixelformats();\n>  \tstd::vector<SizeRange> enumSizes(V4L2PixelFormat pixelFormat);\n>\n> -\tint setSelection(unsigned int target, Rectangle *rect);\n> -\n>  \tint requestBuffers(unsigned int count, enum v4l2_memory memoryType);\n>  \tint createBuffers(unsigned int count,\n>  \t\t\t  std::vector<std::unique_ptr<FrameBuffer>> *buffers);\n> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> index 8d642be0d05c..b16ab82c2807 100644\n> --- a/src/libcamera/v4l2_videodevice.cpp\n> +++ b/src/libcamera/v4l2_videodevice.cpp\n> @@ -1108,25 +1108,11 @@ std::vector<SizeRange> V4L2VideoDevice::enumSizes(V4L2PixelFormat pixelFormat)\n>  }\n>\n>  /**\n> - * \\brief Set a crop rectangle on the V4L2 video device node\n> - * \\param[inout] rect The rectangle describing the crop target area\n> + * \\brief Set a selection rectangle \\a rect for \\a target\n> + * \\param[in] target The selection target defined by the V4L2_SEL_TGT_* flags\n> + * \\param[inout] rect The selection rectangle to be applied\n\nJust noticed I haven't recorded Laurent's suggestion to create an enum\nfor targets.\n\nWill do before merging!\n\n>   * \\return 0 on success or a negative error code otherwise\n>   */\n> -int V4L2VideoDevice::setCrop(Rectangle *rect)\n> -{\n> -\treturn setSelection(V4L2_SEL_TGT_CROP, rect);\n> -}\n> -\n> -/**\n> - * \\brief Set a compose rectangle on the V4L2 video device node\n> - * \\param[inout] rect The rectangle describing the compose target area\n> - * \\return 0 on success or a negative error code otherwise\n> - */\n> -int V4L2VideoDevice::setCompose(Rectangle *rect)\n> -{\n> -\treturn setSelection(V4L2_SEL_TGT_COMPOSE, rect);\n> -}\n> -\n>  int V4L2VideoDevice::setSelection(unsigned int target, Rectangle *rect)\n>  {\n>  \tstruct v4l2_selection sel = {};\n> --\n> 2.26.1\n>","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 62F9460AF5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Apr 2020 13:46:19 +0200 (CEST)","from uno.localdomain (a-ur1-85.tin.it [212.216.150.148])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id E8C19100007;\n\tTue, 28 Apr 2020 11:46:17 +0000 (UTC)"],"Date":"Tue, 28 Apr 2020 13:49:28 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200428114928.3cvyyhpfgu2vnlmz@uno.localdomain>","References":"<20200428091934.341550-1-jacopo@jmondi.org>\n\t<20200428091934.341550-2-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200428091934.341550-2-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v5 2/7] libcamera: v4l2_videodevice:\n\tExpose setSelection()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Tue, 28 Apr 2020 11:46:19 -0000"}}]