[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cmj3pqfy7zvcdjw63ndkuwfcxapt5puv3swvnhfhjbqs5w7d2v@fmi3okbzhdvt>
Date: Fri, 17 Oct 2025 11:23:46 +0200
From: Jacopo Mondi <jacopo.mondi@...asonboard.com>
To: Jai Luthra <jai.luthra@...asonboard.com>
Cc: Sakari Ailus <sakari.ailus@...ux.intel.com>,
Dave Stevenson <dave.stevenson@...pberrypi.com>, Mauro Carvalho Chehab <mchehab@...nel.org>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>, Hans Verkuil <hverkuil@...nel.org>,
Jacopo Mondi <jacopo.mondi@...asonboard.com>, linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
Tomi Valkeinen <tomi.valkeinen@...asonboard.com>,
Barnabás Pőcze <barnabas.pocze@...asonboard.com>, stable@...r.kernel.org
Subject: Re: [PATCH 1/2] media: i2c: imx219: Fix 1920x1080 mode to use 1:1
pixel aspect ratio
Hi Jai
On Fri, Oct 17, 2025 at 01:43:49PM +0530, Jai Luthra wrote:
> From: Dave Stevenson <dave.stevenson@...pberrypi.com>
>
> Commit 0af46fbc333d ("media: i2c: imx219: Calculate crop rectangle
> dynamically") meant that the 1920x1080 mode switched from using no
> binning to using vertical binning but no horizontal binning, which
> resulted in stretched pixels.
>
> Until proper controls are available to independently select horizontal
> and vertical binning, restore the original 1:1 pixel aspect ratio by
> forcing binning to be uniform in both directions.
I think it makes sense and I wonder if binning in one direction and
not in the other will ever be needed in the general case.
For this driver indeed, this fixes a visible regression
Reviewed-by: Jacopo Mondi <jacopo.mondi@...asonboard.com>
Thanks
j
>
> Cc: stable@...r.kernel.org
> Fixes: 0af46fbc333d ("media: i2c: imx219: Calculate crop rectangle dynamically")
> Signed-off-by: Dave Stevenson <dave.stevenson@...pberrypi.com>
> [Add comment & reword commit message]
> Signed-off-by: Jai Luthra <jai.luthra@...asonboard.com>
> ---
> drivers/media/i2c/imx219.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
> index c680aa6c3a55a9d865e79ad337b258cb681f98fe..300935b1ef2497050fe2808e4ceedda389a75b50 100644
> --- a/drivers/media/i2c/imx219.c
> +++ b/drivers/media/i2c/imx219.c
> @@ -856,7 +856,7 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
> const struct imx219_mode *mode;
> struct v4l2_mbus_framefmt *format;
> struct v4l2_rect *crop;
> - u8 bin_h, bin_v;
> + u8 bin_h, bin_v, binning;
> u32 prev_line_len;
>
> format = v4l2_subdev_state_get_format(state, 0);
> @@ -877,9 +877,12 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
> bin_h = min(IMX219_PIXEL_ARRAY_WIDTH / format->width, 2U);
> bin_v = min(IMX219_PIXEL_ARRAY_HEIGHT / format->height, 2U);
>
> + /* Ensure bin_h and bin_v are same to avoid 1:2 or 2:1 stretching */
> + binning = min(bin_h, bin_v);
> +
> crop = v4l2_subdev_state_get_crop(state, 0);
> - crop->width = format->width * bin_h;
> - crop->height = format->height * bin_v;
> + crop->width = format->width * binning;
> + crop->height = format->height * binning;
> crop->left = (IMX219_NATIVE_WIDTH - crop->width) / 2;
> crop->top = (IMX219_NATIVE_HEIGHT - crop->height) / 2;
>
>
> --
> 2.51.0
>
Powered by blists - more mailing lists