[{"id":4594,"web_url":"https://patchwork.libcamera.org/comment/4594/","msgid":"<20200427234655.GG1165729@oden.dyn.berto.se>","date":"2020-04-27T23:46:55","subject":"Re: [libcamera-devel] [PATCH v4 3/7] libcamera: v4l2_subdevice:\n\tImplement getSelection()","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:32 +0200, Jacopo Mondi wrote:\n> Implement V4L2Subdevice::getSelection() to support retrieving selection\n> rectangles from the v4l2 subdevice.\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_subdevice.h |  2 ++\n>  src/libcamera/v4l2_subdevice.cpp       | 33 ++++++++++++++++++++++++++\n>  2 files changed, 35 insertions(+)\n> \n> diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\n> index 9a5c812db9b6..27ba5b17f61e 100644\n> --- a/src/libcamera/include/v4l2_subdevice.h\n> +++ b/src/libcamera/include/v4l2_subdevice.h\n> @@ -46,6 +46,8 @@ public:\n>  \n>  \tconst MediaEntity *entity() const { return entity_; }\n>  \n> +\tint getSelection(unsigned int pad, unsigned int target,\n> +\t\t\t Rectangle *rect);\n>  \tint setSelection(unsigned int pad, unsigned int target,\n>  \t\t\t Rectangle *rect);\n>  \n> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> index 432e89eacbd3..74788ce7cf4f 100644\n> --- a/src/libcamera/v4l2_subdevice.cpp\n> +++ b/src/libcamera/v4l2_subdevice.cpp\n> @@ -133,6 +133,39 @@ int V4L2Subdevice::open()\n>   * \\return The subdevice's associated media entity.\n>   */\n>  \n> +/**\n> + * \\brief Get selection rectangle \\a rect for \\a target\n> + * \\param[in] pad The 0-indexed pad number the rectangle is retrieved from\n> + * \\param[in] target The selection target defined by the V4L2_SEL_TGT_* flags\n> + * \\param[out] rect The retrieved selection rectangle\n> + * \\return 0 on success or a negative error code otherwise\n> + */\n> +int V4L2Subdevice::getSelection(unsigned int pad, unsigned int target,\n> +\t\t\t\tRectangle *rect)\n> +{\n> +\tstruct v4l2_subdev_selection sel = {};\n> +\n> +\tsel.which = V4L2_SUBDEV_FORMAT_ACTIVE;\n> +\tsel.pad = pad;\n> +\tsel.target = target;\n> +\tsel.flags = 0;\n> +\n> +\tint ret = ioctl(VIDIOC_SUBDEV_G_SELECTION, &sel);\n> +\tif (ret < 0) {\n> +\t\tLOG(V4L2, Error)\n> +\t\t\t<< \"Unable to get rectangle \" << target << \" on pad \"\n> +\t\t\t<< pad << \": \" << strerror(-ret);\n> +\t\treturn ret;\n> +\t}\n> +\n> +\trect->x = sel.r.left;\n> +\trect->y = sel.r.top;\n> +\trect->width = sel.r.width;\n> +\trect->height = sel.r.height;\n> +\n> +\treturn 0;\n> +}\n> +\n>  /**\n>   * \\brief Set selection rectangle \\a rect for \\a target\n>   * \\param[in] pad The 0-indexed pad number the rectangle is to be applied to\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-lf1-x143.google.com (mail-lf1-x143.google.com\n\t[IPv6:2a00:1450:4864:20::143])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B7B21603FB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Apr 2020 01:46:57 +0200 (CEST)","by mail-lf1-x143.google.com with SMTP id 198so15381450lfo.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Apr 2020 16:46:57 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\tm17sm12422893lfp.25.2020.04.27.16.46.56\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 27 Apr 2020 16:46:56 -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=\"Osjugf6Z\"; \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=tLSWQLRIRGIVeKhWRzDgBfn+bSktF1sdG5hBJJkq06o=;\n\tb=Osjugf6ZwjPZh12rKdZ4QHrf8LkDwmwt6G2nmSB2ed4BKEqoSppBmhmcvs7VlNhWMB\n\tFF2D2IY7fhBDGCjJhyAF8GBrzqJu0LcNvWawtWorb1NHJA5DUfXgJYjh0M/S1eP657ia\n\tRt08JLMJioH4C8IRzIRVbisfifzVDS6MTOu+WeNsa6lWqoZJDhKyIAovRVqqwKfZipTG\n\tRzZWuWNEsg+UE0xO1mOyZj91/8/Tlaqgc5nJgnbshX8Nkhv06cX9pGkXmbgAzMS6NOWi\n\tyA1MXbQbiNj9SzZkUjA1okxsaOW2hg57MQxmB/c1IkwwV5PGIGCORoXRVQchlFhoGXMZ\n\tC8/w==","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=tLSWQLRIRGIVeKhWRzDgBfn+bSktF1sdG5hBJJkq06o=;\n\tb=FbLHbt5h6Hq8+4uYqUHwNwnvihEhrGx8jdOydsKLph9vO/YECWyUaYglb2Lfcv+6NF\n\t0ujdQ6H7v9blmWTnYI8Ydc1/awcugsUPV+jp5iWt/c1/6764D8rbtEQN9eOXx6sUly2F\n\tx6T7oo4YI8YGqfmsJwT1ruHgusSrq8Nwy6z20kiMN5PV8Y9L39O7t66ecxyroDsZsYa8\n\tIgtNi8S+f99CN/A+VEEZ5gzlT8m4BH3Cr76pAh3Z3O6tnyBtVeuef4RfUF2XTc+nOztY\n\td2NlZ2wcAd5GqAu0FRhkI/jF429ySFr2e4rlyIE7yPq6mQTIynZor/2E+kzFrQkU5Ra9\n\tFuBA==","X-Gm-Message-State":"AGi0PuZZ0TDEW4L+FbV5oZkfgGQQ6MPeVC6hfTaB+GU81QuK7zI6E94F\n\t+27E2d1taauYGk+EuUlrNA6xzFRS7z8=","X-Google-Smtp-Source":"APiQypKJMMt2cS4C5dpkrq6k5GWPrgC2mG0RG9KjmNfAwhT19NdIn66knGcZ1B0J2mkGLsj5Nx/LPg==","X-Received":"by 2002:a19:7008:: with SMTP id h8mr16869220lfc.43.1588031217092;\n\tMon, 27 Apr 2020 16:46:57 -0700 (PDT)","Date":"Tue, 28 Apr 2020 01:46:55 +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":"<20200427234655.GG1165729@oden.dyn.berto.se>","References":"<20200427213236.333777-1-jacopo@jmondi.org>\n\t<20200427213236.333777-4-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-4-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v4 3/7] libcamera: v4l2_subdevice:\n\tImplement getSelection()","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:46:57 -0000"}},{"id":4600,"web_url":"https://patchwork.libcamera.org/comment/4600/","msgid":"<20200428013911.GC3579@pendragon.ideasonboard.com>","date":"2020-04-28T01:39:11","subject":"Re: [libcamera-devel] [PATCH v4 3/7] libcamera: v4l2_subdevice:\n\tImplement getSelection()","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:32PM +0200, Jacopo Mondi wrote:\n> Implement V4L2Subdevice::getSelection() to support retrieving selection\n> rectangles from the v4l2 subdevice.\n\ns/v4l2/V4L2/\n\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_subdevice.h |  2 ++\n>  src/libcamera/v4l2_subdevice.cpp       | 33 ++++++++++++++++++++++++++\n>  2 files changed, 35 insertions(+)\n> \n> diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\n> index 9a5c812db9b6..27ba5b17f61e 100644\n> --- a/src/libcamera/include/v4l2_subdevice.h\n> +++ b/src/libcamera/include/v4l2_subdevice.h\n> @@ -46,6 +46,8 @@ public:\n>  \n>  \tconst MediaEntity *entity() const { return entity_; }\n>  \n> +\tint getSelection(unsigned int pad, unsigned int target,\n> +\t\t\t Rectangle *rect);\n>  \tint setSelection(unsigned int pad, unsigned int target,\n>  \t\t\t Rectangle *rect);\n>  \n> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> index 432e89eacbd3..74788ce7cf4f 100644\n> --- a/src/libcamera/v4l2_subdevice.cpp\n> +++ b/src/libcamera/v4l2_subdevice.cpp\n> @@ -133,6 +133,39 @@ int V4L2Subdevice::open()\n>   * \\return The subdevice's associated media entity.\n>   */\n>  \n> +/**\n> + * \\brief Get selection rectangle \\a rect for \\a target\n> + * \\param[in] pad The 0-indexed pad number the rectangle is retrieved from\n> + * \\param[in] target The selection target defined by the V4L2_SEL_TGT_* flags\n> + * \\param[out] rect The retrieved selection rectangle\n> + * \\return 0 on success or a negative error code otherwise\n> + */\n> +int V4L2Subdevice::getSelection(unsigned int pad, unsigned int target,\n> +\t\t\t\tRectangle *rect)\n> +{\n> +\tstruct v4l2_subdev_selection sel = {};\n> +\n> +\tsel.which = V4L2_SUBDEV_FORMAT_ACTIVE;\n> +\tsel.pad = pad;\n> +\tsel.target = target;\n> +\tsel.flags = 0;\n> +\n> +\tint ret = ioctl(VIDIOC_SUBDEV_G_SELECTION, &sel);\n> +\tif (ret < 0) {\n> +\t\tLOG(V4L2, Error)\n> +\t\t\t<< \"Unable to get rectangle \" << target << \" on pad \"\n> +\t\t\t<< pad << \": \" << strerror(-ret);\n> +\t\treturn ret;\n> +\t}\n> +\n> +\trect->x = sel.r.left;\n> +\trect->y = sel.r.top;\n> +\trect->width = sel.r.width;\n> +\trect->height = sel.r.height;\n> +\n> +\treturn 0;\n> +}\n> +\n>  /**\n>   * \\brief Set selection rectangle \\a rect for \\a target\n>   * \\param[in] pad The 0-indexed pad number the rectangle is to be applied to","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 26F1D603F5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Apr 2020 03:39:27 +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 AAC34583;\n\tTue, 28 Apr 2020 03:39:26 +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=\"bq7dCOSz\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1588037966;\n\tbh=aqwq6Wo5gf0cowSbFH4KWoeCpvoqSVqEd6nKWdzeIB0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=bq7dCOSzb9H35eOS26fUWKdAyH4K23WTKfFJ7bPb6mY4458y1BphhAjWfNSD5/2DZ\n\t+gKcsZjOiBDIG4SHeGvou/hzXYEvdOf1oCnRoAipktACQcwvUXDvGRRL6CYL7+JgFH\n\tO2PwzPwn67Iz6UazOzsGLVZKOgW4PcCIZAu0T/J8=","Date":"Tue, 28 Apr 2020 04:39:11 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200428013911.GC3579@pendragon.ideasonboard.com>","References":"<20200427213236.333777-1-jacopo@jmondi.org>\n\t<20200427213236.333777-4-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200427213236.333777-4-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v4 3/7] libcamera: v4l2_subdevice:\n\tImplement getSelection()","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:39:27 -0000"}}]