stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amd/display: Try YCbCr420 color when YCbCr444 fails
@ 2021-03-17 15:13 Werner Sembach
  2021-03-24 20:23 ` Alex Deucher
  0 siblings, 1 reply; 5+ messages in thread
From: Werner Sembach @ 2021-03-17 15:13 UTC (permalink / raw)
  To: wse, harry.wentland, sunpeng.li, alexander.deucher,
	christian.koenig, airlied, daniel, amd-gfx, dri-devel
  Cc: stable

When encoder validation of a display mode fails, retry with less bandwidth
heavy YCbCr420 color mode, if available. This enables some HDMI 1.4 setups
to support 4k60Hz output, which previously failed silently.

On some setups, while the monitor and the gpu support display modes with
pixel clocks of up to 600MHz, the link encoder might not. This prevents
YCbCr444 and RGB encoding for 4k60Hz, but YCbCr420 encoding might still be
possible. However, which color mode is used is decided before the link
encoder capabilities are checked. This patch fixes the problem by retrying
to find a display mode with YCbCr420 enforced and using it, if it is
valid.

Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
Cc: <stable@vger.kernel.org>
---

From c9398160caf4ff20e63b8ba3a4366d6ef95c4ac3 Mon Sep 17 00:00:00 2001
From: Werner Sembach <wse@tuxedocomputers.com>
Date: Wed, 17 Mar 2021 12:52:22 +0100
Subject: [PATCH] Retry forcing YCbCr420 color on failed encoder validation

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 961abf1cf040..2d16389b5f1e 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -5727,6 +5727,15 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
 
 	} while (stream == NULL && requested_bpc >= 6);
 
+	if (dc_result == DC_FAIL_ENC_VALIDATE && !aconnector->force_yuv420_output) {
+		DRM_DEBUG_KMS("Retry forcing YCbCr420 encoding\n");
+
+		aconnector->force_yuv420_output = true;
+		stream = create_validate_stream_for_sink(aconnector, drm_mode,
+						dm_state, old_stream);
+		aconnector->force_yuv420_output = false;
+	}
+
 	return stream;
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amd/display: Try YCbCr420 color when YCbCr444 fails
  2021-03-17 15:13 [PATCH] drm/amd/display: Try YCbCr420 color when YCbCr444 fails Werner Sembach
@ 2021-03-24 20:23 ` Alex Deucher
  2021-03-26 14:59   ` Harry Wentland
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Deucher @ 2021-03-24 20:23 UTC (permalink / raw)
  To: Werner Sembach
  Cc: Wentland, Harry, Leo (Sunpeng) Li, Deucher, Alexander,
	Christian Koenig, Dave Airlie, Daniel Vetter, amd-gfx list,
	Maling list - DRI developers, for 3.8

On Wed, Mar 17, 2021 at 11:25 AM Werner Sembach <wse@tuxedocomputers.com> wrote:
>
> When encoder validation of a display mode fails, retry with less bandwidth
> heavy YCbCr420 color mode, if available. This enables some HDMI 1.4 setups
> to support 4k60Hz output, which previously failed silently.
>
> On some setups, while the monitor and the gpu support display modes with
> pixel clocks of up to 600MHz, the link encoder might not. This prevents
> YCbCr444 and RGB encoding for 4k60Hz, but YCbCr420 encoding might still be
> possible. However, which color mode is used is decided before the link
> encoder capabilities are checked. This patch fixes the problem by retrying
> to find a display mode with YCbCr420 enforced and using it, if it is
> valid.
>
> Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
> Cc: <stable@vger.kernel.org>


This seems reasonable to me.  Harry, Leo, Any objections?

Alex

> ---
>
> From c9398160caf4ff20e63b8ba3a4366d6ef95c4ac3 Mon Sep 17 00:00:00 2001
> From: Werner Sembach <wse@tuxedocomputers.com>
> Date: Wed, 17 Mar 2021 12:52:22 +0100
> Subject: [PATCH] Retry forcing YCbCr420 color on failed encoder validation
>
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 961abf1cf040..2d16389b5f1e 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -5727,6 +5727,15 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
>
>         } while (stream == NULL && requested_bpc >= 6);
>
> +       if (dc_result == DC_FAIL_ENC_VALIDATE && !aconnector->force_yuv420_output) {
> +               DRM_DEBUG_KMS("Retry forcing YCbCr420 encoding\n");
> +
> +               aconnector->force_yuv420_output = true;
> +               stream = create_validate_stream_for_sink(aconnector, drm_mode,
> +                                               dm_state, old_stream);
> +               aconnector->force_yuv420_output = false;
> +       }
> +
>         return stream;
>  }
>
> --
> 2.25.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amd/display: Try YCbCr420 color when YCbCr444 fails
  2021-03-24 20:23 ` Alex Deucher
@ 2021-03-26 14:59   ` Harry Wentland
  2021-03-29 15:28     ` Alex Deucher
  0 siblings, 1 reply; 5+ messages in thread
From: Harry Wentland @ 2021-03-26 14:59 UTC (permalink / raw)
  To: Alex Deucher, Werner Sembach
  Cc: Leo (Sunpeng) Li, Deucher, Alexander, Christian Koenig,
	Dave Airlie, Daniel Vetter, amd-gfx list,
	Maling list - DRI developers, for 3.8



On 2021-03-24 4:23 p.m., Alex Deucher wrote:
> On Wed, Mar 17, 2021 at 11:25 AM Werner Sembach <wse@tuxedocomputers.com> wrote:
>>
>> When encoder validation of a display mode fails, retry with less bandwidth
>> heavy YCbCr420 color mode, if available. This enables some HDMI 1.4 setups
>> to support 4k60Hz output, which previously failed silently.
>>
>> On some setups, while the monitor and the gpu support display modes with
>> pixel clocks of up to 600MHz, the link encoder might not. This prevents
>> YCbCr444 and RGB encoding for 4k60Hz, but YCbCr420 encoding might still be
>> possible. However, which color mode is used is decided before the link
>> encoder capabilities are checked. This patch fixes the problem by retrying
>> to find a display mode with YCbCr420 enforced and using it, if it is
>> valid.
>>
>> Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
>> Cc: <stable@vger.kernel.org>
> 
> 
> This seems reasonable to me.  Harry, Leo, Any objections?
> 

Looks good to me.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Harry

> Alex
> 
>> ---
>>
>>  From c9398160caf4ff20e63b8ba3a4366d6ef95c4ac3 Mon Sep 17 00:00:00 2001
>> From: Werner Sembach <wse@tuxedocomputers.com>
>> Date: Wed, 17 Mar 2021 12:52:22 +0100
>> Subject: [PATCH] Retry forcing YCbCr420 color on failed encoder validation
>>
>> ---
>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index 961abf1cf040..2d16389b5f1e 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -5727,6 +5727,15 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
>>
>>          } while (stream == NULL && requested_bpc >= 6);
>>
>> +       if (dc_result == DC_FAIL_ENC_VALIDATE && !aconnector->force_yuv420_output) {
>> +               DRM_DEBUG_KMS("Retry forcing YCbCr420 encoding\n");
>> +
>> +               aconnector->force_yuv420_output = true;
>> +               stream = create_validate_stream_for_sink(aconnector, drm_mode,
>> +                                               dm_state, old_stream);
>> +               aconnector->force_yuv420_output = false;
>> +       }
>> +
>>          return stream;
>>   }
>>
>> --
>> 2.25.1
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amd/display: Try YCbCr420 color when YCbCr444 fails
  2021-03-26 14:59   ` Harry Wentland
@ 2021-03-29 15:28     ` Alex Deucher
  2021-04-01 12:32       ` Werner Sembach
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Deucher @ 2021-03-29 15:28 UTC (permalink / raw)
  To: Harry Wentland
  Cc: Werner Sembach, Leo (Sunpeng) Li, Deucher, Alexander,
	Christian Koenig, Dave Airlie, Daniel Vetter, amd-gfx list,
	Maling list - DRI developers, for 3.8

Applied.  Thanks!

Alex

On Fri, Mar 26, 2021 at 10:59 AM Harry Wentland <harry.wentland@amd.com> wrote:
>
>
>
> On 2021-03-24 4:23 p.m., Alex Deucher wrote:
> > On Wed, Mar 17, 2021 at 11:25 AM Werner Sembach <wse@tuxedocomputers.com> wrote:
> >>
> >> When encoder validation of a display mode fails, retry with less bandwidth
> >> heavy YCbCr420 color mode, if available. This enables some HDMI 1.4 setups
> >> to support 4k60Hz output, which previously failed silently.
> >>
> >> On some setups, while the monitor and the gpu support display modes with
> >> pixel clocks of up to 600MHz, the link encoder might not. This prevents
> >> YCbCr444 and RGB encoding for 4k60Hz, but YCbCr420 encoding might still be
> >> possible. However, which color mode is used is decided before the link
> >> encoder capabilities are checked. This patch fixes the problem by retrying
> >> to find a display mode with YCbCr420 enforced and using it, if it is
> >> valid.
> >>
> >> Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
> >> Cc: <stable@vger.kernel.org>
> >
> >
> > This seems reasonable to me.  Harry, Leo, Any objections?
> >
>
> Looks good to me.
>
> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
>
> Harry
>
> > Alex
> >
> >> ---
> >>
> >>  From c9398160caf4ff20e63b8ba3a4366d6ef95c4ac3 Mon Sep 17 00:00:00 2001
> >> From: Werner Sembach <wse@tuxedocomputers.com>
> >> Date: Wed, 17 Mar 2021 12:52:22 +0100
> >> Subject: [PATCH] Retry forcing YCbCr420 color on failed encoder validation
> >>
> >> ---
> >>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++++
> >>   1 file changed, 9 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> index 961abf1cf040..2d16389b5f1e 100644
> >> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> >> @@ -5727,6 +5727,15 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
> >>
> >>          } while (stream == NULL && requested_bpc >= 6);
> >>
> >> +       if (dc_result == DC_FAIL_ENC_VALIDATE && !aconnector->force_yuv420_output) {
> >> +               DRM_DEBUG_KMS("Retry forcing YCbCr420 encoding\n");
> >> +
> >> +               aconnector->force_yuv420_output = true;
> >> +               stream = create_validate_stream_for_sink(aconnector, drm_mode,
> >> +                                               dm_state, old_stream);
> >> +               aconnector->force_yuv420_output = false;
> >> +       }
> >> +
> >>          return stream;
> >>   }
> >>
> >> --
> >> 2.25.1
> >>
> >> _______________________________________________
> >> dri-devel mailing list
> >> dri-devel@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/dri-devel>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amd/display: Try YCbCr420 color when YCbCr444 fails
  2021-03-29 15:28     ` Alex Deucher
@ 2021-04-01 12:32       ` Werner Sembach
  0 siblings, 0 replies; 5+ messages in thread
From: Werner Sembach @ 2021-04-01 12:32 UTC (permalink / raw)
  To: Alex Deucher, Harry Wentland
  Cc: Leo (Sunpeng) Li, Deucher, Alexander, Christian Koenig,
	Dave Airlie, Daniel Vetter, amd-gfx list,
	Maling list - DRI developers, for 3.8

Am 29.03.21 um 17:28 schrieb Alex Deucher:
> Applied.  Thanks!
>
> Alex
Nice to hear that ^^

One quick question: Here do I find the amd-gfx dev branch?

Kind regards,

Werner Sembach
>
> On Fri, Mar 26, 2021 at 10:59 AM Harry Wentland <harry.wentland@amd.com> wrote:
>>
>>
>> On 2021-03-24 4:23 p.m., Alex Deucher wrote:
>>> On Wed, Mar 17, 2021 at 11:25 AM Werner Sembach <wse@tuxedocomputers.com> wrote:
>>>> When encoder validation of a display mode fails, retry with less bandwidth
>>>> heavy YCbCr420 color mode, if available. This enables some HDMI 1.4 setups
>>>> to support 4k60Hz output, which previously failed silently.
>>>>
>>>> On some setups, while the monitor and the gpu support display modes with
>>>> pixel clocks of up to 600MHz, the link encoder might not. This prevents
>>>> YCbCr444 and RGB encoding for 4k60Hz, but YCbCr420 encoding might still be
>>>> possible. However, which color mode is used is decided before the link
>>>> encoder capabilities are checked. This patch fixes the problem by retrying
>>>> to find a display mode with YCbCr420 enforced and using it, if it is
>>>> valid.
>>>>
>>>> Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
>>>> Cc: <stable@vger.kernel.org>
>>>
>>> This seems reasonable to me.  Harry, Leo, Any objections?
>>>
>> Looks good to me.
>>
>> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
>>
>> Harry
>>
>>> Alex
>>>
>>>> ---
>>>>
>>>>  From c9398160caf4ff20e63b8ba3a4366d6ef95c4ac3 Mon Sep 17 00:00:00 2001
>>>> From: Werner Sembach <wse@tuxedocomputers.com>
>>>> Date: Wed, 17 Mar 2021 12:52:22 +0100
>>>> Subject: [PATCH] Retry forcing YCbCr420 color on failed encoder validation
>>>>
>>>> ---
>>>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++++++++
>>>>   1 file changed, 9 insertions(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>>> index 961abf1cf040..2d16389b5f1e 100644
>>>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>>>> @@ -5727,6 +5727,15 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
>>>>
>>>>          } while (stream == NULL && requested_bpc >= 6);
>>>>
>>>> +       if (dc_result == DC_FAIL_ENC_VALIDATE && !aconnector->force_yuv420_output) {
>>>> +               DRM_DEBUG_KMS("Retry forcing YCbCr420 encoding\n");
>>>> +
>>>> +               aconnector->force_yuv420_output = true;
>>>> +               stream = create_validate_stream_for_sink(aconnector, drm_mode,
>>>> +                                               dm_state, old_stream);
>>>> +               aconnector->force_yuv420_output = false;
>>>> +       }
>>>> +
>>>>          return stream;
>>>>   }
>>>>
>>>> --
>>>> 2.25.1
>>>>
>>>> _______________________________________________
>>>> dri-devel mailing list
>>>> dri-devel@lists.freedesktop.org
>>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-01 18:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-17 15:13 [PATCH] drm/amd/display: Try YCbCr420 color when YCbCr444 fails Werner Sembach
2021-03-24 20:23 ` Alex Deucher
2021-03-26 14:59   ` Harry Wentland
2021-03-29 15:28     ` Alex Deucher
2021-04-01 12:32       ` Werner Sembach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).