Module: Mesa
Branch: main
Commit: cfd24047a1d901d209b18828fd91f9ec36ef0fed
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cfd24047a1d901d209b18828fd91f9ec36ef0fed

Author: David Rosca <[email protected]>
Date:   Sun Jul 16 17:34:20 2023 +0200

radeonsi/vcn: Don't use chroma in AV1 encode with RGB input

Fixes: 64eab1f3ae

Reviewed-by: Ruijing Dong <[email protected]>
Reviewed-by: Thong Thai <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24170>

---

 src/gallium/drivers/radeonsi/radeon_vcn_enc_4_0.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/radeon_vcn_enc_4_0.c 
b/src/gallium/drivers/radeonsi/radeon_vcn_enc_4_0.c
index ffe5e7c3dfb..4a9ee9c7589 100644
--- a/src/gallium/drivers/radeonsi/radeon_vcn_enc_4_0.c
+++ b/src/gallium/drivers/radeonsi/radeon_vcn_enc_4_0.c
@@ -892,7 +892,8 @@ static void radeon_enc_av1_encode_params(struct 
radeon_encoder *enc)
 
    enc->enc_pic.enc_params.allowed_max_bitstream_size = enc->bs_size;
    enc->enc_pic.enc_params.input_pic_luma_pitch = enc->luma->u.gfx9.surf_pitch;
-   enc->enc_pic.enc_params.input_pic_chroma_pitch = 
enc->chroma->u.gfx9.surf_pitch;
+   enc->enc_pic.enc_params.input_pic_chroma_pitch = enc->chroma ?
+      enc->chroma->u.gfx9.surf_pitch : enc->luma->u.gfx9.surf_pitch;
    enc->enc_pic.enc_params.input_pic_swizzle_mode = 
enc->luma->u.gfx9.swizzle_mode;
 
    RADEON_ENC_BEGIN(enc->cmd.enc_params);
@@ -907,7 +908,8 @@ static void radeon_enc_av1_encode_params(struct 
radeon_encoder *enc)
       RADEON_ENC_CS(0);
    } else {
       RADEON_ENC_READ(enc->handle, RADEON_DOMAIN_VRAM, 
enc->luma->u.gfx9.surf_offset);
-      RADEON_ENC_READ(enc->handle, RADEON_DOMAIN_VRAM, 
enc->chroma->u.gfx9.surf_offset);
+      RADEON_ENC_READ(enc->handle, RADEON_DOMAIN_VRAM, enc->chroma ?
+         enc->chroma->u.gfx9.surf_offset : enc->luma->u.gfx9.surf_pitch);
    }
 
    RADEON_ENC_CS(enc->enc_pic.enc_params.input_pic_luma_pitch);

Reply via email to