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.liu@amd.com>
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25013>
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;