@@ -3528,10 +3528,9 @@ static void CalculateUrgentBurstFactor(
35283528 dml2_printf("DML::%s: UrgentBurstFactorChroma = %f\n", __func__, *UrgentBurstFactorChroma);
35293529 dml2_printf("DML::%s: NotEnoughUrgentLatencyHiding = %d\n", __func__, *NotEnoughUrgentLatencyHiding);
35303530#endif
3531-
35323531}
35333532
3534- static void CalculateDCFCLKDeepSleep (
3533+ static void CalculateDCFCLKDeepSleepTdlut (
35353534 const struct dml2_display_cfg *display_cfg,
35363535 unsigned int NumberOfActiveSurfaces,
35373536 unsigned int BytePerPixelY[],
@@ -3546,6 +3545,10 @@ static void CalculateDCFCLKDeepSleep(
35463545 double ReadBandwidthChroma[],
35473546 unsigned int ReturnBusWidth,
35483547
3548+ double dispclk,
3549+ unsigned int tdlut_bytes_to_deliver[],
3550+ double prefetch_swath_time_us[],
3551+
35493552 // Output
35503553 double *DCFClkDeepSleep)
35513554{
@@ -3580,6 +3583,22 @@ static void CalculateDCFCLKDeepSleep(
35803583 }
35813584 DCFClkDeepSleepPerSurface[k] = math_max2(DCFClkDeepSleepPerSurface[k], pixel_rate_mhz / 16);
35823585
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+
35833602#ifdef __DML_VBA_DEBUG__
35843603 dml2_printf("DML::%s: k=%u, PixelClock = %f\n", __func__, k, pixel_rate_mhz);
35853604 dml2_printf("DML::%s: k=%u, DCFClkDeepSleepPerSurface = %f\n", __func__, k, DCFClkDeepSleepPerSurface[k]);
@@ -3602,9 +3621,56 @@ static void CalculateDCFCLKDeepSleep(
36023621 for (unsigned int k = 0; k < NumberOfActiveSurfaces; ++k) {
36033622 *DCFClkDeepSleep = math_max2(*DCFClkDeepSleep, DCFClkDeepSleepPerSurface[k]);
36043623 }
3624+
36053625 dml2_printf("DML::%s: DCFClkDeepSleep = %f (final)\n", __func__, *DCFClkDeepSleep);
36063626}
36073627
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+
36083674static double CalculateWriteBackDelay(
36093675 enum dml2_source_format_class WritebackPixelFormat,
36103676 double WritebackHRatio,
@@ -4604,6 +4670,7 @@ static void calculate_tdlut_setting(
46044670 *p->tdlut_groups_per_2row_ub = 0;
46054671 *p->tdlut_opt_time = 0;
46064672 *p->tdlut_drain_time = 0;
4673+ *p->tdlut_bytes_to_deliver = 0;
46074674 *p->tdlut_bytes_per_group = 0;
46084675 *p->tdlut_pte_bytes_per_frame = 0;
46094676 *p->tdlut_bytes_per_frame = 0;
@@ -4672,6 +4739,7 @@ static void calculate_tdlut_setting(
46724739 *p->tdlut_groups_per_2row_ub = (unsigned int)math_ceil2((double) *p->tdlut_bytes_per_frame / *p->tdlut_bytes_per_group, 1);
46734740 *p->tdlut_opt_time = (*p->tdlut_bytes_per_frame - p->cursor_buffer_size * 1024) / tdlut_drain_rate;
46744741 *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);
46754743 }
46764744
46774745#ifdef __DML_VBA_DEBUG__
@@ -4692,6 +4760,7 @@ static void calculate_tdlut_setting(
46924760 dml2_printf("DML::%s: tdlut_delivery_cycles = %u\n", __func__, tdlut_delivery_cycles);
46934761 dml2_printf("DML::%s: tdlut_opt_time = %f\n", __func__, *p->tdlut_opt_time);
46944762 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);
46954764 dml2_printf("DML::%s: tdlut_groups_per_2row_ub = %d\n", __func__, *p->tdlut_groups_per_2row_ub);
46964765#endif
46974766}
@@ -5700,6 +5769,7 @@ static bool CalculatePrefetchSchedule(struct dml2_core_internal_scratch *scratch
57005769
57015770 s->cursor_prefetch_bytes = (unsigned int)math_max2(p->cursor_bytes_per_chunk, 4 * p->cursor_bytes_per_line);
57025771 *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);
57035773
57045774#ifdef __DML_VBA_DEBUG__
57055775 dml2_printf("DML::%s: TimeForFetchingVM = %f\n", __func__, s->TimeForFetchingVM);
@@ -5710,6 +5780,7 @@ static bool CalculatePrefetchSchedule(struct dml2_core_internal_scratch *scratch
57105780 dml2_printf("DML::%s: dst_y_per_row_vblank = %f\n", __func__, *p->dst_y_per_row_vblank);
57115781 dml2_printf("DML::%s: LinesToRequestPrefetchPixelData = %f\n", __func__, s->LinesToRequestPrefetchPixelData);
57125782 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);
57135784
57145785 dml2_printf("DML::%s: cursor_bytes_per_chunk = %d\n", __func__, p->cursor_bytes_per_chunk);
57155786 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
88178888 calculate_tdlut_setting_params->tdlut_groups_per_2row_ub = &s->tdlut_groups_per_2row_ub[k];
88188889 calculate_tdlut_setting_params->tdlut_opt_time = &s->tdlut_opt_time[k];
88198890 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];
88208892 calculate_tdlut_setting_params->tdlut_bytes_per_group = &s->tdlut_bytes_per_group[k];
88218893
88228894 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
90099081 CalculatePrefetchSchedule_params->prefetch_sw_bytes = &s->prefetch_sw_bytes[k];
90109082 CalculatePrefetchSchedule_params->Tpre_rounded = &s->Tpre_rounded[k];
90119083 CalculatePrefetchSchedule_params->Tpre_oto = &s->Tpre_oto[k];
9084+ CalculatePrefetchSchedule_params->prefetch_swath_time_us = &s->prefetch_swath_time_us[k];
90129085
90139086 mode_lib->ms.NoTimeForPrefetch[k] = CalculatePrefetchSchedule(&mode_lib->scratch, CalculatePrefetchSchedule_params);
90149087
@@ -9017,6 +9090,27 @@ static bool dml_core_mode_support(struct dml2_core_calcs_mode_support_ex *in_out
90179090 dml2_printf("DML::%s: k=%d, dst_y_per_row_vblank = %f\n", __func__, k, *CalculatePrefetchSchedule_params->dst_y_per_row_vblank);
90189091 } // for k num_planes
90199092
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+
90209114 for (k = 0; k < mode_lib->ms.num_active_planes; k++) {
90219115 if (mode_lib->ms.dst_y_prefetch[k] < 2.0
90229116 || mode_lib->ms.LinesForVM[k] >= 32.0
@@ -10368,12 +10462,6 @@ static bool dml_core_mode_programming(struct dml2_core_calcs_mode_programming_ex
1036810462 dml2_assert(s->SOCCLK > 0);
1036910463
1037010464#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-
1037710465 dml2_printf("DML::%s: num_active_planes = %u\n", __func__, s->num_active_planes);
1037810466 dml2_printf("DML::%s: num_active_pipes = %u\n", __func__, mode_lib->mp.num_active_pipes);
1037910467 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
1083210920 calculate_tdlut_setting_params->tdlut_groups_per_2row_ub = &s->tdlut_groups_per_2row_ub[k];
1083310921 calculate_tdlut_setting_params->tdlut_opt_time = &s->tdlut_opt_time[k];
1083410922 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];
1083510924 calculate_tdlut_setting_params->tdlut_bytes_per_group = &s->tdlut_bytes_per_group[k];
10836-
1083710925 calculate_tdlut_setting(&mode_lib->scratch, calculate_tdlut_setting_params);
1083810926 }
1083910927
@@ -11219,6 +11307,7 @@ static bool dml_core_mode_programming(struct dml2_core_calcs_mode_programming_ex
1121911307 CalculatePrefetchSchedule_params->prefetch_sw_bytes = &s->prefetch_sw_bytes[k];
1122011308 CalculatePrefetchSchedule_params->Tpre_rounded = &s->Tpre_rounded[k];
1122111309 CalculatePrefetchSchedule_params->Tpre_oto = &s->Tpre_oto[k];
11310+ CalculatePrefetchSchedule_params->prefetch_swath_time_us = &s->dummy_single[0];
1122211311
1122311312 mode_lib->mp.NoTimeToPrefetch[k] = CalculatePrefetchSchedule(&mode_lib->scratch, CalculatePrefetchSchedule_params);
1122411313
0 commit comments