mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* What should bridge drivers use instead of __v4l2_subdev_state_alloc()?
@ 2026-11-08  1:31 DelaySystem
  2026-11-08 10:25 ` Laurent Pinchart
  0 siblings, 1 reply; 4+ messages in thread
From: DelaySystem @ 2026-11-08  1:31 UTC (permalink / raw)
  To: linux-media
  Cc: Mauro Carvalho Chehab, Sakari Ailus, Laurent Pinchart,
	Hans Verkuil, Tomi Valkeinen, Jacopo Mondi, linux-kernel,
	DelaySystem


Hello,

While working on drivers/staging/media/tegra-video I ran into the FIXME
above __tegra_channel_try_format() in vi.c (added by commit 40aaab9d773b
in 2022):

	/* FIXME: Drop this call, drivers are not supposed to use
	 * __v4l2_subdev_state_alloc(). */

The driver needs a scratch TRY state to negotiate formats with the remote
sensor subdev from video-node ioctl context, where no subdev file handle
exists. I looked for the intended replacement, but:

- there is no non-dunder allocator in drivers/media or include/media;
- v4l2_subdev_call_state_try() is documented for legacy non-MC drivers
  only, has no in-tree users, and allocates one state per call, while the
  driver needs one state across enum_frame_size + set_fmt + get_crop;
- the active-state APIs have the wrong semantics here, since try_fmt must
  not disturb ACTIVE state;
- the same FIXME is still present in mainline vsp1 and staging atomisp,
  and mainline stm32-dcmi still calls the dunder directly, with (as far
  as I can tell) zero conversions since the 2022 rename.

So my question: is a new core helper the intended direction for the
bridge-driver scratch-TRY-state case, and if so, is there any guidance
on the shape it should take? Or is there an existing pattern I missed?

If a new helper is the answer, I am happy to implement it and convert
the in-tree users.

Thank you,
DelaySystem


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What should bridge drivers use instead of __v4l2_subdev_state_alloc()?
  2026-11-08  1:31 What should bridge drivers use instead of __v4l2_subdev_state_alloc()? DelaySystem
@ 2026-11-08 10:25 ` Laurent Pinchart
  2026-11-08 16:05   ` Tomi Valkeinen
  0 siblings, 1 reply; 4+ messages in thread
From: Laurent Pinchart @ 2026-11-08 10:25 UTC (permalink / raw)
  To: DelaySystem
  Cc: linux-media, Mauro Carvalho Chehab, Sakari Ailus, Hans Verkuil,
	Tomi Valkeinen, Jacopo Mondi, linux-kernel

On Sat, Nov 07, 2026 at 05:31:06PM -0800, DelaySystem wrote:
> 
> Hello,
> 
> While working on drivers/staging/media/tegra-video I ran into the FIXME
> above __tegra_channel_try_format() in vi.c (added by commit 40aaab9d773b
> in 2022):
> 
> 	/* FIXME: Drop this call, drivers are not supposed to use
> 	 * __v4l2_subdev_state_alloc(). */
> 
> The driver needs a scratch TRY state to negotiate formats with the remote
> sensor subdev from video-node ioctl context, where no subdev file handle
> exists. I looked for the intended replacement, but:
> 
> - there is no non-dunder allocator in drivers/media or include/media;
> - v4l2_subdev_call_state_try() is documented for legacy non-MC drivers
>   only, has no in-tree users, and allocates one state per call, while the
>   driver needs one state across enum_frame_size + set_fmt + get_crop;
> - the active-state APIs have the wrong semantics here, since try_fmt must
>   not disturb ACTIVE state;
> - the same FIXME is still present in mainline vsp1 and staging atomisp,
>   and mainline stm32-dcmi still calls the dunder directly, with (as far
>   as I can tell) zero conversions since the 2022 rename.
> 
> So my question: is a new core helper the intended direction for the
> bridge-driver scratch-TRY-state case, and if so, is there any guidance
> on the shape it should take? Or is there an existing pattern I missed?
> 
> If a new helper is the answer, I am happy to implement it and convert
> the in-tree users.

No, that's not the answer.

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What should bridge drivers use instead of __v4l2_subdev_state_alloc()?
  2026-11-08 10:25 ` Laurent Pinchart
@ 2026-11-08 16:05   ` Tomi Valkeinen
  2026-11-08 16:14     ` Laurent Pinchart
  0 siblings, 1 reply; 4+ messages in thread
From: Tomi Valkeinen @ 2026-11-08 16:05 UTC (permalink / raw)
  To: Laurent Pinchart, DelaySystem
  Cc: linux-media, Mauro Carvalho Chehab, Sakari Ailus, Hans Verkuil,
	Jacopo Mondi, linux-kernel

Hi,

On 08/11/2026 12:25, Laurent Pinchart wrote:
> On Sat, Nov 07, 2026 at 05:31:06PM -0800, DelaySystem wrote:
>>
>> Hello,
>>
>> While working on drivers/staging/media/tegra-video I ran into the FIXME
>> above __tegra_channel_try_format() in vi.c (added by commit 40aaab9d773b
>> in 2022):
>>
>> 	/* FIXME: Drop this call, drivers are not supposed to use
>> 	 * __v4l2_subdev_state_alloc(). */
>>
>> The driver needs a scratch TRY state to negotiate formats with the remote
>> sensor subdev from video-node ioctl context, where no subdev file handle
>> exists. I looked for the intended replacement, but:
>>
>> - there is no non-dunder allocator in drivers/media or include/media;
>> - v4l2_subdev_call_state_try() is documented for legacy non-MC drivers
>>    only, has no in-tree users, and allocates one state per call, while the
>>    driver needs one state across enum_frame_size + set_fmt + get_crop;
>> - the active-state APIs have the wrong semantics here, since try_fmt must
>>    not disturb ACTIVE state;
>> - the same FIXME is still present in mainline vsp1 and staging atomisp,
>>    and mainline stm32-dcmi still calls the dunder directly, with (as far
>>    as I can tell) zero conversions since the 2022 rename.
>>
>> So my question: is a new core helper the intended direction for the
>> bridge-driver scratch-TRY-state case, and if so, is there any guidance
>> on the shape it should take? Or is there an existing pattern I missed?
>>
>> If a new helper is the answer, I am happy to implement it and convert
>> the in-tree users.
> 
> No, that's not the answer.
I think converting to MC is the answer. At least for a staging driver.

  Tomi


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What should bridge drivers use instead of __v4l2_subdev_state_alloc()?
  2026-11-08 16:05   ` Tomi Valkeinen
@ 2026-11-08 16:14     ` Laurent Pinchart
  0 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2026-11-08 16:14 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: DelaySystem, linux-media, Mauro Carvalho Chehab, Sakari Ailus,
	Hans Verkuil, Jacopo Mondi, linux-kernel

On Sun, Nov 08, 2026 at 06:05:34PM +0200, Tomi Valkeinen wrote:
> On 08/11/2026 12:25, Laurent Pinchart wrote:
> > On Sat, Nov 07, 2026 at 05:31:06PM -0800, DelaySystem wrote:
> >>
> >> Hello,
> >>
> >> While working on drivers/staging/media/tegra-video I ran into the FIXME
> >> above __tegra_channel_try_format() in vi.c (added by commit 40aaab9d773b
> >> in 2022):
> >>
> >> 	/* FIXME: Drop this call, drivers are not supposed to use
> >> 	 * __v4l2_subdev_state_alloc(). */
> >>
> >> The driver needs a scratch TRY state to negotiate formats with the remote
> >> sensor subdev from video-node ioctl context, where no subdev file handle
> >> exists. I looked for the intended replacement, but:
> >>
> >> - there is no non-dunder allocator in drivers/media or include/media;
> >> - v4l2_subdev_call_state_try() is documented for legacy non-MC drivers
> >>    only, has no in-tree users, and allocates one state per call, while the
> >>    driver needs one state across enum_frame_size + set_fmt + get_crop;
> >> - the active-state APIs have the wrong semantics here, since try_fmt must
> >>    not disturb ACTIVE state;
> >> - the same FIXME is still present in mainline vsp1 and staging atomisp,
> >>    and mainline stm32-dcmi still calls the dunder directly, with (as far
> >>    as I can tell) zero conversions since the 2022 rename.
> >>
> >> So my question: is a new core helper the intended direction for the
> >> bridge-driver scratch-TRY-state case, and if so, is there any guidance
> >> on the shape it should take? Or is there an existing pattern I missed?
> >>
> >> If a new helper is the answer, I am happy to implement it and convert
> >> the in-tree users.
> > 
> > No, that's not the answer.
> 
> I think converting to MC is the answer. At least for a staging driver.

Note that usage of LLMs is not allowed in drivers/staging/

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-08 16:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-08  1:31 What should bridge drivers use instead of __v4l2_subdev_state_alloc()? DelaySystem
2026-11-08 10:25 ` Laurent Pinchart
2026-11-08 16:05   ` Tomi Valkeinen
2026-11-08 16:14     ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®