diff mbox series

drm/i915/display: Bitwise or the conversion colour specifier together

Message ID 20201223103917.14687-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series drm/i915/display: Bitwise or the conversion colour specifier together | expand

Commit Message

Chris Wilson Dec. 23, 2020, 10:39 a.m. UTC
drivers/gpu/drm/i915/display/intel_dp.c:6922 intel_dp_update_420() warn: should this be a bitwise op?
drivers/gpu/drm/i915/display/intel_dp.c:6922 intel_dp_update_420() warn: should this be a bitwise op?
drivers/gpu/drm/i915/display/intel_dp.c:6923 intel_dp_update_420() warn: should this be a bitwise op?

Inside drm_dp_downstream_rgb_to_ycbcr_conversion(), that paramter
'color_spc' is used as return port_cap[3] & color_spc, implying that it
is indeed a mask and not a boolean value.

Fixes: 522508b665df ("drm/i915/display: Let PCON convert from RGB to YCbCr if it can")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Uma Shankar <uma.shankar@intel.com>
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jani Nikula Dec. 23, 2020, 10:51 a.m. UTC | #1
On Wed, 23 Dec 2020, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> drivers/gpu/drm/i915/display/intel_dp.c:6922 intel_dp_update_420() warn: should this be a bitwise op?
> drivers/gpu/drm/i915/display/intel_dp.c:6922 intel_dp_update_420() warn: should this be a bitwise op?
> drivers/gpu/drm/i915/display/intel_dp.c:6923 intel_dp_update_420() warn: should this be a bitwise op?
>
> Inside drm_dp_downstream_rgb_to_ycbcr_conversion(), that paramter
> 'color_spc' is used as return port_cap[3] & color_spc, implying that it
> is indeed a mask and not a boolean value.

So this one belongs in topic/dp-hdmi-2.1-pcon branch.

Purely based on the context this is the right thing to do, so:

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

Ankit, please test the patch in case it uncovers some other
issues. It'll impact the RGB to YCbCr conversion.

BR,
Jani.


>
> Fixes: 522508b665df ("drm/i915/display: Let PCON convert from RGB to YCbCr if it can")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Uma Shankar <uma.shankar@intel.com>
> Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> Cc: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 8b4b2ea52859..157a850a83a7 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -6918,8 +6918,8 @@ intel_dp_update_420(struct intel_dp *intel_dp)
>  							intel_dp->downstream_ports);
>  	rgb_to_ycbcr = drm_dp_downstream_rgb_to_ycbcr_conversion(intel_dp->dpcd,
>  								 intel_dp->downstream_ports,
> -								 DP_DS_HDMI_BT601_RGB_YCBCR_CONV ||
> -								 DP_DS_HDMI_BT709_RGB_YCBCR_CONV ||
> +								 DP_DS_HDMI_BT601_RGB_YCBCR_CONV |
> +								 DP_DS_HDMI_BT709_RGB_YCBCR_CONV |
>  								 DP_DS_HDMI_BT2020_RGB_YCBCR_CONV);
>  
>  	if (INTEL_GEN(i915) >= 11) {
Nautiyal, Ankit K Dec. 24, 2020, 6:04 a.m. UTC | #2
Thanks Chris to catch this.

This definitely should be bitwise Operator, as mentioned by Jani is 
right thing to do.

The PCON which I had access to, had the F/W which was using 303Ch 
(previously proposed) for color conversion capability, instead of what 
is latest mentioned in the spec ie. 83h.

While testing, I had to skip this line of code, and hardcoded to older 
register ie. 303Ch.

I Will get this patch tested and update.


Thanks & Regards,

Ankit


On 12/23/2020 4:21 PM, Jani Nikula wrote:
> On Wed, 23 Dec 2020, Chris Wilson <chris@chris-wilson.co.uk> wrote:
>> drivers/gpu/drm/i915/display/intel_dp.c:6922 intel_dp_update_420() warn: should this be a bitwise op?
>> drivers/gpu/drm/i915/display/intel_dp.c:6922 intel_dp_update_420() warn: should this be a bitwise op?
>> drivers/gpu/drm/i915/display/intel_dp.c:6923 intel_dp_update_420() warn: should this be a bitwise op?
>>
>> Inside drm_dp_downstream_rgb_to_ycbcr_conversion(), that paramter
>> 'color_spc' is used as return port_cap[3] & color_spc, implying that it
>> is indeed a mask and not a boolean value.
> So this one belongs in topic/dp-hdmi-2.1-pcon branch.
>
> Purely based on the context this is the right thing to do, so:
>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>
> Ankit, please test the patch in case it uncovers some other
> issues. It'll impact the RGB to YCbCr conversion.
>
> BR,
> Jani.
>
>
>> Fixes: 522508b665df ("drm/i915/display: Let PCON convert from RGB to YCbCr if it can")
>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>> Cc: Uma Shankar <uma.shankar@intel.com>
>> Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
>> Cc: Jani Nikula <jani.nikula@intel.com>
>> ---
>>   drivers/gpu/drm/i915/display/intel_dp.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
>> index 8b4b2ea52859..157a850a83a7 100644
>> --- a/drivers/gpu/drm/i915/display/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
>> @@ -6918,8 +6918,8 @@ intel_dp_update_420(struct intel_dp *intel_dp)
>>   							intel_dp->downstream_ports);
>>   	rgb_to_ycbcr = drm_dp_downstream_rgb_to_ycbcr_conversion(intel_dp->dpcd,
>>   								 intel_dp->downstream_ports,
>> -								 DP_DS_HDMI_BT601_RGB_YCBCR_CONV ||
>> -								 DP_DS_HDMI_BT709_RGB_YCBCR_CONV ||
>> +								 DP_DS_HDMI_BT601_RGB_YCBCR_CONV |
>> +								 DP_DS_HDMI_BT709_RGB_YCBCR_CONV |
>>   								 DP_DS_HDMI_BT2020_RGB_YCBCR_CONV);
>>   
>>   	if (INTEL_GEN(i915) >= 11) {
Jani Nikula Jan. 8, 2021, 1:15 p.m. UTC | #3
On Thu, 24 Dec 2020, "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com> wrote:
> Thanks Chris to catch this.
>
> This definitely should be bitwise Operator, as mentioned by Jani is 
> right thing to do.
>
> The PCON which I had access to, had the F/W which was using 303Ch 
> (previously proposed) for color conversion capability, instead of what 
> is latest mentioned in the spec ie. 83h.
>
> While testing, I had to skip this line of code, and hardcoded to older 
> register ie. 303Ch.
>
> I Will get this patch tested and update.

In the mean time, the topic/dp-hdmi-2.1-pcon branch has been merged to
drm-next and backmerged to drm-intel-next. So drm-intel-next is where
the fixes should now land.

BR,
Jani.


>
>
> Thanks & Regards,
>
> Ankit
>
>
> On 12/23/2020 4:21 PM, Jani Nikula wrote:
>> On Wed, 23 Dec 2020, Chris Wilson <chris@chris-wilson.co.uk> wrote:
>>> drivers/gpu/drm/i915/display/intel_dp.c:6922 intel_dp_update_420() warn: should this be a bitwise op?
>>> drivers/gpu/drm/i915/display/intel_dp.c:6922 intel_dp_update_420() warn: should this be a bitwise op?
>>> drivers/gpu/drm/i915/display/intel_dp.c:6923 intel_dp_update_420() warn: should this be a bitwise op?
>>>
>>> Inside drm_dp_downstream_rgb_to_ycbcr_conversion(), that paramter
>>> 'color_spc' is used as return port_cap[3] & color_spc, implying that it
>>> is indeed a mask and not a boolean value.
>> So this one belongs in topic/dp-hdmi-2.1-pcon branch.
>>
>> Purely based on the context this is the right thing to do, so:
>>
>> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>>
>> Ankit, please test the patch in case it uncovers some other
>> issues. It'll impact the RGB to YCbCr conversion.
>>
>> BR,
>> Jani.
>>
>>
>>> Fixes: 522508b665df ("drm/i915/display: Let PCON convert from RGB to YCbCr if it can")
>>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>>> Cc: Uma Shankar <uma.shankar@intel.com>
>>> Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
>>> Cc: Jani Nikula <jani.nikula@intel.com>
>>> ---
>>>   drivers/gpu/drm/i915/display/intel_dp.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
>>> index 8b4b2ea52859..157a850a83a7 100644
>>> --- a/drivers/gpu/drm/i915/display/intel_dp.c
>>> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
>>> @@ -6918,8 +6918,8 @@ intel_dp_update_420(struct intel_dp *intel_dp)
>>>   							intel_dp->downstream_ports);
>>>   	rgb_to_ycbcr = drm_dp_downstream_rgb_to_ycbcr_conversion(intel_dp->dpcd,
>>>   								 intel_dp->downstream_ports,
>>> -								 DP_DS_HDMI_BT601_RGB_YCBCR_CONV ||
>>> -								 DP_DS_HDMI_BT709_RGB_YCBCR_CONV ||
>>> +								 DP_DS_HDMI_BT601_RGB_YCBCR_CONV |
>>> +								 DP_DS_HDMI_BT709_RGB_YCBCR_CONV |
>>>   								 DP_DS_HDMI_BT2020_RGB_YCBCR_CONV);
>>>   
>>>   	if (INTEL_GEN(i915) >= 11) {
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula Jan. 13, 2021, 11:52 a.m. UTC | #4
On Fri, 08 Jan 2021, Jani Nikula <jani.nikula@intel.com> wrote:
> On Thu, 24 Dec 2020, "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com> wrote:
>> Thanks Chris to catch this.
>>
>> This definitely should be bitwise Operator, as mentioned by Jani is 
>> right thing to do.
>>
>> The PCON which I had access to, had the F/W which was using 303Ch 
>> (previously proposed) for color conversion capability, instead of what 
>> is latest mentioned in the spec ie. 83h.
>>
>> While testing, I had to skip this line of code, and hardcoded to older 
>> register ie. 303Ch.
>>
>> I Will get this patch tested and update.
>
> In the mean time, the topic/dp-hdmi-2.1-pcon branch has been merged to
> drm-next and backmerged to drm-intel-next. So drm-intel-next is where
> the fixes should now land.

Ankit, where are we with this? I'm anxious to merge this.

BR,
Jani.



>
> BR,
> Jani.
>
>
>>
>>
>> Thanks & Regards,
>>
>> Ankit
>>
>>
>> On 12/23/2020 4:21 PM, Jani Nikula wrote:
>>> On Wed, 23 Dec 2020, Chris Wilson <chris@chris-wilson.co.uk> wrote:
>>>> drivers/gpu/drm/i915/display/intel_dp.c:6922 intel_dp_update_420() warn: should this be a bitwise op?
>>>> drivers/gpu/drm/i915/display/intel_dp.c:6922 intel_dp_update_420() warn: should this be a bitwise op?
>>>> drivers/gpu/drm/i915/display/intel_dp.c:6923 intel_dp_update_420() warn: should this be a bitwise op?
>>>>
>>>> Inside drm_dp_downstream_rgb_to_ycbcr_conversion(), that paramter
>>>> 'color_spc' is used as return port_cap[3] & color_spc, implying that it
>>>> is indeed a mask and not a boolean value.
>>> So this one belongs in topic/dp-hdmi-2.1-pcon branch.
>>>
>>> Purely based on the context this is the right thing to do, so:
>>>
>>> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>>>
>>> Ankit, please test the patch in case it uncovers some other
>>> issues. It'll impact the RGB to YCbCr conversion.
>>>
>>> BR,
>>> Jani.
>>>
>>>
>>>> Fixes: 522508b665df ("drm/i915/display: Let PCON convert from RGB to YCbCr if it can")
>>>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>>>> Cc: Uma Shankar <uma.shankar@intel.com>
>>>> Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
>>>> Cc: Jani Nikula <jani.nikula@intel.com>
>>>> ---
>>>>   drivers/gpu/drm/i915/display/intel_dp.c | 4 ++--
>>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
>>>> index 8b4b2ea52859..157a850a83a7 100644
>>>> --- a/drivers/gpu/drm/i915/display/intel_dp.c
>>>> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
>>>> @@ -6918,8 +6918,8 @@ intel_dp_update_420(struct intel_dp *intel_dp)
>>>>   							intel_dp->downstream_ports);
>>>>   	rgb_to_ycbcr = drm_dp_downstream_rgb_to_ycbcr_conversion(intel_dp->dpcd,
>>>>   								 intel_dp->downstream_ports,
>>>> -								 DP_DS_HDMI_BT601_RGB_YCBCR_CONV ||
>>>> -								 DP_DS_HDMI_BT709_RGB_YCBCR_CONV ||
>>>> +								 DP_DS_HDMI_BT601_RGB_YCBCR_CONV |
>>>> +								 DP_DS_HDMI_BT709_RGB_YCBCR_CONV |
>>>>   								 DP_DS_HDMI_BT2020_RGB_YCBCR_CONV);
>>>>   
>>>>   	if (INTEL_GEN(i915) >= 11) {
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Nautiyal, Ankit K Jan. 15, 2021, 7:24 a.m. UTC | #5
On 1/13/2021 5:22 PM, Jani Nikula wrote:
> On Fri, 08 Jan 2021, Jani Nikula <jani.nikula@intel.com> wrote:
>> On Thu, 24 Dec 2020, "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com> wrote:
>>> Thanks Chris to catch this.
>>>
>>> This definitely should be bitwise Operator, as mentioned by Jani is
>>> right thing to do.
>>>
>>> The PCON which I had access to, had the F/W which was using 303Ch
>>> (previously proposed) for color conversion capability, instead of what
>>> is latest mentioned in the spec ie. 83h.
>>>
>>> While testing, I had to skip this line of code, and hardcoded to older
>>> register ie. 303Ch.
>>>
>>> I Will get this patch tested and update.
>> In the mean time, the topic/dp-hdmi-2.1-pcon branch has been merged to
>> drm-next and backmerged to drm-intel-next. So drm-intel-next is where
>> the fixes should now land.
> Ankit, where are we with this? I'm anxious to merge this.

Jani, I checked the lastest F/W we had got for source control mode, but 
its still having support in older DPCD 303Ch and has not updated to use 
DPCD 83h.

So this patch cannot be directly tested.

Since this patch is correctly fixing to use bitwise operator, can we go 
ahead with the merge?


> BR,
> Jani.
>
>
>
>> BR,
>> Jani.
>>
>>
>>>
>>> Thanks & Regards,
>>>
>>> Ankit
>>>
>>>
>>> On 12/23/2020 4:21 PM, Jani Nikula wrote:
>>>> On Wed, 23 Dec 2020, Chris Wilson <chris@chris-wilson.co.uk> wrote:
>>>>> drivers/gpu/drm/i915/display/intel_dp.c:6922 intel_dp_update_420() warn: should this be a bitwise op?
>>>>> drivers/gpu/drm/i915/display/intel_dp.c:6922 intel_dp_update_420() warn: should this be a bitwise op?
>>>>> drivers/gpu/drm/i915/display/intel_dp.c:6923 intel_dp_update_420() warn: should this be a bitwise op?
>>>>>
>>>>> Inside drm_dp_downstream_rgb_to_ycbcr_conversion(), that paramter
>>>>> 'color_spc' is used as return port_cap[3] & color_spc, implying that it
>>>>> is indeed a mask and not a boolean value.
>>>> So this one belongs in topic/dp-hdmi-2.1-pcon branch.
>>>>
>>>> Purely based on the context this is the right thing to do, so:
>>>>
>>>> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>>>>
>>>> Ankit, please test the patch in case it uncovers some other
>>>> issues. It'll impact the RGB to YCbCr conversion.
>>>>
>>>> BR,
>>>> Jani.
>>>>
>>>>
>>>>> Fixes: 522508b665df ("drm/i915/display: Let PCON convert from RGB to YCbCr if it can")
>>>>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>>>>> Cc: Uma Shankar <uma.shankar@intel.com>
>>>>> Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
>>>>> Cc: Jani Nikula <jani.nikula@intel.com>
>>>>> ---
>>>>>    drivers/gpu/drm/i915/display/intel_dp.c | 4 ++--
>>>>>    1 file changed, 2 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
>>>>> index 8b4b2ea52859..157a850a83a7 100644
>>>>> --- a/drivers/gpu/drm/i915/display/intel_dp.c
>>>>> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
>>>>> @@ -6918,8 +6918,8 @@ intel_dp_update_420(struct intel_dp *intel_dp)
>>>>>    							intel_dp->downstream_ports);
>>>>>    	rgb_to_ycbcr = drm_dp_downstream_rgb_to_ycbcr_conversion(intel_dp->dpcd,
>>>>>    								 intel_dp->downstream_ports,
>>>>> -								 DP_DS_HDMI_BT601_RGB_YCBCR_CONV ||
>>>>> -								 DP_DS_HDMI_BT709_RGB_YCBCR_CONV ||
>>>>> +								 DP_DS_HDMI_BT601_RGB_YCBCR_CONV |
>>>>> +								 DP_DS_HDMI_BT709_RGB_YCBCR_CONV |
>>>>>    								 DP_DS_HDMI_BT2020_RGB_YCBCR_CONV);
>>>>>    
>>>>>    	if (INTEL_GEN(i915) >= 11) {
>>> _______________________________________________
>>> Intel-gfx mailing list
>>> Intel-gfx@lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Chris Wilson Jan. 15, 2021, 8:22 a.m. UTC | #6
Quoting Nautiyal, Ankit K (2021-01-15 07:24:36)
> 
> On 1/13/2021 5:22 PM, Jani Nikula wrote:
> > On Fri, 08 Jan 2021, Jani Nikula <jani.nikula@intel.com> wrote:
> >> On Thu, 24 Dec 2020, "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com> wrote:
> >>> Thanks Chris to catch this.
> >>>
> >>> This definitely should be bitwise Operator, as mentioned by Jani is
> >>> right thing to do.
> >>>
> >>> The PCON which I had access to, had the F/W which was using 303Ch
> >>> (previously proposed) for color conversion capability, instead of what
> >>> is latest mentioned in the spec ie. 83h.
> >>>
> >>> While testing, I had to skip this line of code, and hardcoded to older
> >>> register ie. 303Ch.
> >>>
> >>> I Will get this patch tested and update.
> >> In the mean time, the topic/dp-hdmi-2.1-pcon branch has been merged to
> >> drm-next and backmerged to drm-intel-next. So drm-intel-next is where
> >> the fixes should now land.
> > Ankit, where are we with this? I'm anxious to merge this.
> 
> Jani, I checked the lastest F/W we had got for source control mode, but 
> its still having support in older DPCD 303Ch and has not updated to use 
> DPCD 83h.
> 
> So this patch cannot be directly tested.
> 
> Since this patch is correctly fixing to use bitwise operator, can we go 
> ahead with the merge?

Pushed. One hopes we can find a way to gain coverage for wacky DPCD,
this sounds like the sort of thing we need an emulator such as chamelium
for.
-Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 8b4b2ea52859..157a850a83a7 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -6918,8 +6918,8 @@  intel_dp_update_420(struct intel_dp *intel_dp)
 							intel_dp->downstream_ports);
 	rgb_to_ycbcr = drm_dp_downstream_rgb_to_ycbcr_conversion(intel_dp->dpcd,
 								 intel_dp->downstream_ports,
-								 DP_DS_HDMI_BT601_RGB_YCBCR_CONV ||
-								 DP_DS_HDMI_BT709_RGB_YCBCR_CONV ||
+								 DP_DS_HDMI_BT601_RGB_YCBCR_CONV |
+								 DP_DS_HDMI_BT709_RGB_YCBCR_CONV |
 								 DP_DS_HDMI_BT2020_RGB_YCBCR_CONV);
 
 	if (INTEL_GEN(i915) >= 11) {