Linux kernel staging patches
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Volodymyr Chapman <volodymyrchapman@gmail.com>
Cc: Hans de Goede <hansg@kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Andy Shevchenko <andy@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-media@vger.kernel.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] media: atomisp: Don't enumerate frame sizes the preview pipe can't output
Date: Tue, 17 Nov 2026 12:31:31 +0200	[thread overview]
Message-ID: <avwtA3b3XMkGXPfZ@ashevche-desk.local> (raw)
In-Reply-To: <20261116175750.21905-2-volodymyrchapman@gmail.com>

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



  reply	other threads:[~2026-11-17 10:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 17:57 [PATCH 0/2] media: atomisp: Fix PipeWire/Firefox streaming for sensors without crop or frame interval support Volodymyr Chapman
2026-11-16 17:57 ` [PATCH 1/2] media: atomisp: Don't enumerate frame sizes the preview pipe can't output Volodymyr Chapman
2026-11-17 10:31   ` Andy Shevchenko [this message]
2026-11-16 17:57 ` [PATCH 2/2] media: atomisp: Report frame interval for sensors without enum_frame_interval Volodymyr Chapman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=avwtA3b3XMkGXPfZ@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hansg@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=volodymyrchapman@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox