From patchwork Thu Feb 28 20:01:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 673 Return-Path: Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EF0E3610C4 for ; Thu, 28 Feb 2019 21:01:33 +0100 (CET) Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 87F1610000A; Thu, 28 Feb 2019 20:01:33 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Thu, 28 Feb 2019 21:01:47 +0100 Message-Id: <20190228200151.2948-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190228200151.2948-1-jacopo@jmondi.org> References: <20190228200151.2948-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 5/9] libcamera: v4l2_subdevice: Update crop/compose rectangle X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Feb 2019 20:01:34 -0000 Update the crop/compose rectangle provided to setCrop()/setCompose() methods with the rectangle sizes set by the device driver after a S_SELECTION ioctl operation. While at there, fix the use of 'top' and 'left' field of the selection rectangle, which where wrongly used. Fixes: 468176fa07d9 ("libcamera: Add V4L2Subdevice") Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/v4l2_subdevice.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp index 7f191e072c61..d2f9365a9537 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -342,8 +342,8 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target, sel.target = target; sel.flags = 0; - sel.r.left = rect->y; - sel.r.top = rect->x; + sel.r.left = rect->x; + sel.r.top = rect->y; sel.r.width = rect->w; sel.r.height = rect->h; @@ -356,6 +356,11 @@ int V4L2Subdevice::setSelection(unsigned int pad, unsigned int target, return ret; } + rect->x = sel.r.left; + rect->y = sel.r.top; + rect->w = sel.r.width; + rect->h = sel.r.height; + return 0; }