Re: [PATCH 1/4] drm/uapi: The ctm matrix uses sign-magnitude representation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2018-03-06 02:51 AM, Daniel Vetter wrote:
> On Fri, Feb 23, 2018 at 11:26:41AM -0500, Harry Wentland wrote:
>> On 2018-02-22 04:42 PM, Ville Syrjala wrote:
>>> From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
>>>
>>> The documentation for the ctm matrix suggests a two's complement
>>> format, but at least the i915 implementation is using sign-magnitude
>>> instead. And looks like malidp is doing the same. Change the docs
>>> to match the current implementation, and change the type from __s64
>>> to __u64 to drive the point home.
>>>
>>> Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx
>>> Cc: Mihail Atanassov <mihail.atanassov@xxxxxxx>
>>> Cc: Liviu Dudau <liviu.dudau@xxxxxxx>
>>> Cc: Brian Starkey <brian.starkey@xxxxxxx>
>>> Cc: Mali DP Maintainers <malidp@xxxxxxxxxxxx>
>>> Cc: Johnson Lin <johnson.lin@xxxxxxxxx>
>>> Cc: Uma Shankar <uma.shankar@xxxxxxxxx>
>>> Cc: Shashank Sharma <shashank.sharma@xxxxxxxxx>
>>> Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
>>
>> Good clarification. Our new CTM implementation (1) actually assumed
>> two's complement but nobody's using it yet, so we'll patch it to
>> convert.
> 
> Another reason to start looking into igt and the tests there? That would
> have caught this too ...

There need to be new IGT tests that can actually test for signed-magnitude vs two's compliment differences, which would have to be tests of the CTM in some non-RGB colorspace where negative numbers are actually meaningful. The existing tests will test a negative matrix but in RGB colorspace any negative number will simply map to zero/black, no matter the magnitude.

I'll put such a test on our team's backlog but not sure when we'll actually get to it. We'd have to check if we could have a meaningful test for this with the current capabilities of DC.

Harry

> -Daniel
> 
>>
>> Reviewed-by: Harry Wentland <harry.wentland@xxxxxxx>
>>
>> (1) https://patchwork.freedesktop.org/patch/204005/
>>
>> Harry
>>
>>> ---
>>>  include/uapi/drm/drm_mode.h | 7 +++++--
>>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
>>> index 2c575794fb52..b5d7d9e0eff5 100644
>>> --- a/include/uapi/drm/drm_mode.h
>>> +++ b/include/uapi/drm/drm_mode.h
>>> @@ -598,8 +598,11 @@ struct drm_mode_crtc_lut {
>>>  };
>>>  
>>>  struct drm_color_ctm {
>>> -	/* Conversion matrix in S31.32 format. */
>>> -	__s64 matrix[9];
>>> +	/*
>>> +	 * Conversion matrix in S31.32 sign-magnitude
>>> +	 * (not two's complement!) format.
>>> +	 */
>>> +	__u64 matrix[9];
>>>  };
>>>  
>>>  struct drm_color_lut {
>>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@xxxxxxxxxxxxxxxxxxxxx
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux