YUYV is a packed YUV format, and there is no chorma plane

Signed-off-by: Leo Liu <leo....@amd.com>
---
 src/gallium/drivers/radeon/radeon_uvd.c | 8 ++++++--
 src/gallium/drivers/radeonsi/si_uvd.c   | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_uvd.c 
b/src/gallium/drivers/radeon/radeon_uvd.c
index 59d1f199e9..5e5638d565 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.c
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
@@ -1543,6 +1543,8 @@ void ruvd_set_dt_surfaces(struct ruvd_msg *msg, struct 
radeon_surf *luma,
        default:
        case RUVD_SURFACE_TYPE_LEGACY:
                msg->body.decode.dt_pitch = luma->u.legacy.level[0].nblk_x;
+               if (!chroma)
+                       msg->body.decode.dt_pitch *= 2;
                switch (luma->u.legacy.level[0].mode) {
                case RADEON_SURF_MODE_LINEAR_ALIGNED:
                        msg->body.decode.dt_tiling_mode = RUVD_TILE_LINEAR;
@@ -1562,10 +1564,12 @@ void ruvd_set_dt_surfaces(struct ruvd_msg *msg, struct 
radeon_surf *luma,
                }
 
                msg->body.decode.dt_luma_top_offset = texture_offset(luma, 0, 
type);
-               msg->body.decode.dt_chroma_top_offset = texture_offset(chroma, 
0, type);
+               if (chroma)
+                       msg->body.decode.dt_chroma_top_offset = 
texture_offset(chroma, 0, type);
                if (msg->body.decode.dt_field_mode) {
                        msg->body.decode.dt_luma_bottom_offset = 
texture_offset(luma, 1, type);
-                       msg->body.decode.dt_chroma_bottom_offset = 
texture_offset(chroma, 1, type);
+                       if (chroma)
+                               msg->body.decode.dt_chroma_bottom_offset = 
texture_offset(chroma, 1, type);
                } else {
                        msg->body.decode.dt_luma_bottom_offset = 
msg->body.decode.dt_luma_top_offset;
                        msg->body.decode.dt_chroma_bottom_offset = 
msg->body.decode.dt_chroma_top_offset;
diff --git a/src/gallium/drivers/radeonsi/si_uvd.c 
b/src/gallium/drivers/radeonsi/si_uvd.c
index d17a6656a4..2441ad248c 100644
--- a/src/gallium/drivers/radeonsi/si_uvd.c
+++ b/src/gallium/drivers/radeonsi/si_uvd.c
@@ -131,7 +131,7 @@ static struct pb_buffer* si_uvd_set_dtb(struct ruvd_msg 
*msg, struct vl_video_bu
 
        msg->body.decode.dt_field_mode = buf->base.interlaced;
 
-       ruvd_set_dt_surfaces(msg, &luma->surface, &chroma->surface, type);
+       ruvd_set_dt_surfaces(msg, &luma->surface, (chroma) ? &chroma->surface : 
NULL, type);
 
        return luma->resource.buf;
 }
-- 
2.11.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to