[{"id":832,"web_url":"https://patchwork.libcamera.org/comment/832/","msgid":"<20190221155405.GG11484@bigcity.dyn.berto.se>","date":"2019-02-21T15:54:05","subject":"Re: [libcamera-devel] [PATCH 1/5] libcamera: v4l2_subdevice: Make\n\tcrop/compose rectangle a reference","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 patch.\n\nOn 2019-02-20 14:17:53 +0100, Jacopo Mondi wrote:\n> As the crop/compose rectangle provided to setCrop and setCompose methods\n> is never modified, make it a const reference.\n\nI think this is the wrong thing to do. Instead I think you should change \nthis patch to update the rectangle after VIDIOC_SUBDEV_S_SELECTION.\n\nThe kernel can update the requested selection rectangle and the caller \nshould be made aware of this. Look at V4L2Subdevice::setFormat() which \nhave a similar pattern but for VIDIOC_SUBDEV_S_FMT.\n\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/include/v4l2_subdevice.h |  6 +++---\n>  src/libcamera/v4l2_subdevice.cpp       | 18 +++++++++---------\n>  2 files changed, 12 insertions(+), 12 deletions(-)\n> \n> diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\n> index 40becd0ca99b..18000d6ed06b 100644\n> --- a/src/libcamera/include/v4l2_subdevice.h\n> +++ b/src/libcamera/include/v4l2_subdevice.h\n> @@ -44,8 +44,8 @@ public:\n>  \tstd::string deviceNode() const { return deviceNode_; }\n>  \tstd::string deviceName() const { return deviceName_; }\n>  \n> -\tint setCrop(unsigned int pad, Rectangle *rect);\n> -\tint setCompose(unsigned int pad, Rectangle *rect);\n> +\tint setCrop(unsigned int pad, const Rectangle &rect);\n> +\tint setCompose(unsigned int pad, const Rectangle &rect);\n>  \n>  \tint enumFormat(unsigned int pad, V4L2SubdeviceFormatEnum *formatEnum);\n>  \tint getFormat(unsigned int pad, V4L2SubdeviceFormat *format);\n> @@ -53,7 +53,7 @@ public:\n>  \n>  private:\n>  \tint setSelection(unsigned int pad, unsigned int target,\n> -\t\t\t Rectangle *rect);\n> +\t\t\t const Rectangle &rect);\n>  \n>  \tstd::string deviceNode_;\n>  \tstd::string deviceName_;\n> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> index 4411ffa51460..2e73edee68c9 100644\n> --- a/src/libcamera/v4l2_subdevice.cpp\n> +++ b/src/libcamera/v4l2_subdevice.cpp\n> @@ -203,11 +203,11 @@ void V4L2Subdevice::close()\n>  /**\n>   * \\brief Set a crop rectangle on one of the V4L2 subdevice pads\n>   * \\param[in] pad The 0-indexed pad number the rectangle is to be applied to\n> - * \\param[inout] rect The rectangle describing crop target area\n> + * \\param[in] rect The rectangle describing crop target area\n>   *\n>   * \\return 0 on success, or a negative error code otherwise\n>   */\n> -int V4L2Subdevice::setCrop(unsigned int pad, Rectangle *rect)\n> +int V4L2Subdevice::setCrop(unsigned int pad, const Rectangle &rect)\n>  {\n>  \treturn setSelection(pad, V4L2_SEL_TGT_CROP, rect);\n>  }\n> @@ -215,11 +215,11 @@ int V4L2Subdevice::setCrop(unsigned int pad, Rectangle *rect)\n>  /**\n>   * \\brief Set a compose rectangle on one of the V4L2 subdevice pads\n>   * \\param[in] pad The 0-indexed pad number the rectangle is to be applied to\n> - * \\param[inout] rect The rectangle describing the compose target area\n> + * \\param[in] rect The rectangle describing the compose target area\n>   *\n>   * \\return 0 on success, or a negative error code otherwise\n>   */\n> -int V4L2Subdevice::setCompose(unsigned int pad, Rectangle *rect)\n> +int V4L2Subdevice::setCompose(unsigned int pad, const Rectangle &rect)\n>  {\n>  \treturn setSelection(pad, V4L2_SEL_TGT_COMPOSE, rect);\n>  }\n> @@ -333,7 +333,7 @@ int V4L2Subdevice::setFormat(unsigned int pad, V4L2SubdeviceFormat *format)\n>  }\n>  \n>  int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,\n> -\t\t\t\tRectangle *rect)\n> +\t\t\t\tconst Rectangle &rect)\n>  {\n>  \tstruct v4l2_subdev_selection sel = {};\n>  \n> @@ -342,10 +342,10 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,\n>  \tsel.target = target;\n>  \tsel.flags = 0;\n>  \n> -\tsel.r.left = rect->y;\n> -\tsel.r.top = rect->x;\n> -\tsel.r.width = rect->w;\n> -\tsel.r.height = rect->h;\n> +\tsel.r.left = rect.y;\n> +\tsel.r.top = rect.x;\n> +\tsel.r.width = rect.w;\n> +\tsel.r.height = rect.h;\n>  \n>  \tint ret = ioctl(fd_, VIDIOC_SUBDEV_S_SELECTION, &sel);\n>  \tif (ret < 0) {\n> -- \n> 2.20.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-x141.google.com (mail-lf1-x141.google.com\n\t[IPv6:2a00:1450:4864:20::141])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 019C4600FB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 Feb 2019 16:54:06 +0100 (CET)","by mail-lf1-x141.google.com with SMTP id z15so4449565lff.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 Feb 2019 07:54:06 -0800 (PST)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\th26sm1267176ljf.5.2019.02.21.07.54.05\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tThu, 21 Feb 2019 07:54:05 -0800 (PST)"],"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\t:user-agent; bh=TR91Rl37bkUl52zIlsYTkvADrNFROxa3YpfhS+eXJ5g=;\n\tb=LKV22J+ILHuxv8nD9l6hFLyo79Eib01HpCvGtgXXTUhGCb0Jo1M2h2OCkwOmdPOJP3\n\t3eUNeR94PqXMIGsunEtrvWVY7P1GZdoUqEhzBrJuOxpMUoS6JS5ueXGNks8xeyytM4z6\n\tSkUhsxWmDfBofp0F3TajeaZWDdVuryCoxIviFBNfvx0DnpQbtmbuFemNxyZ1LYmG7F2t\n\tLr7NwTKy1Nu03dOYzJaPBkJVzUPXk5N1DL8T7WLrlH6hdjhFvJNiITHuktTviEO3pDpl\n\tnWid1SojPQCq5BhHMPMkeY2YBsk1avyFX3m51JuEYWPqeCtcNxFag+L1RABHf3/eP6g/\n\t7HRQ==","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:user-agent;\n\tbh=TR91Rl37bkUl52zIlsYTkvADrNFROxa3YpfhS+eXJ5g=;\n\tb=ZpB4dm7xbBLVXcDBdvQr4hizfl5d9MJx5WZoAPGXb7aqJqvrMT0oZl1rhKIq1zoQFF\n\tYHXX+zgFE6vF56LGZQfh6oArI5WISoP1rbn0o/EHjhDFDXwwVt0YRH1rTviVRyrQg3g+\n\tUSzNG4mjo5zcsPx0pV9OD3nGXnMnCBnOywzFEXWMDZYO/DkOdN91mq/VkfVPqeO49vGQ\n\tgA6hSX8c1r5fbF7rWi3YO/mtkYDZ35KMA8DaDUicXcfKEPEgm6Jd3fCNWPMD6p2Ix/q6\n\tlU4As6/JS+ckW5p2WvL/0lJuStpGUT30sZGgoPhPljuOv9lIzF69UzYCDlSZHb2dTkE0\n\t5Jtg==","X-Gm-Message-State":"AHQUAuaPtdOEayaVW3nTCQ6NmqM7d5Fc2IcqjLWBJKwlnNv+Ex2i06QN\n\tguO7/490ui4qPUW7zixzJKh/tWa6DjM=","X-Google-Smtp-Source":"AHgI3IY7nCLJv9A2i9Ws7GB9Mcyze1oVPaUypt1PAx1s4wc3/MBdLgVhNa62vA0A8I5Jz6RkHm2lgw==","X-Received":"by 2002:a19:645e:: with SMTP id\n\tb30mr23879125lfj.15.1550764446286; \n\tThu, 21 Feb 2019 07:54:06 -0800 (PST)","Date":"Thu, 21 Feb 2019 16:54:05 +0100","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":"<20190221155405.GG11484@bigcity.dyn.berto.se>","References":"<20190220131757.14004-1-jacopo@jmondi.org>\n\t<20190220131757.14004-2-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":"<20190220131757.14004-2-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 1/5] libcamera: v4l2_subdevice: Make\n\tcrop/compose rectangle a reference","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Thu, 21 Feb 2019 15:54:07 -0000"}},{"id":839,"web_url":"https://patchwork.libcamera.org/comment/839/","msgid":"<20190221233154.GJ3485@pendragon.ideasonboard.com>","date":"2019-02-21T23:31:54","subject":"Re: [libcamera-devel] [PATCH 1/5] libcamera: v4l2_subdevice: Make\n\tcrop/compose rectangle a reference","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Thu, Feb 21, 2019 at 04:54:05PM +0100, Niklas Söderlund wrote:\n> Hi Jacopo,\n> \n> Thanks for your patch.\n> \n> On 2019-02-20 14:17:53 +0100, Jacopo Mondi wrote:\n> > As the crop/compose rectangle provided to setCrop and setCompose methods\n> > is never modified, make it a const reference.\n> \n> I think this is the wrong thing to do. Instead I think you should change \n> this patch to update the rectangle after VIDIOC_SUBDEV_S_SELECTION.\n> \n> The kernel can update the requested selection rectangle and the caller \n> should be made aware of this. Look at V4L2Subdevice::setFormat() which \n> have a similar pattern but for VIDIOC_SUBDEV_S_FMT.\n\nAgreed, I was about to say the same.\n\n> > \n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/libcamera/include/v4l2_subdevice.h |  6 +++---\n> >  src/libcamera/v4l2_subdevice.cpp       | 18 +++++++++---------\n> >  2 files changed, 12 insertions(+), 12 deletions(-)\n> > \n> > diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\n> > index 40becd0ca99b..18000d6ed06b 100644\n> > --- a/src/libcamera/include/v4l2_subdevice.h\n> > +++ b/src/libcamera/include/v4l2_subdevice.h\n> > @@ -44,8 +44,8 @@ public:\n> >  \tstd::string deviceNode() const { return deviceNode_; }\n> >  \tstd::string deviceName() const { return deviceName_; }\n> >  \n> > -\tint setCrop(unsigned int pad, Rectangle *rect);\n> > -\tint setCompose(unsigned int pad, Rectangle *rect);\n> > +\tint setCrop(unsigned int pad, const Rectangle &rect);\n> > +\tint setCompose(unsigned int pad, const Rectangle &rect);\n> >  \n> >  \tint enumFormat(unsigned int pad, V4L2SubdeviceFormatEnum *formatEnum);\n> >  \tint getFormat(unsigned int pad, V4L2SubdeviceFormat *format);\n> > @@ -53,7 +53,7 @@ public:\n> >  \n> >  private:\n> >  \tint setSelection(unsigned int pad, unsigned int target,\n> > -\t\t\t Rectangle *rect);\n> > +\t\t\t const Rectangle &rect);\n> >  \n> >  \tstd::string deviceNode_;\n> >  \tstd::string deviceName_;\n> > diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> > index 4411ffa51460..2e73edee68c9 100644\n> > --- a/src/libcamera/v4l2_subdevice.cpp\n> > +++ b/src/libcamera/v4l2_subdevice.cpp\n> > @@ -203,11 +203,11 @@ void V4L2Subdevice::close()\n> >  /**\n> >   * \\brief Set a crop rectangle on one of the V4L2 subdevice pads\n> >   * \\param[in] pad The 0-indexed pad number the rectangle is to be applied to\n> > - * \\param[inout] rect The rectangle describing crop target area\n> > + * \\param[in] rect The rectangle describing crop target area\n> >   *\n> >   * \\return 0 on success, or a negative error code otherwise\n> >   */\n> > -int V4L2Subdevice::setCrop(unsigned int pad, Rectangle *rect)\n> > +int V4L2Subdevice::setCrop(unsigned int pad, const Rectangle &rect)\n> >  {\n> >  \treturn setSelection(pad, V4L2_SEL_TGT_CROP, rect);\n> >  }\n> > @@ -215,11 +215,11 @@ int V4L2Subdevice::setCrop(unsigned int pad, Rectangle *rect)\n> >  /**\n> >   * \\brief Set a compose rectangle on one of the V4L2 subdevice pads\n> >   * \\param[in] pad The 0-indexed pad number the rectangle is to be applied to\n> > - * \\param[inout] rect The rectangle describing the compose target area\n> > + * \\param[in] rect The rectangle describing the compose target area\n> >   *\n> >   * \\return 0 on success, or a negative error code otherwise\n> >   */\n> > -int V4L2Subdevice::setCompose(unsigned int pad, Rectangle *rect)\n> > +int V4L2Subdevice::setCompose(unsigned int pad, const Rectangle &rect)\n> >  {\n> >  \treturn setSelection(pad, V4L2_SEL_TGT_COMPOSE, rect);\n> >  }\n> > @@ -333,7 +333,7 @@ int V4L2Subdevice::setFormat(unsigned int pad, V4L2SubdeviceFormat *format)\n> >  }\n> >  \n> >  int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,\n> > -\t\t\t\tRectangle *rect)\n> > +\t\t\t\tconst Rectangle &rect)\n> >  {\n> >  \tstruct v4l2_subdev_selection sel = {};\n> >  \n> > @@ -342,10 +342,10 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,\n> >  \tsel.target = target;\n> >  \tsel.flags = 0;\n> >  \n> > -\tsel.r.left = rect->y;\n> > -\tsel.r.top = rect->x;\n> > -\tsel.r.width = rect->w;\n> > -\tsel.r.height = rect->h;\n> > +\tsel.r.left = rect.y;\n> > +\tsel.r.top = rect.x;\n> > +\tsel.r.width = rect.w;\n> > +\tsel.r.height = rect.h;\n> >  \n> >  \tint ret = ioctl(fd_, VIDIOC_SUBDEV_S_SELECTION, &sel);\n> >  \tif (ret < 0) {","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 129C6600FB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Feb 2019 00:32:00 +0100 (CET)","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 7DD71255;\n\tFri, 22 Feb 2019 00:31:59 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1550791919;\n\tbh=G6SCQZkMNSxZKC7fdtWhkJUJwNDgLxiytP49DUODTJM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=WQn45cs96NfonfKPzelxw6p7UqWsQwBaDwZtArn6EKQPWU+G+waXKZorjbxi5MJ+A\n\traAugpV4pVtD5BlE0WG0U2RBaa/1QfjpnCZlaTLLCSw3ZhV13/IJlhscPwbl0FTSyh\n\tjznix5WaL4kcfbk+1LewBGl/hsLF7mIaYhlBcBZc=","Date":"Fri, 22 Feb 2019 01:31:54 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"Jacopo Mondi <jacopo@jmondi.org>, libcamera-devel@lists.libcamera.org","Message-ID":"<20190221233154.GJ3485@pendragon.ideasonboard.com>","References":"<20190220131757.14004-1-jacopo@jmondi.org>\n\t<20190220131757.14004-2-jacopo@jmondi.org>\n\t<20190221155405.GG11484@bigcity.dyn.berto.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190221155405.GG11484@bigcity.dyn.berto.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 1/5] libcamera: v4l2_subdevice: Make\n\tcrop/compose rectangle a reference","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Thu, 21 Feb 2019 23:32:00 -0000"}},{"id":851,"web_url":"https://patchwork.libcamera.org/comment/851/","msgid":"<20190222082345.pfpjiaicotlmdb3y@uno.localdomain>","date":"2019-02-22T08:23:45","subject":"Re: [libcamera-devel] [PATCH 1/5] libcamera: v4l2_subdevice: Make\n\tcrop/compose rectangle a reference","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent, Niklas,\n\nOn Fri, Feb 22, 2019 at 01:31:54AM +0200, Laurent Pinchart wrote:\n> On Thu, Feb 21, 2019 at 04:54:05PM +0100, Niklas Söderlund wrote:\n> > Hi Jacopo,\n> >\n> > Thanks for your patch.\n> >\n> > On 2019-02-20 14:17:53 +0100, Jacopo Mondi wrote:\n> > > As the crop/compose rectangle provided to setCrop and setCompose methods\n> > > is never modified, make it a const reference.\n> >\n> > I think this is the wrong thing to do. Instead I think you should change\n> > this patch to update the rectangle after VIDIOC_SUBDEV_S_SELECTION.\n> >\n> > The kernel can update the requested selection rectangle and the caller\n> > should be made aware of this. Look at V4L2Subdevice::setFormat() which\n> > have a similar pattern but for VIDIOC_SUBDEV_S_FMT.\n>\n> Agreed, I was about to say the same.\n>\n\nThanks, I overlooked this and assumed the crop/compose rectangles were\nimmutable. I'll make this behave like setFormat then\n\nThanks\n   j\n\n> > >\n> > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > > ---\n> > >  src/libcamera/include/v4l2_subdevice.h |  6 +++---\n> > >  src/libcamera/v4l2_subdevice.cpp       | 18 +++++++++---------\n> > >  2 files changed, 12 insertions(+), 12 deletions(-)\n> > >\n> > > diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\n> > > index 40becd0ca99b..18000d6ed06b 100644\n> > > --- a/src/libcamera/include/v4l2_subdevice.h\n> > > +++ b/src/libcamera/include/v4l2_subdevice.h\n> > > @@ -44,8 +44,8 @@ public:\n> > >  \tstd::string deviceNode() const { return deviceNode_; }\n> > >  \tstd::string deviceName() const { return deviceName_; }\n> > >\n> > > -\tint setCrop(unsigned int pad, Rectangle *rect);\n> > > -\tint setCompose(unsigned int pad, Rectangle *rect);\n> > > +\tint setCrop(unsigned int pad, const Rectangle &rect);\n> > > +\tint setCompose(unsigned int pad, const Rectangle &rect);\n> > >\n> > >  \tint enumFormat(unsigned int pad, V4L2SubdeviceFormatEnum *formatEnum);\n> > >  \tint getFormat(unsigned int pad, V4L2SubdeviceFormat *format);\n> > > @@ -53,7 +53,7 @@ public:\n> > >\n> > >  private:\n> > >  \tint setSelection(unsigned int pad, unsigned int target,\n> > > -\t\t\t Rectangle *rect);\n> > > +\t\t\t const Rectangle &rect);\n> > >\n> > >  \tstd::string deviceNode_;\n> > >  \tstd::string deviceName_;\n> > > diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\n> > > index 4411ffa51460..2e73edee68c9 100644\n> > > --- a/src/libcamera/v4l2_subdevice.cpp\n> > > +++ b/src/libcamera/v4l2_subdevice.cpp\n> > > @@ -203,11 +203,11 @@ void V4L2Subdevice::close()\n> > >  /**\n> > >   * \\brief Set a crop rectangle on one of the V4L2 subdevice pads\n> > >   * \\param[in] pad The 0-indexed pad number the rectangle is to be applied to\n> > > - * \\param[inout] rect The rectangle describing crop target area\n> > > + * \\param[in] rect The rectangle describing crop target area\n> > >   *\n> > >   * \\return 0 on success, or a negative error code otherwise\n> > >   */\n> > > -int V4L2Subdevice::setCrop(unsigned int pad, Rectangle *rect)\n> > > +int V4L2Subdevice::setCrop(unsigned int pad, const Rectangle &rect)\n> > >  {\n> > >  \treturn setSelection(pad, V4L2_SEL_TGT_CROP, rect);\n> > >  }\n> > > @@ -215,11 +215,11 @@ int V4L2Subdevice::setCrop(unsigned int pad, Rectangle *rect)\n> > >  /**\n> > >   * \\brief Set a compose rectangle on one of the V4L2 subdevice pads\n> > >   * \\param[in] pad The 0-indexed pad number the rectangle is to be applied to\n> > > - * \\param[inout] rect The rectangle describing the compose target area\n> > > + * \\param[in] rect The rectangle describing the compose target area\n> > >   *\n> > >   * \\return 0 on success, or a negative error code otherwise\n> > >   */\n> > > -int V4L2Subdevice::setCompose(unsigned int pad, Rectangle *rect)\n> > > +int V4L2Subdevice::setCompose(unsigned int pad, const Rectangle &rect)\n> > >  {\n> > >  \treturn setSelection(pad, V4L2_SEL_TGT_COMPOSE, rect);\n> > >  }\n> > > @@ -333,7 +333,7 @@ int V4L2Subdevice::setFormat(unsigned int pad, V4L2SubdeviceFormat *format)\n> > >  }\n> > >\n> > >  int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,\n> > > -\t\t\t\tRectangle *rect)\n> > > +\t\t\t\tconst Rectangle &rect)\n> > >  {\n> > >  \tstruct v4l2_subdev_selection sel = {};\n> > >\n> > > @@ -342,10 +342,10 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target,\n> > >  \tsel.target = target;\n> > >  \tsel.flags = 0;\n> > >\n> > > -\tsel.r.left = rect->y;\n> > > -\tsel.r.top = rect->x;\n> > > -\tsel.r.width = rect->w;\n> > > -\tsel.r.height = rect->h;\n> > > +\tsel.r.left = rect.y;\n> > > +\tsel.r.top = rect.x;\n> > > +\tsel.r.width = rect.w;\n> > > +\tsel.r.height = rect.h;\n> > >\n> > >  \tint ret = ioctl(fd_, VIDIOC_SUBDEV_S_SELECTION, &sel);\n> > >  \tif (ret < 0) {\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net\n\t[217.70.183.193])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 99E94600FD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Feb 2019 09:23:25 +0100 (CET)","from uno.localdomain (unknown [31.157.247.153])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 6BE3524000B;\n\tFri, 22 Feb 2019 08:23:23 +0000 (UTC)"],"X-Originating-IP":"31.157.247.153","Date":"Fri, 22 Feb 2019 09:23:45 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>,\n\tlibcamera-devel@lists.libcamera.org","Message-ID":"<20190222082345.pfpjiaicotlmdb3y@uno.localdomain>","References":"<20190220131757.14004-1-jacopo@jmondi.org>\n\t<20190220131757.14004-2-jacopo@jmondi.org>\n\t<20190221155405.GG11484@bigcity.dyn.berto.se>\n\t<20190221233154.GJ3485@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"kw5wpgkjtbr3pc4q\"","Content-Disposition":"inline","In-Reply-To":"<20190221233154.GJ3485@pendragon.ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH 1/5] libcamera: v4l2_subdevice: Make\n\tcrop/compose rectangle a reference","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Fri, 22 Feb 2019 08:23:25 -0000"}}]