diff options
author | Hans de Goede <hdegoede@redhat.com> | 2023-06-01 15:58:56 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2023-06-09 15:40:24 +0100 |
commit | 72f0ba79a063ec2b21d5874e41c6d82193100515 (patch) | |
tree | c996792eddc623f656105c7be9acd9c0219e49f9 /drivers | |
parent | 0af9078315c1a737675f041996c02582610b7cfd (diff) | |
download | linux-72f0ba79a063ec2b21d5874e41c6d82193100515.tar.gz linux-72f0ba79a063ec2b21d5874e41c6d82193100515.tar.bz2 linux-72f0ba79a063ec2b21d5874e41c6d82193100515.zip |
media: atomisp: Take minimum padding requirement on BYT/ISP2400 into account
The main binary for the pipeline on BYT/ISP2400 has its
ia_css_binary_info.pipeline.left_cropping and .top_cropping fields
set to 12. So a minimum padding of 12 is required.
And for certain bayer-orders additional width / height padding is
necessary so that the ISP crop rectangle for the raw sensor data
can be used to change the bayer-order to the fixed bayer-order
supported by the debayer block.
Without the minmum required padding ia_css_ifmtr_configure() will fail
inside ifmtr_input_start_line() and/or ifmtr_start_column() because
it cannot set the ISP crop rectangle for the raw sensor data.
Fix this by making atomisp_get_padding() take the minimum padding
requirements into account on BYT/ISP2400 (CHT/ISP2401 does not seem to
need this).
Link: https://lore.kernel.org/r/20230601145858.59652-2-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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/media/atomisp/pci/atomisp_cmd.c | 33 | ||||
-rw-r--r-- | drivers/staging/media/atomisp/pci/atomisp_common.h | 4 |
2 files changed, 37 insertions, 0 deletions
diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 76307f793dc8..5c984edfb3fc 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -3697,6 +3697,10 @@ static void atomisp_get_padding(struct atomisp_device *isp, { struct atomisp_input_subdev *input = &isp->inputs[isp->asd.input_curr]; struct v4l2_rect native_rect = input->native_rect; + const struct atomisp_in_fmt_conv *fc = NULL; + u32 min_pad_w = ISP2400_MIN_PAD_W; + u32 min_pad_h = ISP2400_MIN_PAD_H; + struct v4l2_mbus_framefmt *sink; if (!input->crop_support) { *padding_w = pad_w; @@ -3715,6 +3719,35 @@ static void atomisp_get_padding(struct atomisp_device *isp, *padding_w = min_t(u32, (native_rect.width - width) & ~1, pad_w); *padding_h = min_t(u32, (native_rect.height - height) & ~1, pad_h); + + /* The below minimum padding requirements are for BYT / ISP2400 only */ + if (IS_ISP2401) + return; + + sink = atomisp_subdev_get_ffmt(&isp->asd.subdev, NULL, V4L2_SUBDEV_FORMAT_ACTIVE, + ATOMISP_SUBDEV_PAD_SINK); + if (sink) + fc = atomisp_find_in_fmt_conv(sink->code); + if (!fc) { + dev_warn(isp->dev, "%s: Could not get sensor format\n", __func__); + goto apply_min_padding; + } + + /* + * The ISP only supports GRBG for other bayer-orders additional padding + * is used so that the raw sensor data can be cropped to fix the order. + */ + if (fc->bayer_order == IA_CSS_BAYER_ORDER_RGGB || + fc->bayer_order == IA_CSS_BAYER_ORDER_GBRG) + min_pad_w += 2; + + if (fc->bayer_order == IA_CSS_BAYER_ORDER_BGGR || + fc->bayer_order == IA_CSS_BAYER_ORDER_GBRG) + min_pad_h += 2; + +apply_min_padding: + *padding_w = max_t(u32, *padding_w, min_pad_w); + *padding_h = max_t(u32, *padding_h, min_pad_h); } static int atomisp_set_crop(struct atomisp_device *isp, diff --git a/drivers/staging/media/atomisp/pci/atomisp_common.h b/drivers/staging/media/atomisp/pci/atomisp_common.h index 07c38e487a66..9d23a6ccfc33 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_common.h +++ b/drivers/staging/media/atomisp/pci/atomisp_common.h @@ -37,6 +37,10 @@ extern int mipicsi_flag; extern int pad_w; extern int pad_h; +/* Minimum padding requirements for ISP2400 (BYT) */ +#define ISP2400_MIN_PAD_W 12 +#define ISP2400_MIN_PAD_H 12 + #define CSS_DTRACE_VERBOSITY_LEVEL 5 /* Controls trace verbosity */ #define CSS_DTRACE_VERBOSITY_TIMEOUT 9 /* Verbosity on ISP timeout */ #define MRFLD_MAX_ZOOM_FACTOR 1024 |