diff mbox series

[3/7] media: atomisp: Clamp width to max 1920 pixels when in ATOMISP_RUN_MODE_PREVIEW

Message ID 20230619105212.303653-3-hdegoede@redhat.com (mailing list archive)
State New, archived
Headers show
Series [1/7] media: atomisp: Fix missing v4l2_fh_release() in atomisp_open() error exit | expand

Commit Message

Hans de Goede June 19, 2023, 10:52 a.m. UTC
The pipeline firmware-binaries used in previed mode have
ia_css_binary_xinfo.output.max_width set to 1920.

This causes ia_css_binary_find() to fail when trying to set a higher
resolution resulting in the dump_stack() call in ia_css_binary_find()
triggering and resulting in the try_fmt() or set_fmt() IOCTL failing.

Fix this by clamping the width to max 1920 when in preview mode.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/staging/media/atomisp/pci/atomisp_cmd.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
index cbbf6f728f57..64456aedbf00 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
@@ -3808,6 +3808,10 @@  int atomisp_try_fmt(struct atomisp_device *isp, struct v4l2_pix_format *f,
 			return -EINVAL;
 	}
 
+	/* The preview pipeline does not support width > 1920 */
+	if (asd->run_mode->val == ATOMISP_RUN_MODE_PREVIEW)
+		f->width = min_t(u32, f->width, 1920);
+
 	/*
 	 * atomisp_set_fmt() will set the sensor resolution to the requested
 	 * resolution + padding. Add padding here and remove it again after