Skip to contentSkip to conversation

media: verisilicon: Fix format enumeration when post-processor is mandatory

PATCH In review Benjamin Gaignard 2 participants 3 messages Apr 28 – Apr 29

Subsystems (3)
lore
Share & tools
lore

Benjamin Gaignard

author maintainer
#0 lore raw

PATCH 1/1 media: verisilicon: Fix format enumeration when post-processor is mandatory

When a post-processor pixel format is mandatory (i.e. when an AV1 bitstream use film grain feature) the driver must only enumerate post-processed format.
Use the context format to know what is suppose to be enumerated.

Fixes 80c7373a456e ("media: verisilicon: Conditionally ignore native formats")
---
 drivers/media/platform/verisilicon/hantro_v4l2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/verisilicon/hantro_v4l2.c +1 -1
index fcf3bd9bcda2..f538d4562744 100644
@@ -242,7 +242,7 @@ static int vidioc_enum_fmt(struct file *file, void *priv,
 	 */
 	skip_mode_none = capture == ctx->is_encoder;
 
-	formats = hantro_get_formats(ctx, &num_fmts, HANTRO_AUTO_POSTPROC);
+	formats = hantro_get_formats(ctx, &num_fmts, ctx->need_postproc);
 	for (i = 0; i < num_fmts; i++) {
 		bool mode_none = formats[i].codec_mode == HANTRO_MODE_NONE;
 		fmt = &formats[i];
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Le mardi 28 avril 2026 à 10:37 +0200, Benjamin Gaignard a écrit :

Quoted 7 lines

When a post-processor pixel format is mandatory (i.e. when an AV1 bitstream use film grain feature) the driver must only enumerate post-processed format.
Use the context format to know what is suppose to be enumerated.

Fixes 80c7373a456e ("media: verisilicon: Conditionally ignore native formats")
Quoted 17 lines

---
 drivers/media/platform/verisilicon/hantro_v4l2.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/verisilicon/hantro_v4l2.c +0 -0
index fcf3bd9bcda2..f538d4562744 100644
@@ -242,7 +242,7 @@ static int vidioc_enum_fmt(struct file *file, void *priv,
  	 */
  	skip_mode_none = capture == ctx->is_encoder;

drivers/media/platform/verisilicon/hantro_v4l2.c +1 -1
-	formats = hantro_get_formats(ctx, &num_fmts, HANTRO_AUTO_POSTPROC);
+	formats = hantro_get_formats(ctx, &num_fmts, ctx->need_postproc);

  for (i = 0; i < num_fmts; i++) {
  bool mode_none = formats[i].codec_mode == HANTRO_MODE_NONE; fmt = &formats[i];

maintainer
#2 lore raw
In reply to Benjamin Gaignard

Hi Benjamin,

Le mardi 28 avril 2026 à 10:37 +0200, Benjamin Gaignard a écrit :

Quoted 21 lines

When a post-processor pixel format is mandatory (i.e. when an AV1 bitstream use film grain feature) the driver must only enumerate post-processed format.
Use the context format to know what is suppose to be enumerated.

Fixes 80c7373a456e ("media: verisilicon: Conditionally ignore native

formats")
---
 drivers/media/platform/verisilicon/hantro_v4l2.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/verisilicon/hantro_v4l2.c +0 -0
index fcf3bd9bcda2..f538d4562744 100644
@@ -242,7 +242,7 @@ static int vidioc_enum_fmt(struct file *file, void *priv,
  	 */
  	skip_mode_none = capture == ctx->is_encoder;

drivers/media/platform/verisilicon/hantro_v4l2.c static int vidioc_enum_fmt(struct file *file, void *priv, · line 245

Quoted 2 lines
drivers/media/platform/verisilicon/hantro_v4l2.c +1 -1
-	formats = hantro_get_formats(ctx, &num_fmts, HANTRO_AUTO_POSTPROC);
+	formats = hantro_get_formats(ctx, &num_fmts, ctx->need_postproc);

Looks like this is a subset of another of your patch, which was pending a commit message fix.

https://patchwork.linuxtv.org/project/linux-media/patch/[email protected]/

I've picked the other patch and applied my commit message suggestion.

Nicolas

Quoted 3 lines

  for (i = 0; i < num_fmts; i++) {
  bool mode_none = formats[i].codec_mode == HANTRO_MODE_NONE; fmt = &formats[i];