Re: [PATCH 1/2] media: atomisp: Don't enumerate frame sizes the preview pipe can't output
From: Andy Shevchenko
Date: Tue Nov 17 2026 - 05:31:45 EST
On Mon, Nov 16, 2026 at 05:57:49PM +0000, Volodymyr Chapman wrote:
> In preview mode atomisp_try_fmt() limits the size to 1920x1440, since the
> preview pipeline cannot output anything larger. For sensors without crop support
So, what makes us stop implementing the crop support there?
> atomisp_enum_framesizes() however passes on all sensor sizes,
> minus the padding, so VIDIOC_ENUM_FRAMESIZES lists sizes for which
> VIDIOC_S_FMT returns a different, smaller size.
>
> Userspace which picks the largest enumerated size and then checks that
> S_FMT gave it that size fails. For example PipeWire's V4L2 source cannot
> negotiate a format with Firefox for the IMX175 rear sensor of a Lenovo
> ThinkPad 10, which lists 3264x2448 and 1624x1216: Firefox picks
> 3264x2448, S_FMT returns 1624x1216 and the stream fails with "error set
> output format: -22 (Invalid argument)".
>
> Skip the sizes which do not fit the preview pipeline when in preview mode,
> so that only sizes which S_FMT can set are enumerated.
> Tested on a Lenovo ThinkPad 10 (20C3, Atom Z3795) with this file built out
> of tree against a 7.2.15 kernel: ENUM_FRAMESIZES for the IMX175 now lists
> only 1624x1216, and Firefox 160 streams from both the IMX175 and the
> OV2722 front sensor through PipeWire. This was build-tested on top of
> media.git next.
>
> The problem was investigated and this patch drafted with the help of an
> AI coding assistant (Claude); the testing was done on the hardware by the
> submitter.
No need to repeat these two paragraphs, make sure they are in the cover letter.
...
> - ret = v4l2_subdev_call(input->sensor, pad, enum_frame_size,
> - act_sd_state, &fse);
> + for (fse.index = 0; ; fse.index++) {
> + ret = v4l2_subdev_call(input->sensor, pad, enum_frame_size,
> + act_sd_state, &fse);
> + if (ret)
> + break;
> +
> + /*
> + * Skip sizes the preview pipeline cannot output, for which
> + * atomisp_try_fmt() would return a smaller size.
> + */
> + if (asd->run_mode->val == ATOMISP_RUN_MODE_PREVIEW &&
> + (fse.max_width - pad_w > 1920 ||
> + fse.max_height - pad_h > 1440))
> + continue;
> +
> + if (valid_sizes++ == fsize->index)
> + break;
> + }
TBH, this feels like a hack, but I'm not v4l2/media reviewer/maintainer,
so I don't know if this approach is legit.
--
With Best Regards,
Andy Shevchenko