@@ -3528,10 +3528,9 @@ static void CalculateUrgentBurstFactor(
3528
3528
dml2_printf("DML::%s: UrgentBurstFactorChroma = %f\n", __func__, *UrgentBurstFactorChroma);
3529
3529
dml2_printf("DML::%s: NotEnoughUrgentLatencyHiding = %d\n", __func__, *NotEnoughUrgentLatencyHiding);
3530
3530
#endif
3531
-
3532
3531
}
3533
3532
3534
- static void CalculateDCFCLKDeepSleep (
3533
+ static void CalculateDCFCLKDeepSleepTdlut (
3535
3534
const struct dml2_display_cfg *display_cfg,
3536
3535
unsigned int NumberOfActiveSurfaces,
3537
3536
unsigned int BytePerPixelY[],
@@ -3546,6 +3545,10 @@ static void CalculateDCFCLKDeepSleep(
3546
3545
double ReadBandwidthChroma[],
3547
3546
unsigned int ReturnBusWidth,
3548
3547
3548
+ double dispclk,
3549
+ unsigned int tdlut_bytes_to_deliver[],
3550
+ double prefetch_swath_time_us[],
3551
+
3549
3552
// Output
3550
3553
double *DCFClkDeepSleep)
3551
3554
{
@@ -3580,6 +3583,22 @@ static void CalculateDCFCLKDeepSleep(
3580
3583
}
3581
3584
DCFClkDeepSleepPerSurface[k] = math_max2(DCFClkDeepSleepPerSurface[k], pixel_rate_mhz / 16);
3582
3585
3586
+ // adjust for 3dlut delivery time
3587
+ if (display_cfg->plane_descriptors[k].tdlut.setup_for_tdlut && tdlut_bytes_to_deliver[k] > 0) {
3588
+ double tdlut_required_deepsleep_dcfclk = (double) tdlut_bytes_to_deliver[k] / 64.0 / prefetch_swath_time_us[k];
3589
+
3590
+ dml2_printf("DML::%s: k=%d, DCFClkDeepSleepPerSurface = %f\n", __func__, k, DCFClkDeepSleepPerSurface[k]);
3591
+ dml2_printf("DML::%s: k=%d, tdlut_bytes_to_deliver = %d\n", __func__, k, tdlut_bytes_to_deliver[k]);
3592
+ dml2_printf("DML::%s: k=%d, prefetch_swath_time_us = %f\n", __func__, k, prefetch_swath_time_us[k]);
3593
+ dml2_printf("DML::%s: k=%d, tdlut_required_deepsleep_dcfclk = %f\n", __func__, k, tdlut_required_deepsleep_dcfclk);
3594
+
3595
+ // increase the deepsleep dcfclk to match the original dispclk throughput rate
3596
+ if (tdlut_required_deepsleep_dcfclk > DCFClkDeepSleepPerSurface[k]) {
3597
+ DCFClkDeepSleepPerSurface[k] = math_max2(DCFClkDeepSleepPerSurface[k], tdlut_required_deepsleep_dcfclk);
3598
+ DCFClkDeepSleepPerSurface[k] = math_max2(DCFClkDeepSleepPerSurface[k], dispclk / 4.0);
3599
+ }
3600
+ }
3601
+
3583
3602
#ifdef __DML_VBA_DEBUG__
3584
3603
dml2_printf("DML::%s: k=%u, PixelClock = %f\n", __func__, k, pixel_rate_mhz);
3585
3604
dml2_printf("DML::%s: k=%u, DCFClkDeepSleepPerSurface = %f\n", __func__, k, DCFClkDeepSleepPerSurface[k]);
@@ -3602,9 +3621,56 @@ static void CalculateDCFCLKDeepSleep(
3602
3621
for (unsigned int k = 0; k < NumberOfActiveSurfaces; ++k) {
3603
3622
*DCFClkDeepSleep = math_max2(*DCFClkDeepSleep, DCFClkDeepSleepPerSurface[k]);
3604
3623
}
3624
+
3605
3625
dml2_printf("DML::%s: DCFClkDeepSleep = %f (final)\n", __func__, *DCFClkDeepSleep);
3606
3626
}
3607
3627
3628
+ static void CalculateDCFCLKDeepSleep(
3629
+ const struct dml2_display_cfg *display_cfg,
3630
+ unsigned int NumberOfActiveSurfaces,
3631
+ unsigned int BytePerPixelY[],
3632
+ unsigned int BytePerPixelC[],
3633
+ unsigned int SwathWidthY[],
3634
+ unsigned int SwathWidthC[],
3635
+ unsigned int DPPPerSurface[],
3636
+ double PSCL_THROUGHPUT[],
3637
+ double PSCL_THROUGHPUT_CHROMA[],
3638
+ double Dppclk[],
3639
+ double ReadBandwidthLuma[],
3640
+ double ReadBandwidthChroma[],
3641
+ unsigned int ReturnBusWidth,
3642
+
3643
+ // Output
3644
+ double *DCFClkDeepSleep)
3645
+ {
3646
+ double zero_double[DML2_MAX_PLANES];
3647
+ unsigned int zero_integer[DML2_MAX_PLANES];
3648
+
3649
+ memset(zero_double, 0, DML2_MAX_PLANES * sizeof(double));
3650
+ memset(zero_integer, 0, DML2_MAX_PLANES * sizeof(unsigned int));
3651
+
3652
+ CalculateDCFCLKDeepSleepTdlut(
3653
+ display_cfg,
3654
+ NumberOfActiveSurfaces,
3655
+ BytePerPixelY,
3656
+ BytePerPixelC,
3657
+ SwathWidthY,
3658
+ SwathWidthC,
3659
+ DPPPerSurface,
3660
+ PSCL_THROUGHPUT,
3661
+ PSCL_THROUGHPUT_CHROMA,
3662
+ Dppclk,
3663
+ ReadBandwidthLuma,
3664
+ ReadBandwidthChroma,
3665
+ ReturnBusWidth,
3666
+ 0,
3667
+ zero_integer, //tdlut_bytes_to_deliver,
3668
+ zero_double, //prefetch_swath_time_us,
3669
+
3670
+ // Output
3671
+ DCFClkDeepSleep);
3672
+ }
3673
+
3608
3674
static double CalculateWriteBackDelay(
3609
3675
enum dml2_source_format_class WritebackPixelFormat,
3610
3676
double WritebackHRatio,
@@ -4604,6 +4670,7 @@ static void calculate_tdlut_setting(
4604
4670
*p->tdlut_groups_per_2row_ub = 0;
4605
4671
*p->tdlut_opt_time = 0;
4606
4672
*p->tdlut_drain_time = 0;
4673
+ *p->tdlut_bytes_to_deliver = 0;
4607
4674
*p->tdlut_bytes_per_group = 0;
4608
4675
*p->tdlut_pte_bytes_per_frame = 0;
4609
4676
*p->tdlut_bytes_per_frame = 0;
@@ -4672,6 +4739,7 @@ static void calculate_tdlut_setting(
4672
4739
*p->tdlut_groups_per_2row_ub = (unsigned int)math_ceil2((double) *p->tdlut_bytes_per_frame / *p->tdlut_bytes_per_group, 1);
4673
4740
*p->tdlut_opt_time = (*p->tdlut_bytes_per_frame - p->cursor_buffer_size * 1024) / tdlut_drain_rate;
4674
4741
*p->tdlut_drain_time = p->cursor_buffer_size * 1024 / tdlut_drain_rate;
4742
+ *p->tdlut_bytes_to_deliver = (unsigned int) (p->cursor_buffer_size * 1024.0);
4675
4743
}
4676
4744
4677
4745
#ifdef __DML_VBA_DEBUG__
@@ -4692,6 +4760,7 @@ static void calculate_tdlut_setting(
4692
4760
dml2_printf("DML::%s: tdlut_delivery_cycles = %u\n", __func__, tdlut_delivery_cycles);
4693
4761
dml2_printf("DML::%s: tdlut_opt_time = %f\n", __func__, *p->tdlut_opt_time);
4694
4762
dml2_printf("DML::%s: tdlut_drain_time = %f\n", __func__, *p->tdlut_drain_time);
4763
+ dml2_printf("DML::%s: tdlut_bytes_to_deliver = %d\n", __func__, *p->tdlut_bytes_to_deliver);
4695
4764
dml2_printf("DML::%s: tdlut_groups_per_2row_ub = %d\n", __func__, *p->tdlut_groups_per_2row_ub);
4696
4765
#endif
4697
4766
}
@@ -5700,6 +5769,7 @@ static bool CalculatePrefetchSchedule(struct dml2_core_internal_scratch *scratch
5700
5769
5701
5770
s->cursor_prefetch_bytes = (unsigned int)math_max2(p->cursor_bytes_per_chunk, 4 * p->cursor_bytes_per_line);
5702
5771
*p->prefetch_cursor_bw = p->num_cursors * s->cursor_prefetch_bytes / (s->LinesToRequestPrefetchPixelData * s->LineTime);
5772
+ *p->prefetch_swath_time_us = (s->LinesToRequestPrefetchPixelData * s->LineTime);
5703
5773
5704
5774
#ifdef __DML_VBA_DEBUG__
5705
5775
dml2_printf("DML::%s: TimeForFetchingVM = %f\n", __func__, s->TimeForFetchingVM);
@@ -5710,6 +5780,7 @@ static bool CalculatePrefetchSchedule(struct dml2_core_internal_scratch *scratch
5710
5780
dml2_printf("DML::%s: dst_y_per_row_vblank = %f\n", __func__, *p->dst_y_per_row_vblank);
5711
5781
dml2_printf("DML::%s: LinesToRequestPrefetchPixelData = %f\n", __func__, s->LinesToRequestPrefetchPixelData);
5712
5782
dml2_printf("DML::%s: PrefetchSourceLinesY = %f\n", __func__, p->PrefetchSourceLinesY);
5783
+ dml2_printf("DML::%s: prefetch_swath_time_us = %f\n", __func__, *p->prefetch_swath_time_us);
5713
5784
5714
5785
dml2_printf("DML::%s: cursor_bytes_per_chunk = %d\n", __func__, p->cursor_bytes_per_chunk);
5715
5786
dml2_printf("DML::%s: cursor_bytes_per_line = %d\n", __func__, p->cursor_bytes_per_line);
@@ -8817,6 +8888,7 @@ static bool dml_core_mode_support(struct dml2_core_calcs_mode_support_ex *in_out
8817
8888
calculate_tdlut_setting_params->tdlut_groups_per_2row_ub = &s->tdlut_groups_per_2row_ub[k];
8818
8889
calculate_tdlut_setting_params->tdlut_opt_time = &s->tdlut_opt_time[k];
8819
8890
calculate_tdlut_setting_params->tdlut_drain_time = &s->tdlut_drain_time[k];
8891
+ calculate_tdlut_setting_params->tdlut_bytes_to_deliver = &s->tdlut_bytes_to_deliver[k];
8820
8892
calculate_tdlut_setting_params->tdlut_bytes_per_group = &s->tdlut_bytes_per_group[k];
8821
8893
8822
8894
calculate_tdlut_setting(&mode_lib->scratch, calculate_tdlut_setting_params);
@@ -9009,6 +9081,7 @@ static bool dml_core_mode_support(struct dml2_core_calcs_mode_support_ex *in_out
9009
9081
CalculatePrefetchSchedule_params->prefetch_sw_bytes = &s->prefetch_sw_bytes[k];
9010
9082
CalculatePrefetchSchedule_params->Tpre_rounded = &s->Tpre_rounded[k];
9011
9083
CalculatePrefetchSchedule_params->Tpre_oto = &s->Tpre_oto[k];
9084
+ CalculatePrefetchSchedule_params->prefetch_swath_time_us = &s->prefetch_swath_time_us[k];
9012
9085
9013
9086
mode_lib->ms.NoTimeForPrefetch[k] = CalculatePrefetchSchedule(&mode_lib->scratch, CalculatePrefetchSchedule_params);
9014
9087
@@ -9017,6 +9090,27 @@ static bool dml_core_mode_support(struct dml2_core_calcs_mode_support_ex *in_out
9017
9090
dml2_printf("DML::%s: k=%d, dst_y_per_row_vblank = %f\n", __func__, k, *CalculatePrefetchSchedule_params->dst_y_per_row_vblank);
9018
9091
} // for k num_planes
9019
9092
9093
+ CalculateDCFCLKDeepSleepTdlut(
9094
+ display_cfg,
9095
+ mode_lib->ms.num_active_planes,
9096
+ mode_lib->ms.BytePerPixelY,
9097
+ mode_lib->ms.BytePerPixelC,
9098
+ mode_lib->ms.SwathWidthY,
9099
+ mode_lib->ms.SwathWidthC,
9100
+ mode_lib->ms.NoOfDPP,
9101
+ mode_lib->ms.PSCL_FACTOR,
9102
+ mode_lib->ms.PSCL_FACTOR_CHROMA,
9103
+ mode_lib->ms.RequiredDPPCLK,
9104
+ mode_lib->ms.vactive_sw_bw_l,
9105
+ mode_lib->ms.vactive_sw_bw_c,
9106
+ mode_lib->soc.return_bus_width_bytes,
9107
+ mode_lib->ms.RequiredDISPCLK,
9108
+ s->tdlut_bytes_to_deliver,
9109
+ s->prefetch_swath_time_us,
9110
+
9111
+ /* Output */
9112
+ &mode_lib->ms.dcfclk_deepsleep);
9113
+
9020
9114
for (k = 0; k < mode_lib->ms.num_active_planes; k++) {
9021
9115
if (mode_lib->ms.dst_y_prefetch[k] < 2.0
9022
9116
|| mode_lib->ms.LinesForVM[k] >= 32.0
@@ -10368,12 +10462,6 @@ static bool dml_core_mode_programming(struct dml2_core_calcs_mode_programming_ex
10368
10462
dml2_assert(s->SOCCLK > 0);
10369
10463
10370
10464
#ifdef __DML_VBA_DEBUG__
10371
- // dml2_printf_dml_display_cfg_timing(&display_cfg->timing, s->num_active_planes);
10372
- // dml2_printf_dml_display_cfg_plane(&display_cfg->plane, s->num_active_planes);
10373
- // dml2_printf_dml_display_cfg_surface(&display_cfg->surface, s->num_active_planes);
10374
- // dml2_printf_dml_display_cfg_output(&display_cfg->output, s->num_active_planes);
10375
- // dml2_printf_dml_display_cfg_hw_resource(&display_cfg->hw, s->num_active_planes);
10376
-
10377
10465
dml2_printf("DML::%s: num_active_planes = %u\n", __func__, s->num_active_planes);
10378
10466
dml2_printf("DML::%s: num_active_pipes = %u\n", __func__, mode_lib->mp.num_active_pipes);
10379
10467
dml2_printf("DML::%s: Dcfclk = %f\n", __func__, mode_lib->mp.Dcfclk);
@@ -10832,8 +10920,8 @@ static bool dml_core_mode_programming(struct dml2_core_calcs_mode_programming_ex
10832
10920
calculate_tdlut_setting_params->tdlut_groups_per_2row_ub = &s->tdlut_groups_per_2row_ub[k];
10833
10921
calculate_tdlut_setting_params->tdlut_opt_time = &s->tdlut_opt_time[k];
10834
10922
calculate_tdlut_setting_params->tdlut_drain_time = &s->tdlut_drain_time[k];
10923
+ calculate_tdlut_setting_params->tdlut_bytes_to_deliver = &s->tdlut_bytes_to_deliver[k];
10835
10924
calculate_tdlut_setting_params->tdlut_bytes_per_group = &s->tdlut_bytes_per_group[k];
10836
-
10837
10925
calculate_tdlut_setting(&mode_lib->scratch, calculate_tdlut_setting_params);
10838
10926
}
10839
10927
@@ -11219,6 +11307,7 @@ static bool dml_core_mode_programming(struct dml2_core_calcs_mode_programming_ex
11219
11307
CalculatePrefetchSchedule_params->prefetch_sw_bytes = &s->prefetch_sw_bytes[k];
11220
11308
CalculatePrefetchSchedule_params->Tpre_rounded = &s->Tpre_rounded[k];
11221
11309
CalculatePrefetchSchedule_params->Tpre_oto = &s->Tpre_oto[k];
11310
+ CalculatePrefetchSchedule_params->prefetch_swath_time_us = &s->dummy_single[0];
11222
11311
11223
11312
mode_lib->mp.NoTimeToPrefetch[k] = CalculatePrefetchSchedule(&mode_lib->scratch, CalculatePrefetchSchedule_params);
11224
11313
0 commit comments