Skip to contentSkip to conversation

drm/amdgpu: Fixup VCN IB emission

PATCH New Tvrtko Ursulin 1 participant 1 message Oct 24, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Fixup VCN IB emission

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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +9 -3
index 2295578d6330..8f75cfe3239f 100644
@@ -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;
Signature · 1 line
2.48.0