@@ -152,7 +152,7 @@ uint32_t dc_bandwidth_in_kbps_from_timing(
152
152
}
153
153
154
154
/* Forward Declerations */
155
- static unsigned int get_min_slice_count_for_odm (
155
+ static unsigned int get_min_dsc_slice_count_for_odm (
156
156
const struct display_stream_compressor * dsc ,
157
157
const struct dsc_enc_caps * dsc_enc_caps ,
158
158
const struct dc_crtc_timing * timing );
@@ -466,7 +466,7 @@ bool dc_dsc_compute_bandwidth_range(
466
466
struct dc_dsc_bw_range * range )
467
467
{
468
468
bool is_dsc_possible = false;
469
- unsigned int min_slice_count ;
469
+ unsigned int min_dsc_slice_count ;
470
470
struct dsc_enc_caps dsc_enc_caps ;
471
471
struct dsc_enc_caps dsc_common_caps ;
472
472
struct dc_dsc_config config = {0 };
@@ -478,14 +478,14 @@ bool dc_dsc_compute_bandwidth_range(
478
478
479
479
get_dsc_enc_caps (dsc , & dsc_enc_caps , timing -> pix_clk_100hz );
480
480
481
- min_slice_count = get_min_slice_count_for_odm (dsc , & dsc_enc_caps , timing );
481
+ min_dsc_slice_count = get_min_dsc_slice_count_for_odm (dsc , & dsc_enc_caps , timing );
482
482
483
483
is_dsc_possible = intersect_dsc_caps (dsc_sink_caps , & dsc_enc_caps ,
484
484
timing -> pixel_encoding , & dsc_common_caps );
485
485
486
486
if (is_dsc_possible )
487
487
is_dsc_possible = setup_dsc_config (dsc_sink_caps , & dsc_enc_caps , 0 , timing ,
488
- & options , link_encoding , min_slice_count , & config );
488
+ & options , link_encoding , min_dsc_slice_count , & config );
489
489
490
490
if (is_dsc_possible )
491
491
is_dsc_possible = decide_dsc_bandwidth_range (min_bpp_x16 , max_bpp_x16 ,
@@ -593,14 +593,12 @@ static void build_dsc_enc_caps(
593
593
594
594
struct dc * dc ;
595
595
596
- memset (& single_dsc_enc_caps , 0 , sizeof (struct dsc_enc_caps ));
597
-
598
596
if (!dsc || !dsc -> ctx || !dsc -> ctx -> dc || !dsc -> funcs -> dsc_get_single_enc_caps )
599
597
return ;
600
598
601
599
dc = dsc -> ctx -> dc ;
602
600
603
- if (!dc -> clk_mgr || !dc -> clk_mgr -> funcs -> get_max_clock_khz || !dc -> res_pool )
601
+ if (!dc -> clk_mgr || !dc -> clk_mgr -> funcs -> get_max_clock_khz || !dc -> res_pool || dc -> debug . disable_dsc )
604
602
return ;
605
603
606
604
/* get max DSCCLK from clk_mgr */
@@ -634,7 +632,7 @@ static inline uint32_t dsc_div_by_10_round_up(uint32_t value)
634
632
return (value + 9 ) / 10 ;
635
633
}
636
634
637
- static unsigned int get_min_slice_count_for_odm (
635
+ static unsigned int get_min_dsc_slice_count_for_odm (
638
636
const struct display_stream_compressor * dsc ,
639
637
const struct dsc_enc_caps * dsc_enc_caps ,
640
638
const struct dc_crtc_timing * timing )
@@ -651,6 +649,10 @@ static unsigned int get_min_slice_count_for_odm(
651
649
}
652
650
}
653
651
652
+ /* validate parameters */
653
+ if (max_dispclk_khz == 0 || dsc_enc_caps -> max_slice_width == 0 )
654
+ return 1 ;
655
+
654
656
/* consider minimum odm slices required due to
655
657
* 1) display pipe throughput (dispclk)
656
658
* 2) max image width per slice
@@ -669,13 +671,12 @@ static void get_dsc_enc_caps(
669
671
{
670
672
memset (dsc_enc_caps , 0 , sizeof (struct dsc_enc_caps ));
671
673
672
- if (!dsc )
674
+ if (!dsc || ! dsc -> ctx || ! dsc -> ctx -> dc || dsc -> ctx -> dc -> debug . disable_dsc )
673
675
return ;
674
676
675
677
/* check if reported cap global or only for a single DCN DSC enc */
676
678
if (dsc -> funcs -> dsc_get_enc_caps ) {
677
- if (!dsc -> ctx -> dc -> debug .disable_dsc )
678
- dsc -> funcs -> dsc_get_enc_caps (dsc_enc_caps , pixel_clock_100Hz );
679
+ dsc -> funcs -> dsc_get_enc_caps (dsc_enc_caps , pixel_clock_100Hz );
679
680
} else {
680
681
build_dsc_enc_caps (dsc , dsc_enc_caps );
681
682
}
@@ -1295,18 +1296,18 @@ bool dc_dsc_compute_config(
1295
1296
{
1296
1297
bool is_dsc_possible = false;
1297
1298
struct dsc_enc_caps dsc_enc_caps ;
1298
- unsigned int min_slice_count ;
1299
+ unsigned int min_dsc_slice_count ;
1299
1300
get_dsc_enc_caps (dsc , & dsc_enc_caps , timing -> pix_clk_100hz );
1300
1301
1301
- min_slice_count = get_min_slice_count_for_odm (dsc , & dsc_enc_caps , timing );
1302
+ min_dsc_slice_count = get_min_dsc_slice_count_for_odm (dsc , & dsc_enc_caps , timing );
1302
1303
1303
1304
is_dsc_possible = setup_dsc_config (dsc_sink_caps ,
1304
1305
& dsc_enc_caps ,
1305
1306
target_bandwidth_kbps ,
1306
1307
timing ,
1307
1308
options ,
1308
1309
link_encoding ,
1309
- min_slice_count ,
1310
+ min_dsc_slice_count ,
1310
1311
dsc_cfg );
1311
1312
return is_dsc_possible ;
1312
1313
}
0 commit comments