Skip to content

Commit 400443e

Browse files
Mikita Lipskialexdeucher
authored andcommitted
drm/amd/display: add a check for display depth validity
[why] HDMI 2.0 fails to validate 4K@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@amd.com> Tested-by: Mike Lothian <mike@fireburn.co.uk> Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent fe61a2f commit 400443e

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

‎drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2176,6 +2176,46 @@ get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing)
21762176
return color_space;
21772177
}
21782178

2179+
static void reduce_mode_colour_depth(struct dc_crtc_timing *timing_out)
2180+
{
2181+
if (timing_out->display_color_depth <= COLOR_DEPTH_888)
2182+
return;
2183+
2184+
timing_out->display_color_depth--;
2185+
}
2186+
2187+
static void adjust_colour_depth_from_display_info(struct dc_crtc_timing *timing_out,
2188+
const struct drm_display_info *info)
2189+
{
2190+
int normalized_clk;
2191+
if (timing_out->display_color_depth <= COLOR_DEPTH_888)
2192+
return;
2193+
do {
2194+
normalized_clk = timing_out->pix_clk_khz;
2195+
/* YCbCr 4:2:0 requires additional adjustment of 1/2 */
2196+
if (timing_out->pixel_encoding == PIXEL_ENCODING_YCBCR420)
2197+
normalized_clk /= 2;
2198+
/* Adjusting pix clock following on HDMI spec based on colour depth */
2199+
switch (timing_out->display_color_depth) {
2200+
case COLOR_DEPTH_101010:
2201+
normalized_clk = (normalized_clk * 30) / 24;
2202+
break;
2203+
case COLOR_DEPTH_121212:
2204+
normalized_clk = (normalized_clk * 36) / 24;
2205+
break;
2206+
case COLOR_DEPTH_161616:
2207+
normalized_clk = (normalized_clk * 48) / 24;
2208+
break;
2209+
default:
2210+
return;
2211+
}
2212+
if (normalized_clk <= info->max_tmds_clock)
2213+
return;
2214+
reduce_mode_colour_depth(timing_out);
2215+
2216+
} while (timing_out->display_color_depth > COLOR_DEPTH_888);
2217+
2218+
}
21792219
/*****************************************************************************/
21802220

21812221
static void
@@ -2232,6 +2272,8 @@ fill_stream_properties_from_drm_display_mode(struct dc_stream_state *stream,
22322272

22332273
stream->out_transfer_func->type = TF_TYPE_PREDEFINED;
22342274
stream->out_transfer_func->tf = TRANSFER_FUNCTION_SRGB;
2275+
if (stream->sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A)
2276+
adjust_colour_depth_from_display_info(timing_out, info);
22352277
}
22362278

22372279
static void fill_audio_info(struct audio_info *audio_info,

0 commit comments

Comments
 (0)