On 2018-07-04 04:57 PM, Mikita Lipski wrote: > > > On 2018-07-04 04:51 PM, Harry Wentland wrote: >> On 2018-07-04 04:40 PM, mikita.lipski at amd.com wrote: >>> From: Mikita Lipski <mikita.lipski at amd.com> >>> >>> [why] >>> HDMI 2.0 fails to validate 4K at 60 timing with 10 bpc >>> [how] >>> Adding a helper function that would verify if the display depth >>> assigned would pass a bandwidth validation. >>> Drop the display depth by one level till calculated pixel clk >>> is lower than maximum TMDS clk. >>> >>> Bugzilla: https://bugs.freedesktop.org/106959 >>> >>> Signed-off-by: Mikita Lipski <mikita.lipski at amd.com> >>> --- >>> Â drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 42 +++++++++++++++++++++++ >>> Â 1 file changed, 42 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 ed09e36..c572e86 100644 >>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c >>> @@ -2218,6 +2218,46 @@ get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing) >>> Â Â Â Â Â return color_space; >>> Â } >>> Â +static void reduce_mode_colour_depth(struct dc_crtc_timing *timing_out) >>> +{ >>> +Â Â Â if (timing_out->display_color_depth <= COLOR_DEPTH_888) >>> +Â Â Â Â Â Â Â return; >>> + >>> +Â Â Â timing_out->display_color_depth--; >>> +} >>> + >>> +static void check_if_display_depth_is_supported(struct dc_crtc_timing *timing_out, >> >> Doesn't this update timing_out->display_color_depth? We should probably name this something else, maybe "pick_max_supported_color_depth" or something similar. >> >> Harry >> > The function reduce_mode_colour_depth introduced above is the one that modifies timing_out->display_color_depth. > But check_if_display_depth_is_supported here calls reduce_mode_color_depth, so does more than just "check". :) Harry > Nick >>> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â const struct drm_display_info *info) >>> +{ >>> +Â Â Â int normalized_clk; >>> +Â Â Â if (timing_out->display_color_depth <= COLOR_DEPTH_888) >>> +Â Â Â Â Â Â Â return; >>> +Â Â Â do { >>> +Â Â Â Â Â Â Â normalized_clk = timing_out->pix_clk_khz; >>> +Â Â Â Â Â Â Â /* YCbCr 4:2:0 requires additional adjustment of 1/2 */ >>> +Â Â Â Â Â Â Â if (timing_out->pixel_encoding == PIXEL_ENCODING_YCBCR420) >>> +Â Â Â Â Â Â Â Â Â Â Â normalized_clk /= 2; >>> +Â Â Â Â Â Â Â /* Adjusting pix clock following on HDMI spec based on colour depth */ >>> +Â Â Â Â Â Â Â switch (timing_out->display_color_depth) { >>> +Â Â Â Â Â Â Â case COLOR_DEPTH_101010: >>> +Â Â Â Â Â Â Â Â Â Â Â normalized_clk = (normalized_clk * 30) / 24; >>> +Â Â Â Â Â Â Â Â Â Â Â break; >>> +Â Â Â Â Â Â Â case COLOR_DEPTH_121212: >>> +Â Â Â Â Â Â Â Â Â Â Â normalized_clk = (normalized_clk * 36) / 24; >>> +Â Â Â Â Â Â Â Â Â Â Â break; >>> +Â Â Â Â Â Â Â case COLOR_DEPTH_161616: >>> +Â Â Â Â Â Â Â Â Â Â Â normalized_clk = (normalized_clk * 48) / 24; >>> +Â Â Â Â Â Â Â Â Â Â Â break; >>> +Â Â Â Â Â Â Â default: >>> +Â Â Â Â Â Â Â Â Â Â Â return; >>> +Â Â Â Â Â Â Â } >>> +Â Â Â Â Â Â Â if (normalized_clk <= info->max_tmds_clock) >>> +Â Â Â Â Â Â Â Â Â Â Â return; >>> +Â Â Â Â Â Â Â reduce_mode_colour_depth(timing_out); >>> + >>> +Â Â Â } while (timing_out->display_color_depth > COLOR_DEPTH_888); >>> + >>> +} >>> Â /*****************************************************************************/ >>> Â Â static void >>> @@ -2273,6 +2313,8 @@ fill_stream_properties_from_drm_display_mode(struct dc_stream_state *stream, >>> Â Â Â Â Â Â stream->out_transfer_func->type = TF_TYPE_PREDEFINED; >>> Â Â Â Â Â stream->out_transfer_func->tf = TRANSFER_FUNCTION_SRGB; >>> +Â Â Â if (stream->sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A) >>> +Â Â Â Â Â Â Â check_if_display_depth_is_supported(timing_out, info); >>> Â } >>> Â Â static void fill_audio_info(struct audio_info *audio_info, >>>