drm/amdgpu:update kernel vcn ring test
Subsystems (2)
PATCH v3 1/1 drm/amdgpu:update kernel vcn ring test
add session context buffer to decoder ring test.
v3 - indent and v2 changes correction. (Christian) v2 - put the buffer at the end of the IB (Christian)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 13 +++++++++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +11 -2
@@ -573,7 +573,7 @@ static int amdgpu_vcn_dec_get_create_msg(struct amdgpu_ring *ring, uint32_t handint r, i;memset (ib,0 ,sizeof (*ib)); - r =amdgpu_ib_get (adev,NULL ,AMDGPU_GPU_PAGE_SIZE *2 , + r =amdgpu_ib_get (adev,NULL ,AMDGPU_GPU_PAGE_SIZE *34 ,AMDGPU_IB_POOL_DIRECT , ib);if (r)
@@ -608,7 +608,7 @@ static int amdgpu_vcn_dec_get_destroy_msg(struct amdgpu_ring *ring, uint32_t hanint r, i;memset (ib,0 ,sizeof (*ib)); - r =amdgpu_ib_get (adev,NULL ,AMDGPU_GPU_PAGE_SIZE *2 , + r =amdgpu_ib_get (adev,NULL ,AMDGPU_GPU_PAGE_SIZE *34 ,AMDGPU_IB_POOL_DIRECT , ib);if (r)
@@ -700,6 +700,7 @@ static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring *ring,struct amdgpu_job *job;struct amdgpu_ib *ib;uint64_t addr =AMDGPU_GPU_PAGE_ALIGN (ib_msg->gpu_addr); +uint64_t session_ctx_buf_gaddr =AMDGPU_GPU_PAGE_ALIGN (ib_msg->gpu_addr +8192 );bool sq =amdgpu_vcn_using_unified_queue (ring);uint32_t *ib_checksum;uint32_t ib_pack_in_dw;
@@ -730,6 +731,14 @@ static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring *ring, ib->length_dw +=sizeof (struct amdgpu_vcn_decode_buffer ) /4 ;memset (decode_buffer,0 ,sizeof (struct amdgpu_vcn_decode_buffer )); +if (session_ctx_buf_gaddr) { + decode_buffer->valid_buf_flag |= +cpu_to_le32 (AMDGPU_VCN_CMD_FLAG_SESSION_CONTEXT_BUFFER ); + decode_buffer->session_context_buffer_address_hi = +cpu_to_le32 (session_ctx_buf_gaddr >>32 ); + decode_buffer->session_context_buffer_address_lo = +cpu_to_le32 (session_ctx_buf_gaddr); + } decode_buffer->valid_buf_flag |=cpu_to_le32 (AMDGPU_VCN_CMD_FLAG_MSG_BUFFER ); decode_buffer->msg_buffer_address_hi =cpu_to_le32 (addr >>32 ); decode_buffer->msg_buffer_address_lo =cpu_to_le32 (addr);
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +3 -0
@@ -166,6 +166,7 @@#define AMDGPU_VCN_IB_FLAG_DECODE_BUFFER 0x00000001#define AMDGPU_VCN_CMD_FLAG_MSG_BUFFER 0x00000001 +#define AMDGPU_VCN_CMD_FLAG_SESSION_CONTEXT_BUFFER 0x00100000#define VCN_CODEC_DISABLE_MASK_AV1 (1 << 0)#define VCN_CODEC_DISABLE_MASK_VP9 (1 << 1)
@@ -357,6 +358,8 @@ struct amdgpu_vcn_decode_buffer {uint32_t valid_buf_flag;uint32_t msg_buffer_address_hi;uint32_t msg_buffer_address_lo; +unsigned int session_context_buffer_address_hi; +unsigned int session_context_buffer_address_lo;uint32_t pad[30 ]; };
Signature · 1 line
2.25.1
Christian König
maintainerAm 06.07.23 um 14:49 schrieb Saleemkhan Jamadar:
Quoted 26 lines
add session context buffer to decoder ring test.
v3 - indent and v2 changes correction. (Christian) v2 - put the buffer at the end of the IB (Christian)
Signed-off-by Saleemkhan Jamadar <[email protected]>Acked-by Leo Liu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 13 +++++++++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1
-1@@ -573,7 +573,7 @@ static int amdgpu_vcn_dec_get_create_msg(struct amdgpu_ring *ring, uint32_t handint r, i;memset (ib,0 ,sizeof (*ib)); - r =amdgpu_ib_get (adev,NULL ,AMDGPU_GPU_PAGE_SIZE *2 , + r =amdgpu_ib_get (adev,NULL ,AMDGPU_GPU_PAGE_SIZE *34 ,AMDGPU_IB_POOL_DIRECT , ib);if (r)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c static int amdgpu_vcn_dec_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han · line 613
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1
-1@@ -608,7 +608,7 @@ static int amdgpu_vcn_dec_get_destroy_msg(struct amdgpu_ring *ring, uint32_t hanint r, i;memset (ib,0 ,sizeof (*ib)); - r =amdgpu_ib_get (adev,NULL ,AMDGPU_GPU_PAGE_SIZE *2 , + r =amdgpu_ib_get (adev,NULL ,AMDGPU_GPU_PAGE_SIZE *34 ,AMDGPU_IB_POOL_DIRECT , ib);
A comment or some define which explains how this size came to be would be nice to have.
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1
-0if (r)@@ -700,6 +700,7 @@ static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring *ring,struct amdgpu_job *job;struct amdgpu_ib *ib;uint64_t addr =AMDGPU_GPU_PAGE_ALIGN (ib_msg->gpu_addr); +uint64_t session_ctx_buf_gaddr =AMDGPU_GPU_PAGE_ALIGN (ib_msg->gpu_addr +8192 );bool sq =amdgpu_vcn_using_unified_queue (ring);uint32_t *ib_checksum;uint32_t ib_pack_in_dw;
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring *ring, · line 734
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1
-0@@ -730,6 +731,14 @@ static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring *ring, ib->length_dw +=sizeof (struct amdgpu_vcn_decode_buffer ) /4 ;memset (decode_buffer,0 ,sizeof (struct amdgpu_vcn_decode_buffer )); +if (session_ctx_buf_gaddr) {
This if can be dropped now. The address is always true.
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring *ring, · line 740
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +6
-0+ decode_buffer->valid_buf_flag |= +cpu_to_le32 (AMDGPU_VCN_CMD_FLAG_SESSION_CONTEXT_BUFFER ); + decode_buffer->session_context_buffer_address_hi = +cpu_to_le32 (session_ctx_buf_gaddr >>32 ); + decode_buffer->session_context_buffer_address_lo = +cpu_to_le32 (session_ctx_buf_gaddr);
We have upper_32_bits() and lower_32_bits() macros for that.
Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1
-0+ } decode_buffer->valid_buf_flag |=cpu_to_le32 (AMDGPU_VCN_CMD_FLAG_MSG_BUFFER ); decode_buffer->msg_buffer_address_hi =cpu_to_le32 (addr >>32 ); decode_buffer->msg_buffer_address_lo =cpu_to_le32 (addr);drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +1
-0@@ -166,6 +166,7 @@#define AMDGPU_VCN_IB_FLAG_DECODE_BUFFER 0x00000001#define AMDGPU_VCN_CMD_FLAG_MSG_BUFFER 0x00000001 +#define AMDGPU_VCN_CMD_FLAG_SESSION_CONTEXT_BUFFER 0x00100000#define VCN_CODEC_DISABLE_MASK_AV1 (1 << 0)#define VCN_CODEC_DISABLE_MASK_VP9 (1 << 1)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h struct amdgpu_vcn_decode_buffer { · line 363
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +2
-0@@ -357,6 +358,8 @@ struct amdgpu_vcn_decode_buffer {uint32_t valid_buf_flag;uint32_t msg_buffer_address_hi;uint32_t msg_buffer_address_lo; +unsigned int session_context_buffer_address_hi; +unsigned int session_context_buffer_address_lo;uint32_t pad[30 ];
Please use uint32_t instead of just unsigned int and I think you need to reduce the number of pad fields at the end.
Apart from that looks good to me,
Christian.
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +0
-0};