[{"id":4593,"web_url":"https://patchwork.libcamera.org/comment/4593/","msgid":"<20200427233734.GF1165729@oden.dyn.berto.se>","date":"2020-04-27T23:37:34","subject":"Re: [libcamera-devel] [PATCH v4 2/7] libcamera: v4l2_videodevice:\n\tExpose setSelection()","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2020-04-27 23:32:31 +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> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\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>   * \\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> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x241.google.com (mail-lj1-x241.google.com\n\t[IPv6:2a00:1450:4864:20::241])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7F721603FB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Apr 2020 01:37:36 +0200 (CEST)","by mail-lj1-x241.google.com with SMTP id y4so19529260ljn.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Apr 2020 16:37:36 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tm13sm12507557lfk.12.2020.04.27.16.37.34\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 27 Apr 2020 16:37:35 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com header.b=\"rFi55plx\"; \n\tdkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=13bDKjYo5Bw4ce0OXIkBV8VGzLS+lvBdJfjEfQ6HZks=;\n\tb=rFi55plxcNr2x0tarjQVM/mcPF8k6zqY2GTOvyA47DVpPAWfSaCNP8osNH/2ylAenQ\n\tfbbtOWq0/8dz5xu3omCNK73NZ2vnklrI4ccE2IHdZQMkCf+lkOVC5gmhC55t9kYP75ko\n\t0uf0jx8qXefxkhlk5ae7aI/LEHJhPRfauAcFRYUAgcfe7xSKsCCC2RERCIHf7tuD8Pjl\n\tcDb4vp7MhN7zqe0fXQ2AGy8G3/8/4UKH9NtnGoKzz1l/Xmzp/6AerYkWrIrkC56kikvE\n\tQEoBBKPjYwBjhfEbQxQx2PYvziWLxStYWDfT2dXeGhJpfFH2x1aur4ItfIxLSxGRb+m4\n\tgPyw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=13bDKjYo5Bw4ce0OXIkBV8VGzLS+lvBdJfjEfQ6HZks=;\n\tb=rgPXZY2iA65ervccT1PsLwXGse82pHJhY/RLmxeWP2187yRSFjLIOYBe5MU9/8JLiZ\n\tIkAVDghN0sE94ze4hyGXmqq5QZHUAkTVhclIhAcQhufc1kagcwXWDz4AWz2keWeKHUSP\n\tf5SlqExqyTWoVoksNYPV9dIomF+FsemmGKYWP9Udi3pvVFQx2KJFYiWXJT/BiRKtWCul\n\tnEAicJXoIiih+Ke60S+S6sTYhnVrct7hCKnzH2SxNx4KolsczV1Sctkl6zwJUONFaDLn\n\tq+NMtldKarkH0Ua97imcINos2K+Rx++mOqlz+h7pRUPGFHmQm68nWzlSb8v6HiUUZ1C5\n\t9cZA==","X-Gm-Message-State":"AGi0PubA+o3HeM+VEST7lY4I9bMNWp0dzfx0MT3TTFeLXD/fhdRMn/5m\n\t9C0pGvV6SILgdFtcQyCg7PrBYj8drcs=","X-Google-Smtp-Source":"APiQypJpalpNAKRAEhOXbWilPgw1sRPp3kU0p/kZJMQWrtqrobevprcGg3VJ8hKuEU2jMhIfd9TCXg==","X-Received":"by 2002:a2e:89cf:: with SMTP id\n\tc15mr16024115ljk.149.1588030655862; \n\tMon, 27 Apr 2020 16:37:35 -0700 (PDT)","Date":"Tue, 28 Apr 2020 01:37:34 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200427233734.GF1165729@oden.dyn.berto.se>","References":"<20200427213236.333777-1-jacopo@jmondi.org>\n\t<20200427213236.333777-3-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200427213236.333777-3-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v4 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":"Mon, 27 Apr 2020 23:37:36 -0000"}},{"id":4599,"web_url":"https://patchwork.libcamera.org/comment/4599/","msgid":"<20200428013752.GB3579@pendragon.ideasonboard.com>","date":"2020-04-28T01:37:52","subject":"Re: [libcamera-devel] [PATCH v4 2/7] libcamera: v4l2_videodevice:\n\tExpose setSelection()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Mon, Apr 27, 2020 at 11:32:31PM +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> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\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>   * \\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 = {};","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0A6A9603F5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Apr 2020 03:38:08 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 92943583;\n\tTue, 28 Apr 2020 03:38:07 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"gqQd+B4m\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1588037887;\n\tbh=vNL4jyJkW7UcLzVq8bMN5Ll/SjFjxa1yjzdm4IqO8fo=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=gqQd+B4mfF315M58P5EfTR8fUdY1yjEOjCHidcznXI/tWRT2ZoUIUErS5SWk2tvUB\n\tSPoBIZqfWLClJcGlUBtFJU0rLoVM0vzGKD0bWCSrKPwmUOUBTVJYYATKwxPoEAVZuw\n\tN8AsMA2RfUo5pDzyonXcjcZQPsUzF9i/geQlPv6Y=","Date":"Tue, 28 Apr 2020 04:37:52 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200428013752.GB3579@pendragon.ideasonboard.com>","References":"<20200427213236.333777-1-jacopo@jmondi.org>\n\t<20200427213236.333777-3-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200427213236.333777-3-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v4 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 01:38:08 -0000"}}]