Module: Mesa
Branch: staging/23.1
Commit: 0621ca00e9634bb87fb14f4b866e0a3aa453a4dd
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0621ca00e9634bb87fb14f4b866e0a3aa453a4dd

Author: Leo Liu <leo....@amd.com>
Date:   Fri Sep  1 18:26:43 2023 -0400

radeonsi/vcn: fix the incorrect dt_size

Issue: For texture with multiple planes, the planes will point to the
same BO with the total size, so current vcn dt_size is incorrect.

(gdb) p/x *((struct si_resource *)(((struct vl_video_buffer 
*)out_surf)->resources[0]))
...
  buf = 0x5555558daa30,
  gpu_address = 0xffff800101000000,
  bo_size = 0xa2000,
...
}
(gdb) p/x *((struct si_resource *)(((struct vl_video_buffer 
*)out_surf)->resources[1]))
...
  buf = 0x5555558daa30,
  gpu_address = 0xffff800101000000,
  bo_size = 0xa2000,
...
}

This is because: in function static struct si_texture 
*si_texture_create_object(),
   if (plane0) {
      /* The buffer is shared with the first plane. */
      resource->bo_size = plane0->buffer.bo_size;
      ...
      radeon_bo_reference(sscreen->ws, &resource->buf, plane0->buffer.buf);
      resource->gpu_address = plane0->buffer.gpu_address;
   }

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9728
Cc: mesa-stable

Signed-off-by: Leo Liu <leo....@amd.com>
Reviewed-by: Ruijing Dong <ruijing.d...@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25013>
(cherry picked from commit 7876a2f68532a2bc5ab044cab726eae7fba328fa)

---

 .pick_status.json                             | 2 +-
 src/gallium/drivers/radeonsi/radeon_vcn_dec.c | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 72d188313ef..231da27b4a3 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1390,7 +1390,7 @@
         "description": "radeonsi/vcn: fix the incorrect dt_size",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/radeonsi/radeon_vcn_dec.c 
b/src/gallium/drivers/radeonsi/radeon_vcn_dec.c
index b1c36c06166..9d14a801b71 100644
--- a/src/gallium/drivers/radeonsi/radeon_vcn_dec.c
+++ b/src/gallium/drivers/radeonsi/radeon_vcn_dec.c
@@ -2149,8 +2149,13 @@ static struct pb_buffer *rvcn_dec_message_decode(struct 
radeon_decoder *dec,
    chroma = (struct si_texture *)((struct vl_video_buffer 
*)out_surf)->resources[1];
 
    decode->dpb_size = (dec->dpb_type != DPB_DYNAMIC_TIER_2) ? 
dec->dpb.res->buf->size : 0;
-   decode->dt_size = si_resource(((struct vl_video_buffer 
*)out_surf)->resources[0])->buf->size +
-                     si_resource(((struct vl_video_buffer 
*)out_surf)->resources[1])->buf->size;
+
+   /* When texture being created, the bo will be created with total size of 
planes,
+    * and all planes point to the same buffer */
+   assert(si_resource(((struct vl_video_buffer 
*)out_surf)->resources[0])->buf->size ==
+      si_resource(((struct vl_video_buffer 
*)out_surf)->resources[1])->buf->size);
+
+   decode->dt_size = si_resource(((struct vl_video_buffer 
*)out_surf)->resources[0])->buf->size;
 
    decode->sct_size = 0;
    decode->sc_coeff_size = 0;

Reply via email to