[PATCH 7/8] edid-decode: add HDR Dynamic Metadata Data Block

Hans Verkuil hverkuil at xs4all.nl
Fri Sep 8 08:39:21 UTC 2017


On 09/08/17 10:22, walter harms wrote:
> 
> 
> Am 07.09.2017 20:03, schrieb Hans Verkuil:
>> From: Hans Verkuil <hans.verkuil at cisco.com>
>>
>> Support this CTA-861-G data block.
>>
>> Signed-off-by: Hans Verkuil <hans.verkuil at cisco.com>
>> ---
>>  edid-decode.c | 33 +++++++++++++++++++++++++++++++++
>>  1 file changed, 33 insertions(+)
>>
>> diff --git a/edid-decode.c b/edid-decode.c
>> index effcf777..cdba099d 100644
>> --- a/edid-decode.c
>> +++ b/edid-decode.c
>> @@ -1865,6 +1865,35 @@ cea_hdr_static_metadata_block(unsigned char *x)
>>  	       x[6], (50.0 * pow(2, x[4] / 32.0)) * pow(x[6] / 255.0, 2) / 100.0);
>>  }
>>  
>> +static void
>> +cea_hdr_dyn_metadata_block(unsigned char *x)
>> +{
>> +    int length = x[0] & 0x1f;
>> +
>> +    if (length < 1)
>> +	return;
> 
> complicated way to say if (length == 0)

Will fix this.

> 
> 
>> +    length--;
>> +    x--;
>> +    while (length >= 3) {
>> +	int type_len = x[0];
>> +	int type = x[1] | (x[2] << 8);
>> +
> 
> Do you expect that x[?] will change ? otherwise this is const
> and the loop print the same data over and over again, or did i miss something ?

It's a bug, I'm about to post a v2 of this series. (I found more bugs as well :-( ).

Regards,

	Hans

> 
> hope that helps,
> re,
>  wh
> 
>> +	if (length < type_len)
>> +	    return;
>> +	printf("    HDR Dynamic Metadata Type %d\n", type);
>> +	switch (type) {
>> +	case 1:
>> +	case 2:
>> +	case 4:
>> +	    printf("      Version: %d\n", x[3] & 0xf);
>> +	    break;
>> +	default:
>> +	    break;
>> +	}
>> +	length -= type_len;
>> +    }
>> +}
>> +
>>  static void
>>  cea_block(unsigned char *x)
>>  {
>> @@ -1931,6 +1960,10 @@ cea_block(unsigned char *x)
>>  		    printf("HDR static metadata data block\n");
>>  		    cea_hdr_static_metadata_block(x);
>>  		    break;
>> +		case 0x07:
>> +		    printf("HDR dynamic metadata data block\n");
>> +		    cea_hdr_dyn_metadata_block(x);
>> +		    break;
>>  		case 0x0d:
>>  		    printf("Video format preference data block\n");
>>  		    cea_vfpdb(x);
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel
> 



More information about the xorg-devel mailing list