Re: [PATCH] drm/amd/display: adding ycbcr420 pixel encoding for hdmi

2018-07-04 Thread Harry Wentland
On 2018-07-04 04:38 PM, mikita.lip...@amd.com wrote:
> From: Mikita Lipski 
> 
> [why]
> HDMI EDID's VSDB contains spectial timings for specifically
> YCbCr 4:2:0 colour space. In those cases we need to verify
> if the mode provided is one of the special ones has to use
> YCbCr 4:2:0 pixel encoding for display info.
> [how]
> Verify if the mode is using specific ycbcr420 colour space with
> the help of DRM helper function and assign the mode to use
> ycbcr420 pixel encoding.
> 
> Signed-off-by: Mikita Lipski 
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> 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 01d14d8..ed09e36 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -2226,7 +2226,7 @@ fill_stream_properties_from_drm_display_mode(struct 
> dc_stream_state *stream,
>const struct drm_connector 
> *connector)
>  {
>   struct dc_crtc_timing *timing_out = >timing;
> -
> + const struct drm_display_info *info = >display_info;

Nit: there should be a newline after variable declarations.

With that fixed this patch is
Reviewed-by: Harry Wentland 

Harry


>   memset(timing_out, 0, sizeof(struct dc_crtc_timing));
>  
>   timing_out->h_border_left = 0;
> @@ -2234,8 +2234,10 @@ fill_stream_properties_from_drm_display_mode(struct 
> dc_stream_state *stream,
>   timing_out->v_border_top = 0;
>   timing_out->v_border_bottom = 0;
>   /* TODO: un-hardcode */
> -
> - if ((connector->display_info.color_formats & DRM_COLOR_FORMAT_YCRCB444)
> + if (drm_mode_is_420_only(info, mode_in)
> + && stream->sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A)
> + timing_out->pixel_encoding = PIXEL_ENCODING_YCBCR420;
> + else if ((connector->display_info.color_formats & 
> DRM_COLOR_FORMAT_YCRCB444)
>   && stream->sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A)
>   timing_out->pixel_encoding = PIXEL_ENCODING_YCBCR444;
>   else
> 
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH] drm/amd/display: adding ycbcr420 pixel encoding for hdmi

2018-07-04 Thread mikita.lipski
From: Mikita Lipski 

[why]
HDMI EDID's VSDB contains spectial timings for specifically
YCbCr 4:2:0 colour space. In those cases we need to verify
if the mode provided is one of the special ones has to use
YCbCr 4:2:0 pixel encoding for display info.
[how]
Verify if the mode is using specific ycbcr420 colour space with
the help of DRM helper function and assign the mode to use
ycbcr420 pixel encoding.

Signed-off-by: Mikita Lipski 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

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 01d14d8..ed09e36 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2226,7 +2226,7 @@ fill_stream_properties_from_drm_display_mode(struct 
dc_stream_state *stream,
 const struct drm_connector 
*connector)
 {
struct dc_crtc_timing *timing_out = >timing;
-
+   const struct drm_display_info *info = >display_info;
memset(timing_out, 0, sizeof(struct dc_crtc_timing));
 
timing_out->h_border_left = 0;
@@ -2234,8 +2234,10 @@ fill_stream_properties_from_drm_display_mode(struct 
dc_stream_state *stream,
timing_out->v_border_top = 0;
timing_out->v_border_bottom = 0;
/* TODO: un-hardcode */
-
-   if ((connector->display_info.color_formats & DRM_COLOR_FORMAT_YCRCB444)
+   if (drm_mode_is_420_only(info, mode_in)
+   && stream->sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A)
+   timing_out->pixel_encoding = PIXEL_ENCODING_YCBCR420;
+   else if ((connector->display_info.color_formats & 
DRM_COLOR_FORMAT_YCRCB444)
&& stream->sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A)
timing_out->pixel_encoding = PIXEL_ENCODING_YCBCR444;
else
-- 
2.7.4

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx