media: atomisp: Fix binning check in atomisp_set_crop()

The fmt / size passed to atomisp_set_crop() includes padding,
so the binning check should be against 1/2 of the native rect.
of the sensor, rather then 1/2 of the active rect.

This fixes binning not being used when using e.g. 800x600 on
a 1600x1200 sensor leading to a very small field of view.

Link: https://lore.kernel.org/r/20230601145858.59652-4-hdegoede@redhat.com

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
Hans de Goede 2023-06-01 15:58:58 +01:00 committed by Mauro Carvalho Chehab
parent 0f417dc1b7
commit 930d333a00

View File

@ -3769,8 +3769,8 @@ static int atomisp_set_crop(struct atomisp_device *isp,
return 0;
/* Cropping is done before binning, when binning double the crop rect */
if (input->binning_support && sel.r.width <= (input->active_rect.width / 2) &&
sel.r.height <= (input->active_rect.height / 2)) {
if (input->binning_support && sel.r.width <= (input->native_rect.width / 2) &&
sel.r.height <= (input->native_rect.height / 2)) {
sel.r.width *= 2;
sel.r.height *= 2;
}