Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH v2] media: amd: isp4: keep the subdev format when a stream stops
@ 2026-12-01  8:26 Mateo Amado Ares via B4 Relay
  2026-12-01  9:42 ` Bin Du
  0 siblings, 1 reply; 2+ messages in thread
From: Mateo Amado Ares via B4 Relay @ 2026-12-01  8:26 UTC (permalink / raw)
  To: Bin Du, Nirujogi Pratap, Mauro Carvalho Chehab
  Cc: Sakari Ailus, Sultan Alsawaf, Mario Limonciello, linux-media,
	stable, Mateo Amado Ares

From: Mateo Amado Ares <mateoamadoares@gmail.com>

isp4sd_uninit_stream() clears the subdev pad format when a stream stops,
but the video node only sets it at probe and on VIDIOC_S_FMT. Restarting
a stream without S_FMT, which Chromium does during video calls, then
fails:

  amd_isp_capture amd_isp_capture: fail to get out prop
  amd_isp_capture amd_isp_capture: fail to setup output

Keep the format across stream stop.

Fixes: 4e5e7a7ddb4a ("media: platform: amd: isp4 subdev and firmware loading handling added")
Cc: stable@vger.kernel.org
Suggested-by: Bin Du <bin.du@amd.com>
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Mateo Amado Ares <mateoamadoares@gmail.com>
---
Sultan, if you already have a fix for this, I'm happy to drop mine.

Tested on an HP ZBook Ultra G1a with v7.3.6 plus Caspar's deadlock fix:
STREAMOFF/STREAMON without S_FMT now streams frames instead of failing.

Changes in v2:
- Drop patch 1, a duplicate of Caspar's fix [1].
- Keep the format on stream stop instead of setting it on every start
  (Bin).
- Link to v1: https://lore.kernel.org/r/20261130-isp4-start-stream-deadlock-v1-0-9bf5a6647ef9@gmail.com

[1] https://lore.kernel.org/all/20261028-isp4-start-stream-deadlock-v1-1-babd80273148@proton.me/
---
 drivers/media/platform/amd/isp4/isp4_subdev.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/media/platform/amd/isp4/isp4_subdev.c b/drivers/media/platform/amd/isp4/isp4_subdev.c
index a108d90ac..5b63909d3 100644
--- a/drivers/media/platform/amd/isp4/isp4_subdev.c
+++ b/drivers/media/platform/amd/isp4/isp4_subdev.c
@@ -354,15 +354,6 @@ static void isp4sd_uninit_stream(struct isp4_subdev *isp_subdev,
 	struct isp4sd_sensor_info *sensor_info = &isp_subdev->sensor_info;
 	struct isp4sd_output_info *output_info = &sensor_info->output_info;
 	struct isp4_interface *ispif = &isp_subdev->ispif;
-	struct v4l2_mbus_framefmt *format;
-
-	format = v4l2_subdev_state_get_format(state, pad, 0);
-	if (!format) {
-		dev_err(isp_subdev->dev, "fail to get v4l2 format\n");
-	} else {
-		memset(format, 0, sizeof(*format));
-		format->code = MEDIA_BUS_FMT_YUYV8_1_5X8;
-	}
 
 	isp4if_clear_bufq(ispif);
 	isp4if_clear_cmdq(ispif);

---
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
change-id: 20261130-isp4-start-stream-deadlock-08e421deb181

Best regards,
--  
Mateo Amado Ares <mateoamadoares@gmail.com>



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

* Re: [PATCH v2] media: amd: isp4: keep the subdev format when a stream stops
  2026-12-01  8:26 [PATCH v2] media: amd: isp4: keep the subdev format when a stream stops Mateo Amado Ares via B4 Relay
@ 2026-12-01  9:42 ` Bin Du
  0 siblings, 0 replies; 2+ messages in thread
From: Bin Du @ 2026-12-01  9:42 UTC (permalink / raw)
  To: mateoamadoares, Nirujogi Pratap, Mauro Carvalho Chehab
  Cc: Sakari Ailus, Sultan Alsawaf, Mario Limonciello, linux-media,
	stable, Chan, Benjamin (Koon Pan), Li, King



On 12/1/2026 4:26 PM, Mateo Amado Ares via B4 Relay wrote:
> 
> From: Mateo Amado Ares <mateoamadoares@gmail.com>
> 
> isp4sd_uninit_stream() clears the subdev pad format when a stream stops,
> but the video node only sets it at probe and on VIDIOC_S_FMT. Restarting
> a stream without S_FMT, which Chromium does during video calls, then
> fails:
> 
>   amd_isp_capture amd_isp_capture: fail to get out prop
>   amd_isp_capture amd_isp_capture: fail to setup output
> 
> Keep the format across stream stop.
> 
> Fixes: 4e5e7a7ddb4a ("media: platform: amd: isp4 subdev and firmware loading handling added")
> Cc: stable@vger.kernel.org
> Suggested-by: Bin Du <bin.du@amd.com>
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Mateo Amado Ares <mateoamadoares@gmail.com>
> ---
> Sultan, if you already have a fix for this, I'm happy to drop mine.
> 
> Tested on an HP ZBook Ultra G1a with v7.3.6 plus Caspar's deadlock fix:
> STREAMOFF/STREAMON without S_FMT now streams frames instead of failing.
> 
> Changes in v2:
> - Drop patch 1, a duplicate of Caspar's fix [1].
> - Keep the format on stream stop instead of setting it on every start
>   (Bin).
> - Link to v1: https://lore.kernel.org/r/20261130-isp4-start-stream-deadlock-v1-0-9bf5a6647ef9@gmail.com
> 
> [1] https://lore.kernel.org/all/20261028-isp4-start-stream-deadlock-v1-1-babd80273148@proton.me/
> ---
>  drivers/media/platform/amd/isp4/isp4_subdev.c | 9 ---------
>  1 file changed, 9 deletions(-)
> 
> diff --git a/drivers/media/platform/amd/isp4/isp4_subdev.c b/drivers/media/platform/amd/isp4/isp4_subdev.c
> index a108d90ac..5b63909d3 100644
> --- a/drivers/media/platform/amd/isp4/isp4_subdev.c
> +++ b/drivers/media/platform/amd/isp4/isp4_subdev.c
> @@ -354,15 +354,6 @@ static void isp4sd_uninit_stream(struct isp4_subdev *isp_subdev,
>         struct isp4sd_sensor_info *sensor_info = &isp_subdev->sensor_info;
>         struct isp4sd_output_info *output_info = &sensor_info->output_info;
>         struct isp4_interface *ispif = &isp_subdev->ispif;
> -       struct v4l2_mbus_framefmt *format;
> -
> -       format = v4l2_subdev_state_get_format(state, pad, 0);
> -       if (!format) {
> -               dev_err(isp_subdev->dev, "fail to get v4l2 format\n");
> -       } else {
> -               memset(format, 0, sizeof(*format));
> -               format->code = MEDIA_BUS_FMT_YUYV8_1_5X8;
> -       }
> 

state and pad are now unused in isp4sd_uninit_stream(). Please remove
both parameters and update the call site accordingly.

This cleanup overlaps with Caspar's deadlock fix:
https://lore.kernel.org/all/20261028-isp4-start-stream-deadlock-v1-1-babd80273148@proton.me/

Could you base the revised patch on it to avoid the patch-context
conflict?

>         isp4if_clear_bufq(ispif);
>         isp4if_clear_cmdq(ispif);
> 
> ---
> base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
> change-id: 20261130-isp4-start-stream-deadlock-08e421deb181
> 
> Best regards,
> --
> Mateo Amado Ares <mateoamadoares@gmail.com>

Regards,
Bin


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

end of thread, other threads:[~2026-12-01  9:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01  8:26 [PATCH v2] media: amd: isp4: keep the subdev format when a stream stops Mateo Amado Ares via B4 Relay
2026-12-01  9:42 ` Bin Du

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