drm/amdgpu: update kernel vcn ring test
authorSaleemkhan Jamadar <saleemkhan.jamadar@amd.com>
Mon, 26 Jun 2023 09:20:51 +0000 (14:50 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 12 Jul 2023 15:12:10 +0000 (11:12 -0400)
add session context buffer to decoder ring test for vcn v1 to v3.

v3 - correct the cmd for sesssion ctx buf
v2 - add the buffer into IB (Leo liu)

Signed-off-by: Saleemkhan Jamadar <saleemkhan.jamadar@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c

index 8e83fd9e55bed59fdc8af8d0ef68e53e05b02a83..57b62ab0178802031fac2624ba2c466a160e466b 100644 (file)
@@ -521,6 +521,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
                                   struct dma_fence **fence)
 {
        u64 addr = AMDGPU_GPU_PAGE_ALIGN(ib_msg->gpu_addr);
+       uint64_t session_ctx_buf_gaddr = AMDGPU_GPU_PAGE_ALIGN(ib_msg->gpu_addr + 8192);
        struct amdgpu_device *adev = ring->adev;
        struct dma_fence *f = NULL;
        struct amdgpu_job *job;
@@ -534,13 +535,23 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring,
                goto err;
 
        ib = &job->ibs[0];
-       ib->ptr[0] = PACKET0(adev->vcn.internal.data0, 0);
-       ib->ptr[1] = addr;
-       ib->ptr[2] = PACKET0(adev->vcn.internal.data1, 0);
-       ib->ptr[3] = addr >> 32;
-       ib->ptr[4] = PACKET0(adev->vcn.internal.cmd, 0);
-       ib->ptr[5] = 0;
-       for (i = 6; i < 16; i += 2) {
+       ib->length_dw = 0;
+       ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.data0, 0);
+       ib->ptr[ib->length_dw++] = lower_32_bits(session_ctx_buf_gaddr);
+       ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.data1, 0);
+       ib->ptr[ib->length_dw++] = upper_32_bits(session_ctx_buf_gaddr);
+       /* session ctx buffer cmd */
+       ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.cmd, 0);
+       ib->ptr[ib->length_dw++] = 0xa;
+
+       ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.data0, 0);
+       ib->ptr[ib->length_dw++] = lower_32_bits(addr);
+       ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.data1, 0);
+       ib->ptr[ib->length_dw++] = upper_32_bits(addr);
+       ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.cmd, 0);
+       ib->ptr[ib->length_dw++] = 0;
+
+       for (i = ib->length_dw; i < 16; i += 2) {
                ib->ptr[i] = PACKET0(adev->vcn.internal.nop, 0);
                ib->ptr[i+1] = 0;
        }