diff mbox

[libdrm,v2,2/2] tests/amdgpu: fix uvd enc data corruption issue

Message ID 1507217090-10669-2-git-send-email-James.Zhu@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

James Zhu Oct. 5, 2017, 3:24 p.m. UTC
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.

Signed-off-by: James Zhu <James.Zhu@amd.com>
---
 tests/amdgpu/uvd_enc_tests.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Leo Liu Oct. 5, 2017, 3:39 p.m. UTC | #1
On 10/05/2017 11:24 AM, James Zhu wrote:
> 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.
>
> Signed-off-by: James Zhu <James.Zhu@amd.com>
> ---
>   tests/amdgpu/uvd_enc_tests.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tests/amdgpu/uvd_enc_tests.c b/tests/amdgpu/uvd_enc_tests.c
> index 7518103..bbda131 100644
> --- a/tests/amdgpu/uvd_enc_tests.c
> +++ b/tests/amdgpu/uvd_enc_tests.c
> @@ -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);
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

Reviewed-by: Leo Liu <leo.liu@amd.com>

>   	len += sizeof(uve_encode_param) / 4;
>   
>   	memcpy((ib_cpu + len), uve_op_speed_enc_mode, sizeof(uve_op_speed_enc_mode));
James Zhu Oct. 5, 2017, 3:45 p.m. UTC | #2
Hi Leo,

Sure, I will reset 0 in header file

Thanks!
James Zhu
On 2017-10-05 11:39 AM, Leo Liu wrote:
>
>
> On 10/05/2017 11:24 AM, James Zhu wrote:
>> 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.
>>
>> Signed-off-by: James Zhu <James.Zhu@amd.com>
>> ---
>>   tests/amdgpu/uvd_enc_tests.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/tests/amdgpu/uvd_enc_tests.c b/tests/amdgpu/uvd_enc_tests.c
>> index 7518103..bbda131 100644
>> --- a/tests/amdgpu/uvd_enc_tests.c
>> +++ b/tests/amdgpu/uvd_enc_tests.c
>> @@ -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);
> 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
>
> Reviewed-by: Leo Liu <leo.liu@amd.com>
>
>>       len += sizeof(uve_encode_param) / 4;
>>         memcpy((ib_cpu + len), uve_op_speed_enc_mode, 
>> sizeof(uve_op_speed_enc_mode));
>
diff mbox

Patch

diff --git a/tests/amdgpu/uvd_enc_tests.c b/tests/amdgpu/uvd_enc_tests.c
index 7518103..bbda131 100644
--- a/tests/amdgpu/uvd_enc_tests.c
+++ b/tests/amdgpu/uvd_enc_tests.c
@@ -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));