From a56f8a57b554e97116086a1d4078f7462e068486 Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Wed, 20 Feb 2019 11:48:13 +0100 Subject: libcamera: v4l2_subdevice: Update crop/compose rectangle 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") Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- src/libcamera/v4l2_subdevice.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/libcamera/v4l2_subdevice.cpp') diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp index d7b61ba0..87377762 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -258,8 +258,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; @@ -272,6 +272,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; } -- cgit v1.2.1