Skip to contentSkip to conversation

media: verisilicon: HEVC: Initialize start_bit field

PATCH Superseded Benjamin Gaignard 3 participants 6 messages Jan 20, 2025

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Benjamin Gaignard

author maintainer
#0 lore raw

PATCH 1/1 media: verisilicon: HEVC: Initialize start_bit field

Always set start_bit field to 0, if not it could lead to corrupted frames specially when decoding VP9 bitstreams at the same time since VP9 driver set it for it own purpose.

---
 drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c +1 -0
index 85a44143b378..0e212198dd65 100644
@@ -518,6 +518,7 @@ static void set_buffers(struct hantro_ctx *ctx)
 	hantro_reg_write(vpu, &g2_stream_len, src_len);
 	hantro_reg_write(vpu, &g2_strm_buffer_len, src_buf_len);
 	hantro_reg_write(vpu, &g2_strm_start_offset, 0);
+	hantro_reg_write(vpu, &g2_start_bit, 0);
 	hantro_reg_write(vpu, &g2_write_mvs_e, 1);
 
 	hantro_write_addr(vpu, G2_TILE_SIZES_ADDR, ctx->hevc_dec.tile_sizes.dma);
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

Le 20/01/2025 à 09:10, Benjamin Gaignard a écrit :

Quoted 5 lines

Always set start_bit field to 0, if not it could lead to corrupted frames specially when decoding VP9 bitstreams at the same time since VP9 driver set it for it own purpose.

I could add this tag:

Fixes cb5dd5a0fa518 ("media: hantro: Introduce G2/HEVC decoder")
Quoted 16 lines
---
  drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c | 1 +
  1 file changed, 1 insertion(+)
drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c +1 -0
index 85a44143b378..0e212198dd65 100644
@@ -518,6 +518,7 @@ static void set_buffers(struct hantro_ctx *ctx)
  	hantro_reg_write(vpu, &g2_stream_len, src_len);
  	hantro_reg_write(vpu, &g2_strm_buffer_len, src_buf_len);
  	hantro_reg_write(vpu, &g2_strm_start_offset, 0);
+	hantro_reg_write(vpu, &g2_start_bit, 0);
  	hantro_reg_write(vpu, &g2_write_mvs_e, 1);
 
  	hantro_write_addr(vpu, G2_TILE_SIZES_ADDR, ctx->hevc_dec.tile_sizes.dma);
maintainer Tested-by Reviewed-by
#2 lore raw

Le lundi 20 janvier 2025 à 11:00 +0100, Benjamin Gaignard a écrit :

Quoted 4 lines

Le 20/01/2025 à 09:10, Benjamin Gaignard a écrit :

Quoted 3 lines

Always set start_bit field to 0, if not it could lead to corrupted frames specially when decoding VP9 bitstreams at the same time since VP9 driver set it for it own purpose.

its

Quoted 6 lines
Quoted 2 lines

I could add this tag:

Fixes cb5dd5a0fa518 ("media: hantro: Introduce G2/HEVC decoder")

I have tested this on IMX8MQ board using the following GStreamer pipeline. Before the change, the HEVC window was entirely corrupted. The streams don't matter as long as they use both HEVC and VP9 codec.

gst-launch-1.0 \
filesrc location=hevc.mp4 ! parsebin ! v4l2slh265dec ! fakevideosink \
filesrc location=vp9.mkv ! parsebin ! v4l2slvp9dec ! fakevideosink

Quoted 5 lines
Quoted 5 lines
---
  drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c | 1 +
  1 file changed, 1 insertion(+)
Quoted 10 lines

drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c static void set_buffers(struct hantro_ctx *ctx) · line 522

Quoted 10 lines
drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c +1 -0
index 85a44143b378..0e212198dd65 100644
@@ -518,6 +518,7 @@ static void set_buffers(struct hantro_ctx *ctx)
  	hantro_reg_write(vpu, &g2_stream_len, src_len);
  	hantro_reg_write(vpu, &g2_strm_buffer_len, src_buf_len);
  	hantro_reg_write(vpu, &g2_strm_start_offset, 0);
+	hantro_reg_write(vpu, &g2_start_bit, 0);
  	hantro_reg_write(vpu, &g2_write_mvs_e, 1);

I've also crossed against "decoder_swreg_map_g2.xlsx" documentation, if you are lucky to have access to that, and within swreg5 there is only g2_tempor_mvp_e that is also shared, and its already being set in both drivers.

Quoted 3 lines
Quoted 2 lines
drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c +0 -0
  	hantro_write_addr(vpu, G2_TILE_SIZES_ADDR, ctx->hevc_dec.tile_sizes.dma);
#3 lore raw
Quoted 9 lines · Nicolas Dufresne
Quoted 4 lines · Benjamin Gaignard
Quoted 3 lines · Benjamin Gaignard

Always set start_bit field to 0, if not it could lead to corrupted frames specially when decoding VP9 bitstreams at the same time since VP9 driver set it for it own purpose.

its

Does this impact the Fluster score?

Quoted 46 lines
Quoted 6 lines
Quoted 2 lines

I could add this tag:

Fixes cb5dd5a0fa518 ("media: hantro: Introduce G2/HEVC decoder")

I have tested this on IMX8MQ board using the following GStreamer pipeline. Before the change, the HEVC window was entirely corrupted. The streams don't matter as long as they use both HEVC and VP9 codec.

gst-launch-1.0 \
filesrc location=hevc.mp4 ! parsebin ! v4l2slh265dec ! fakevideosink \
filesrc location=vp9.mkv ! parsebin ! v4l2slvp9dec ! fakevideosink

Quoted 5 lines
Quoted 5 lines
---
  drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c | 1 +
  1 file changed, 1 insertion(+)
Quoted 10 lines

drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c static void set_buffers(struct hantro_ctx *ctx) · line 522

Quoted 10 lines
drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c +1 -0
index 85a44143b378..0e212198dd65 100644
@@ -518,6 +518,7 @@ static void set_buffers(struct hantro_ctx *ctx)
    hantro_reg_write(vpu, &g2_stream_len, src_len);
    hantro_reg_write(vpu, &g2_strm_buffer_len, src_buf_len);
    hantro_reg_write(vpu, &g2_strm_start_offset, 0);
+   hantro_reg_write(vpu, &g2_start_bit, 0);
    hantro_reg_write(vpu, &g2_write_mvs_e, 1);

I've also crossed against "decoder_swreg_map_g2.xlsx" documentation, if you are lucky to have access to that, and within swreg5 there is only g2_tempor_mvp_e that is also shared, and its already being set in both drivers.

Quoted 3 lines
Quoted 2 lines
drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c +0 -0
    hantro_write_addr(vpu, G2_TILE_SIZES_ADDR, ctx->hevc_dec.tile_sizes.dma);
author maintainer
#4 lore raw

Le 20/01/2025 à 15:15, Adam Ford a écrit :

Quoted 10 lines
Quoted 7 lines · Nicolas Dufresne
Quoted 4 lines · Benjamin Gaignard
Quoted 3 lines · Benjamin Gaignard

Always set start_bit field to 0, if not it could lead to corrupted frames specially when decoding VP9 bitstreams at the same time since VP9 driver set it for it own purpose.

its

Does this impact the Fluster score?

No because that happens only when decoding VP9 and HEVC bitstreams at the same time.

Quoted 34 lines
Quoted 34 lines
Quoted 5 lines
Quoted 2 lines

I could add this tag:

Fixes cb5dd5a0fa518 ("media: hantro: Introduce G2/HEVC decoder")

I have tested this on IMX8MQ board using the following GStreamer pipeline. Before the change, the HEVC window was entirely corrupted. The streams don't matter as long as they use both HEVC and VP9 codec.

gst-launch-1.0 \
filesrc location=hevc.mp4 ! parsebin ! v4l2slh265dec ! fakevideosink \
filesrc location=vp9.mkv ! parsebin ! v4l2slvp9dec ! fakevideosink

Quoted 4 lines
Quoted 4 lines
---
   drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c | 1 +
   1 file changed, 1 insertion(+)
Quoted 10 lines

drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c static void set_buffers(struct hantro_ctx *ctx) · line 522

Quoted 10 lines
drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c +1 -0
index 85a44143b378..0e212198dd65 100644
@@ -518,6 +518,7 @@ static void set_buffers(struct hantro_ctx *ctx)
     hantro_reg_write(vpu, &g2_stream_len, src_len);
     hantro_reg_write(vpu, &g2_strm_buffer_len, src_buf_len);
     hantro_reg_write(vpu, &g2_strm_start_offset, 0);
+   hantro_reg_write(vpu, &g2_start_bit, 0);
     hantro_reg_write(vpu, &g2_write_mvs_e, 1);

I've also crossed against "decoder_swreg_map_g2.xlsx" documentation, if you are lucky to have access to that, and within swreg5 there is only g2_tempor_mvp_e that is also shared, and its already being set in both drivers.

Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c +0 -0
     hantro_write_addr(vpu, G2_TILE_SIZES_ADDR, ctx->hevc_dec.tile_sizes.dma);

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

maintainer
#5 lore raw
In reply to Adam Ford

Le lundi 20 janvier 2025 à 08:15 -0600, Adam Ford a écrit :

Quoted 5 lines
Quoted 3 lines · Nicolas Dufresne
Quoted 1 line · Benjamin Gaignard

Le 20/01/2025 à 09:10, Benjamin Gaignard a écrit :

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

Always set start_bit field to 0, if not it could lead to corrupted frames specially when decoding VP9 bitstreams at the same time since VP9 driver set it for it own purpose.

its

Does this impact the Fluster score?

Only if you concurrently test VP9 and HEVC at the same time. Fluster does not parallelized across codecs, could be a nice addition to catch more issues.

Nicolas

Quoted 47 lines
Quoted 47 lines
Quoted 7 lines
Quoted 3 lines

I could add this tag:

Fixes cb5dd5a0fa518 ("media: hantro: Introduce G2/HEVC decoder")

I have tested this on IMX8MQ board using the following GStreamer pipeline. Before the change, the HEVC window was entirely corrupted. The streams don't matter as long as they use both HEVC and VP9 codec.

gst-launch-1.0 \
filesrc location=hevc.mp4 ! parsebin ! v4l2slh265dec ! fakevideosink \
filesrc location=vp9.mkv ! parsebin ! v4l2slvp9dec ! fakevideosink

Quoted 5 lines
Quoted 5 lines
---
  drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c | 1 +
  1 file changed, 1 insertion(+)
Quoted 10 lines

drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c static void set_buffers(struct hantro_ctx *ctx) · line 522

Quoted 10 lines
drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c +1 -0
index 85a44143b378..0e212198dd65 100644
@@ -518,6 +518,7 @@ static void set_buffers(struct hantro_ctx *ctx)
    hantro_reg_write(vpu, &g2_stream_len, src_len);
    hantro_reg_write(vpu, &g2_strm_buffer_len, src_buf_len);
    hantro_reg_write(vpu, &g2_strm_start_offset, 0);
+   hantro_reg_write(vpu, &g2_start_bit, 0);
    hantro_reg_write(vpu, &g2_write_mvs_e, 1);

I've also crossed against "decoder_swreg_map_g2.xlsx" documentation, if you are lucky to have access to that, and within swreg5 there is only g2_tempor_mvp_e that is also shared, and its already being set in both drivers.

Quoted 3 lines
Quoted 2 lines
drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c +0 -0
    hantro_write_addr(vpu, G2_TILE_SIZES_ADDR, ctx->hevc_dec.tile_sizes.dma);