@@ -3356,27 +3356,21 @@ get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing)
3356
3356
return color_space ;
3357
3357
}
3358
3358
3359
- static void reduce_mode_colour_depth (struct dc_crtc_timing * timing_out )
3360
- {
3361
- if (timing_out -> display_color_depth <= COLOR_DEPTH_888 )
3362
- return ;
3363
-
3364
- timing_out -> display_color_depth -- ;
3365
- }
3366
-
3367
- static void adjust_colour_depth_from_display_info (struct dc_crtc_timing * timing_out ,
3368
- const struct drm_display_info * info )
3359
+ static bool adjust_colour_depth_from_display_info (
3360
+ struct dc_crtc_timing * timing_out ,
3361
+ const struct drm_display_info * info )
3369
3362
{
3363
+ enum dc_color_depth depth = timing_out -> display_color_depth ;
3370
3364
int normalized_clk ;
3371
- if (timing_out -> display_color_depth <= COLOR_DEPTH_888 )
3372
- return ;
3373
3365
do {
3374
3366
normalized_clk = timing_out -> pix_clk_100hz / 10 ;
3375
3367
/* YCbCr 4:2:0 requires additional adjustment of 1/2 */
3376
3368
if (timing_out -> pixel_encoding == PIXEL_ENCODING_YCBCR420 )
3377
3369
normalized_clk /= 2 ;
3378
3370
/* Adjusting pix clock following on HDMI spec based on colour depth */
3379
- switch (timing_out -> display_color_depth ) {
3371
+ switch (depth ) {
3372
+ case COLOR_DEPTH_888 :
3373
+ break ;
3380
3374
case COLOR_DEPTH_101010 :
3381
3375
normalized_clk = (normalized_clk * 30 ) / 24 ;
3382
3376
break ;
@@ -3387,14 +3381,15 @@ static void adjust_colour_depth_from_display_info(struct dc_crtc_timing *timing_
3387
3381
normalized_clk = (normalized_clk * 48 ) / 24 ;
3388
3382
break ;
3389
3383
default :
3390
- return ;
3384
+ /* The above depths are the only ones valid for HDMI. */
3385
+ return false;
3391
3386
}
3392
- if (normalized_clk <= info -> max_tmds_clock )
3393
- return ;
3394
- reduce_mode_colour_depth ( timing_out ) ;
3395
-
3396
- } while (timing_out -> display_color_depth > COLOR_DEPTH_888 );
3397
-
3387
+ if (normalized_clk <= info -> max_tmds_clock ) {
3388
+ timing_out -> display_color_depth = depth ;
3389
+ return true ;
3390
+ }
3391
+ } while (-- depth > COLOR_DEPTH_666 );
3392
+ return false;
3398
3393
}
3399
3394
3400
3395
static void fill_stream_properties_from_drm_display_mode (
@@ -3474,8 +3469,14 @@ static void fill_stream_properties_from_drm_display_mode(
3474
3469
3475
3470
stream -> out_transfer_func -> type = TF_TYPE_PREDEFINED ;
3476
3471
stream -> out_transfer_func -> tf = TRANSFER_FUNCTION_SRGB ;
3477
- if (stream -> signal == SIGNAL_TYPE_HDMI_TYPE_A )
3478
- adjust_colour_depth_from_display_info (timing_out , info );
3472
+ if (stream -> signal == SIGNAL_TYPE_HDMI_TYPE_A ) {
3473
+ if (!adjust_colour_depth_from_display_info (timing_out , info ) &&
3474
+ drm_mode_is_420_also (info , mode_in ) &&
3475
+ timing_out -> pixel_encoding != PIXEL_ENCODING_YCBCR420 ) {
3476
+ timing_out -> pixel_encoding = PIXEL_ENCODING_YCBCR420 ;
3477
+ adjust_colour_depth_from_display_info (timing_out , info );
3478
+ }
3479
+ }
3479
3480
}
3480
3481
3481
3482
static void fill_audio_info (struct audio_info * audio_info ,
0 commit comments