A mistake crept in
commit [SHA TBD]

After the VCN unified header is emitted the rest of the commands must not
overwrite them but append to the buffer.

Signed-off-by: Tvrtko Ursulin <[email protected]>
Cc: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
index 2295578d6330..8f75cfe3239f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
@@ -815,7 +815,7 @@ static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring 
*ring,
                goto err;
 
        ib = &job->ibs[0];
-       ptr = ib->ptr;
+       ib->length_dw = 0;
 
        /* single queue headers */
        if (adev->vcn.inst[ring->me].using_unified_queue) {
@@ -824,6 +824,8 @@ static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring 
*ring,
                ib_checksum = amdgpu_vcn_unified_ring_ib_header(ib, 
ib_pack_in_dw, false);
        }
 
+       ptr = &ib->ptr[ib->length_dw];
+
        *ptr++ = sizeof(struct amdgpu_vcn_decode_buffer) + 8;
        *ptr++ = cpu_to_le32(AMDGPU_VCN_IB_FLAG_DECODE_BUFFER);
        decode_buffer = (struct amdgpu_vcn_decode_buffer *)ptr;
@@ -947,12 +949,14 @@ static int amdgpu_vcn_enc_get_create_msg(struct 
amdgpu_ring *ring, uint32_t hand
                return r;
 
        ib = &job->ibs[0];
-       ptr = ib->ptr;
+       ib->length_dw = 0;
        addr = AMDGPU_GPU_PAGE_ALIGN(ib_msg->gpu_addr);
 
        if (adev->vcn.inst[ring->me].using_unified_queue)
                ib_checksum = amdgpu_vcn_unified_ring_ib_header(ib, 0x11, true);
 
+       ptr = &ib->ptr[ib->length_dw];
+
        *ptr++ = 0x00000018;
        *ptr++ = 0x00000001; /* session info */
        *ptr++ = handle;
@@ -1016,12 +1020,14 @@ static int amdgpu_vcn_enc_get_destroy_msg(struct 
amdgpu_ring *ring, uint32_t han
                return r;
 
        ib = &job->ibs[0];
-       ptr = ib->ptr;
+       ib->length_dw = 0;
        addr = AMDGPU_GPU_PAGE_ALIGN(ib_msg->gpu_addr);
 
        if (adev->vcn.inst[ring->me].using_unified_queue)
                ib_checksum = amdgpu_vcn_unified_ring_ib_header(ib, 0x11, true);
 
+       ptr = &ib->ptr[ib->length_dw];
+
        *ptr++ = 0x00000018;
        *ptr++ = 0x00000001;
        *ptr++ = handle;
-- 
2.48.0

Reply via email to