diff options
author | Ruijing Dong <ruijing.dong@amd.com> | 2023-05-09 16:15:41 -0400 |
---|---|---|
committer | Leo Liu <leo.liu@amd.com> | 2023-05-11 11:09:38 -0400 |
commit | 7784d571661e3c1019f98ece7947dbf791405f8a (patch) | |
tree | 33cee654d09139f7fbb3faf6c4de36a2f5504726 | |
parent | 03d18b44db345b754759adacf602b2b3575b5339 (diff) | |
download | libdrm-7784d571661e3c1019f98ece7947dbf791405f8a.tar.gz libdrm-7784d571661e3c1019f98ece7947dbf791405f8a.tar.bz2 libdrm-7784d571661e3c1019f98ece7947dbf791405f8a.zip |
tests/amdgpu/vcn: fix drm test failure
1. fixed an issue that drm test vcn3/4 encoding test
could cause VCN engine stuck.
2. adding missing or errous encoding ib package members.
Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com>
Signed-off-by: Ruijing Dong <ruijing.dong@amd.com>
-rw-r--r-- | tests/amdgpu/vcn_tests.c | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/tests/amdgpu/vcn_tests.c b/tests/amdgpu/vcn_tests.c index 0fdb55dd..27da9da5 100644 --- a/tests/amdgpu/vcn_tests.c +++ b/tests/amdgpu/vcn_tests.c @@ -808,6 +808,8 @@ static void amdgpu_cs_vcn_enc_create(void) ib_cpu[len++] = 0; ib_cpu[len++] = 0; /* pre encode mode */ ib_cpu[len++] = 0; /* chroma enabled : false */ + ib_cpu[len++] = 0; + ib_cpu[len++] = 0; *st_size = (len - st_offset) * 4; /* slice control */ @@ -829,7 +831,7 @@ static void amdgpu_cs_vcn_enc_create(void) ib_cpu[len++] = 1; /* quarter pel enabled */ ib_cpu[len++] = 100; /* BASELINE profile */ ib_cpu[len++] = 11; /* level */ - if (vcn_ip_version_major == 3) { + if (vcn_ip_version_major >= 3) { ib_cpu[len++] = 0; /* b_picture_enabled */ ib_cpu[len++] = 0; /* weighted_bipred_idc */ } @@ -870,7 +872,7 @@ static void amdgpu_cs_vcn_enc_create(void) ib_cpu[len++] = 0; /* scene change sensitivity */ ib_cpu[len++] = 0; /* scene change min idr interval */ ib_cpu[len++] = 0; - if (vcn_ip_version_major == 3) + if (vcn_ip_version_major >= 3) ib_cpu[len++] = 0; *st_size = (len - st_offset) * 4; @@ -913,6 +915,7 @@ static void amdgpu_cs_vcn_enc_create(void) ib_cpu[len++] = 1; ib_cpu[len++] = 0; ib_cpu[len++] = 1; + ib_cpu[len++] = 0; *st_size = (len - st_offset) * 4; /* op init rc */ @@ -1265,10 +1268,16 @@ static void check_result(struct amdgpu_vcn_bo fb_buf, struct amdgpu_vcn_bo bs_bu CU_ASSERT_EQUAL(r, 0); } +static void amdgpu_cs_vcn_ib_zero_count(int *len, int num) +{ + for (int i = 0; i < num; i++) + ib_cpu[(*len)++] = 0; +} + static void amdgpu_cs_vcn_enc_encode_frame(int frame_type) { struct amdgpu_vcn_bo bs_buf, fb_buf, input_buf; - int len, r, i; + int len, r; unsigned width = 160, height = 128, buf_size; uint32_t *p_task_size = NULL; uint32_t task_offset = 0, st_offset; @@ -1346,7 +1355,7 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type) if(vcn_ip_version_major == 1) ib_cpu[len++] = 0x00000020; /* RENCODE_IB_PARAM_DIRECT_OUTPUT_NALU vcn 1 */ else - ib_cpu[len++] = 0x0000000a; /* RENCODE_IB_PARAM_DIRECT_OUTPUT_NALU vcn 2,3 */ + ib_cpu[len++] = 0x0000000a; /* RENCODE_IB_PARAM_DIRECT_OUTPUT_NALU other vcn */ ib_cpu[len++] = 0x00000002; /* RENCODE_DIRECT_OUTPUT_NALU_TYPE_SPS */ ib_cpu[len++] = 0x00000011; /* sps len */ ib_cpu[len++] = 0x00000001; /* start code */ @@ -1362,7 +1371,7 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type) if(vcn_ip_version_major == 1) ib_cpu[len++] = 0x00000020; /* RENCODE_IB_PARAM_DIRECT_OUTPUT_NALU vcn 1*/ else - ib_cpu[len++] = 0x0000000a; /* RENCODE_IB_PARAM_DIRECT_OUTPUT_NALU vcn 2,3*/ + ib_cpu[len++] = 0x0000000a; /* RENCODE_IB_PARAM_DIRECT_OUTPUT_NALU other vcn*/ ib_cpu[len++] = 0x00000003; /* RENCODE_DIRECT_OUTPUT_NALU_TYPE_PPS */ ib_cpu[len++] = 0x00000008; /* pps len */ ib_cpu[len++] = 0x00000001; /* start code */ @@ -1376,7 +1385,7 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type) if(vcn_ip_version_major == 1) ib_cpu[len++] = 0x0000000a; /* RENCODE_IB_PARAM_SLICE_HEADER vcn 1 */ else - ib_cpu[len++] = 0x0000000b; /* RENCODE_IB_PARAM_SLICE_HEADER vcn 2,3 */ + ib_cpu[len++] = 0x0000000b; /* RENCODE_IB_PARAM_SLICE_HEADER other vcn */ if (frame_type == 2) { ib_cpu[len++] = 0x65000000; ib_cpu[len++] = 0x11040000; @@ -1385,8 +1394,7 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type) ib_cpu[len++] = 0x34210000; } ib_cpu[len++] = 0xe0000000; - for(i = 0; i < 13; i++) - ib_cpu[len++] = 0x00000000; + amdgpu_cs_vcn_ib_zero_count(&len, 13); ib_cpu[len++] = 0x00000001; ib_cpu[len++] = 0x00000008; @@ -1398,18 +1406,16 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type) ib_cpu[len++] = 0x00000000; ib_cpu[len++] = 0x00000001; ib_cpu[len++] = 0x00000003; - for(i = 0; i < 22; i++) - ib_cpu[len++] = 0x00000000; - + amdgpu_cs_vcn_ib_zero_count(&len, 22); *st_size = (len - st_offset) * 4; /* encode params */ st_offset = len; st_size = &ib_cpu[len++]; /* size */ if(vcn_ip_version_major == 1) - ib_cpu[len++] = 0x0000000b; /* RENCODE_IB_PARAM_ENCODE_PARAMS vcn 1*/ + ib_cpu[len++] = 0x0000000b; /* RENCODE_IB_PARAM_ENCODE_PARAMS vcn 1 */ else - ib_cpu[len++] = 0x0000000f; /* RENCODE_IB_PARAM_ENCODE_PARAMS vcn 2,3*/ + ib_cpu[len++] = 0x0000000f; /* RENCODE_IB_PARAM_ENCODE_PARAMS other vcn */ ib_cpu[len++] = frame_type; ib_cpu[len++] = 0x0001f000; ib_cpu[len++] = input_buf.addr >> 32; @@ -1427,7 +1433,7 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type) st_offset = len; st_size = &ib_cpu[len++]; /* size */ ib_cpu[len++] = 0x00200003; /* RENCODE_H264_IB_PARAM_ENCODE_PARAMS */ - if (vcn_ip_version_major != 3) { + if (vcn_ip_version_major <= 2) { ib_cpu[len++] = 0x00000000; ib_cpu[len++] = 0x00000000; ib_cpu[len++] = 0x00000000; @@ -1450,6 +1456,7 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type) ib_cpu[len++] = 0x00000000; ib_cpu[len++] = 0x00000000; ib_cpu[len++] = 0x00000000; + ib_cpu[len++] = 0x00000001; } *st_size = (len - st_offset) * 4; @@ -1459,20 +1466,21 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type) if(vcn_ip_version_major == 1) ib_cpu[len++] = 0x0000000d; /* ENCODE_CONTEXT_BUFFER vcn 1 */ else - ib_cpu[len++] = 0x00000011; /* ENCODE_CONTEXT_BUFFER vcn 2,3 */ + ib_cpu[len++] = 0x00000011; /* ENCODE_CONTEXT_BUFFER other vcn */ ib_cpu[len++] = cpb_buf.addr >> 32; ib_cpu[len++] = cpb_buf.addr; ib_cpu[len++] = 0x00000000; /* swizzle mode */ ib_cpu[len++] = 0x00000100; /* luma pitch */ ib_cpu[len++] = 0x00000100; /* chroma pitch */ - ib_cpu[len++] = 0x00000003; /* no reconstructed picture */ + ib_cpu[len++] = 0x00000002; /* no reconstructed picture */ ib_cpu[len++] = 0x00000000; /* reconstructed pic 1 luma offset */ ib_cpu[len++] = ALIGN(width, 256) * ALIGN(height, 32); /* pic1 chroma offset */ + if(vcn_ip_version_major == 4) + amdgpu_cs_vcn_ib_zero_count(&len, 2); ib_cpu[len++] = ALIGN(width, 256) * ALIGN(height, 32) * 3 / 2; /* pic2 luma offset */ ib_cpu[len++] = ALIGN(width, 256) * ALIGN(height, 32) * 5 / 2; /* pic2 chroma offset */ - for (int i = 0; i < 136; i++) - ib_cpu[len++] = 0x00000000; + amdgpu_cs_vcn_ib_zero_count(&len, 280); *st_size = (len - st_offset) * 4; /* bitstream buffer */ @@ -1481,7 +1489,8 @@ static void amdgpu_cs_vcn_enc_encode_frame(int frame_type) if(vcn_ip_version_major == 1) ib_cpu[len++] = 0x0000000e; /* VIDEO_BITSTREAM_BUFFER vcn 1 */ else - ib_cpu[len++] = 0x00000012; /* VIDEO_BITSTREAM_BUFFER vcn 2,3 */ + ib_cpu[len++] = 0x00000012; /* VIDEO_BITSTREAM_BUFFER other vcn */ + ib_cpu[len++] = 0x00000000; /* mode */ ib_cpu[len++] = bs_buf.addr >> 32; ib_cpu[len++] = bs_buf.addr; |