tests/amdgpu: add new uvd enc support check
PATCH v2 1/2 tests/amdgpu: add new uvd enc support check
Query hardware IP information to find out if there are uvd encode rings ready for use in kernel driver.
--- tests/amdgpu/uvd_enc_tests.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
tests/amdgpu/uvd_enc_tests.c +21 -6
@@ -79,6 +79,8 @@ static void amdgpu_cs_uvd_enc_session_init(void);static void amdgpu_cs_uvd_enc_encode (void );static void amdgpu_cs_uvd_enc_destroy (void ); +static bool uvd_enc_support (void ); +CU_TestInfo uvd_enc_tests[] = { {"UVD ENC create" , amdgpu_cs_uvd_enc_create }, {"UVD ENC session init" , amdgpu_cs_uvd_enc_session_init },
@@ -98,7 +100,7 @@ int suite_uvd_enc_tests_init(void) family_id = device_handle->info.family_id; -if (family_id <AMDGPU_FAMILY_AI || family_id >=AMDGPU_FAMILY_RV ) { +if (!uvd_enc_support ()) {printf ("\n\nThe ASIC NOT support UVD ENC, all sub-tests will pass\n" );return CUE_SUCCESS ; }
@@ -121,7 +123,7 @@ int suite_uvd_enc_tests_clean(void) {int r; -if (family_id <AMDGPU_FAMILY_AI || family_id >=AMDGPU_FAMILY_RV ) { +if (!uvd_enc_support ()) { r =amdgpu_device_deinitialize (device_handle);if (r)
@@ -238,11 +240,24 @@ static void free_resource(struct amdgpu_uvd_enc_bo *uvd_enc_bo)memset (uvd_enc_bo,0 ,sizeof (*uvd_enc_bo)); } +static bool uvd_enc_support (void ) +{ +int r; +struct drm_amdgpu_info_hw_ip info; + + r =amdgpu_query_hw_ip_info (device_handle,AMDGPU_HW_IP_UVD_ENC ,0 , &info); + +if (r) +return false; +else +return (info.available_rings?true:false); +} +static void amdgpu_cs_uvd_enc_create (void ) {int len, r; -if (family_id <AMDGPU_FAMILY_AI || family_id >=AMDGPU_FAMILY_RV ) +if (!uvd_enc_support ())return ; enc.width =160 ;
@@ -281,7 +296,7 @@ static void amdgpu_cs_uvd_enc_session_init(void) {int len, r; -if (family_id <AMDGPU_FAMILY_AI || family_id >=AMDGPU_FAMILY_RV ) +if (!uvd_enc_support ())return ; len =0 ;
@@ -339,7 +354,7 @@ static void amdgpu_cs_uvd_enc_encode(void) vbuf_size =ALIGN (enc.width, align) *ALIGN (enc.height,16 ) *1.5 ; cpb_size = vbuf_size *10 ; -if (family_id <AMDGPU_FAMILY_AI || family_id >=AMDGPU_FAMILY_RV ) +if (!uvd_enc_support ())return ; num_resources =0 ;
@@ -472,7 +487,7 @@ static void amdgpu_cs_uvd_enc_destroy(void)struct amdgpu_uvd_enc_bo sw_ctx;int len, r; -if (family_id <AMDGPU_FAMILY_AI || family_id >=AMDGPU_FAMILY_RV ) +if (!uvd_enc_support ())return ; num_resources =0 ;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1507217090-10669-1-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org
PATCH v2 2/2 tests/amdgpu: fix uvd enc data corruption issue
In uvd encode parameter package, parameters input_pic_luma_pitch and input_pic_chroma_pitch should be picture width align with hardware alignment. The hardware alignment is 16 for amdgpu family earlier than AMDGPU_FAMILY_AI, and 256 for later than and including AMDGPU_FAMILY_AI.
--- tests/amdgpu/uvd_enc_tests.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tests/amdgpu/uvd_enc_tests.c +3 -1
@@ -272,7 +272,7 @@ static void amdgpu_cs_uvd_enc_create(void)static void check_result (struct amdgpu_uvd_enc *enc) {uint64_t sum; -uint32_t s =26382 ; +uint32_t s =175602 ;uint32_t *ptr, size;int i, j, r;
@@ -463,6 +463,8 @@ static void amdgpu_cs_uvd_enc_encode(void) ib_cpu[len++] = chroma_offset >>32 ; ib_cpu[len++] = chroma_offset;memcpy ((ib_cpu + len), uve_encode_param,sizeof (uve_encode_param)); + ib_cpu[len] =ALIGN (enc.width, align); + ib_cpu[len +1 ] =ALIGN (enc.width, align); len +=sizeof (uve_encode_param) /4 ;memcpy ((ib_cpu + len), uve_op_speed_enc_mode,sizeof (uve_op_speed_enc_mode));
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH libdrm v2 2/2] tests/amdgpu: fix uvd enc data corruption issue
Quoted 24 lines · James Zhu
In uvd encode parameter package, parameters
input_pic_luma_pitchandinput_pic_chroma_pitchshould be picture width align with hardware alignment. The hardware alignment is 16 for amdgpu family earlier thanAMDGPU_FAMILY_AI, and 256 for later than and includingAMDGPU_FAMILY_AI.Signed-off-by James Zhu <[email protected]>--- tests/amdgpu/uvd_enc_tests.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)tests/amdgpu/uvd_enc_tests.c +1
-1@@ -272,7 +272,7 @@ static void amdgpu_cs_uvd_enc_create(void)static void check_result (struct amdgpu_uvd_enc *enc) {uint64_t sum; -uint32_t s =26382 ; +uint32_t s =175602 ;uint32_t *ptr, size;int i, j, r;
tests/amdgpu/uvd_enc_tests.c static void amdgpu_cs_uvd_enc_encode(void) · line 467
Quoted 5 lines
tests/amdgpu/uvd_enc_tests.c +2
-0@@ -463,6 +463,8 @@ static void amdgpu_cs_uvd_enc_encode(void) ib_cpu[len++] = chroma_offset >>32 ; ib_cpu[len++] = chroma_offset;memcpy ((ib_cpu + len), uve_encode_param,sizeof (uve_encode_param)); + ib_cpu[len] =ALIGN (enc.width, align); + ib_cpu[len +1 ] =ALIGN (enc.width, align);
Since here we override the pitch value based on below from uve_ib.h.
static const uint32_t uve_encode_param[] = {
0x000000a0,
0x00000080,We'd better to reset them to 0 from the header file, since we don't want to leave the incorrect value there.
With that fixed, the series is
tests/amdgpu/uvd_enc_tests.c static void amdgpu_cs_uvd_enc_encode(void) · line 470
Quoted 3 lines
tests/amdgpu/uvd_enc_tests.c +0
-0len +=sizeof (uve_encode_param) /4 ;memcpy ((ib_cpu + len), uve_op_speed_enc_mode,sizeof (uve_op_speed_enc_mode));
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 99fd1615-2a78-a29c-4b0d-0d94b621275f-5C7GfCeVMHo@public.gmane.org
Re: [PATCH libdrm v2 2/2] tests/amdgpu: fix uvd enc data corruption issue
Hi Leo,
Sure, I will reset 0 in header file
Thanks!
James Zhu
Quoted 37 lines · Leo Liu
Quoted 23 lines · James Zhu
In uvd encode parameter package, parameters
input_pic_luma_pitchandinput_pic_chroma_pitchshould be picture width align with hardware alignment. The hardware alignment is 16 for amdgpu family earlier thanAMDGPU_FAMILY_AI, and 256 for later than and includingAMDGPU_FAMILY_AI.Signed-off-by James Zhu <[email protected]>---
tests/amdgpu/uvd_enc_tests.c| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)tests/amdgpu/uvd_enc_tests.c +1
-1@@ -272,7 +272,7 @@ static void amdgpu_cs_uvd_enc_create(void) static void check_result(struct amdgpu_uvd_enc *enc) { uint64_t sum; - uint32_t s = 26382; + uint32_t s = 175602; uint32_t *ptr, size; int i, j, r; @@ -463,6 +463,8 @@ static void amdgpu_cs_uvd_enc_encode(void)Quoted 5 lines
ib_cpu[len++] =
chroma_offset>> 32;
ib_cpu[len++] =chroma_offset;
memcpy((ib_cpu + len), uve_encode_param, sizeof(uve_encode_param)); + ib_cpu[len] =ALIGN(enc.width, align);
+ ib_cpu[len + 1] =ALIGN(enc.width, align);Since here we override the pitch value based on below from
uve_ib.h.static const
uint32_tuve_encode_param[] = {
0x000000a0,
0x00000080,
Quoted 9 lines
We'd better to reset them to 0 from the header file, since we don't want to leave the incorrect value there.
With that fixed, the series is
Reviewed-by Leo Liu <[email protected]>Quoted 2 lines
len +=
sizeof(uve_encode_param)/ 4;
memcpy((ib_cpu + len), uve_op_speed_enc_mode, sizeof(uve_op_speed_enc_mode));
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx