|
@@ -749,6 +749,108 @@ static u64 _sde_core_perf_get_core_clk_rate(struct sde_kms *kms)
|
|
return clk_rate;
|
|
return clk_rate;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void _sde_core_perf_crtc_update_check(struct drm_crtc *crtc,
|
|
|
|
+ int params_changed,
|
|
|
|
+ int *update_bus, int *update_clk, int *update_llcc)
|
|
|
|
+{
|
|
|
|
+ struct sde_kms *kms = _sde_crtc_get_kms(crtc);
|
|
|
|
+ struct sde_crtc *sde_crtc = to_sde_crtc(crtc);
|
|
|
|
+ struct sde_core_perf_params *old = &sde_crtc->cur_perf;
|
|
|
|
+ struct sde_core_perf_params *new = &sde_crtc->new_perf;
|
|
|
|
+ int i;
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * cases for the llcc update.
|
|
|
|
+ * 1. llcc is transitioning: 'inactive->active' during kickoff,
|
|
|
|
+ * for current request.
|
|
|
|
+ * 2. llcc is transitioning: 'active->inactive'at the end of the
|
|
|
|
+ * commit or during stop
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ if ((params_changed &&
|
|
|
|
+ new->llcc_active && !old->llcc_active) ||
|
|
|
|
+ (!params_changed &&
|
|
|
|
+ !new->llcc_active && old->llcc_active)) {
|
|
|
|
+
|
|
|
|
+ SDE_DEBUG("crtc=%d p=%d new_llcc=%d, old_llcc=%d\n",
|
|
|
|
+ crtc->base.id, params_changed,
|
|
|
|
+ new->llcc_active, old->llcc_active);
|
|
|
|
+
|
|
|
|
+ old->llcc_active = new->llcc_active;
|
|
|
|
+ *update_llcc = 1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (i = 0; i < SDE_POWER_HANDLE_DBUS_ID_MAX; i++) {
|
|
|
|
+ /*
|
|
|
|
+ * cases for bus bandwidth update.
|
|
|
|
+ * 1. new bandwidth vote - "ab or ib vote" is higher
|
|
|
|
+ * than current vote for update request.
|
|
|
|
+ * 2. new bandwidth vote - "ab or ib vote" is lower
|
|
|
|
+ * than current vote at end of commit or stop.
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ if ((params_changed &&
|
|
|
|
+ (new->bw_ctl[i] > old->bw_ctl[i])) ||
|
|
|
|
+ (!params_changed &&
|
|
|
|
+ (new->bw_ctl[i] < old->bw_ctl[i]))) {
|
|
|
|
+
|
|
|
|
+ SDE_DEBUG(
|
|
|
|
+ "crtc=%d p=%d new_bw=%llu,old_bw=%llu\n",
|
|
|
|
+ crtc->base.id, params_changed,
|
|
|
|
+ new->bw_ctl[i], old->bw_ctl[i]);
|
|
|
|
+ old->bw_ctl[i] = new->bw_ctl[i];
|
|
|
|
+ *update_bus |= BIT(i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ((params_changed &&
|
|
|
|
+ (new->max_per_pipe_ib[i] >
|
|
|
|
+ old->max_per_pipe_ib[i])) ||
|
|
|
|
+ (!params_changed &&
|
|
|
|
+ (new->max_per_pipe_ib[i] <
|
|
|
|
+ old->max_per_pipe_ib[i]))) {
|
|
|
|
+
|
|
|
|
+ SDE_DEBUG(
|
|
|
|
+ "crtc=%d p=%d new_ib=%llu,old_ib=%llu\n",
|
|
|
|
+ crtc->base.id, params_changed,
|
|
|
|
+ new->max_per_pipe_ib[i],
|
|
|
|
+ old->max_per_pipe_ib[i]);
|
|
|
|
+ old->max_per_pipe_ib[i] =
|
|
|
|
+ new->max_per_pipe_ib[i];
|
|
|
|
+ *update_bus |= BIT(i);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* display rsc override during solver mode */
|
|
|
|
+ if (kms->perf.bw_vote_mode == DISP_RSC_MODE &&
|
|
|
|
+ get_sde_rsc_current_state(SDE_RSC_INDEX) !=
|
|
|
|
+ SDE_RSC_CLK_STATE) {
|
|
|
|
+ /* update new bandwidth in all cases */
|
|
|
|
+ if (params_changed && ((new->bw_ctl[i] !=
|
|
|
|
+ old->bw_ctl[i]) ||
|
|
|
|
+ (new->max_per_pipe_ib[i] !=
|
|
|
|
+ old->max_per_pipe_ib[i]))) {
|
|
|
|
+ old->bw_ctl[i] = new->bw_ctl[i];
|
|
|
|
+ old->max_per_pipe_ib[i] =
|
|
|
|
+ new->max_per_pipe_ib[i];
|
|
|
|
+ *update_bus |= BIT(i);
|
|
|
|
+ /*
|
|
|
|
+ * reduce bw vote is not required in solver
|
|
|
|
+ * mode
|
|
|
|
+ */
|
|
|
|
+ } else if (!params_changed) {
|
|
|
|
+ *update_bus &= ~BIT(i);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ((params_changed &&
|
|
|
|
+ (new->core_clk_rate > old->core_clk_rate)) ||
|
|
|
|
+ (!params_changed && new->core_clk_rate &&
|
|
|
|
+ (new->core_clk_rate < old->core_clk_rate))) {
|
|
|
|
+ old->core_clk_rate = new->core_clk_rate;
|
|
|
|
+ *update_clk = 1;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
void sde_core_perf_crtc_update(struct drm_crtc *crtc,
|
|
void sde_core_perf_crtc_update(struct drm_crtc *crtc,
|
|
int params_changed, bool stop_req)
|
|
int params_changed, bool stop_req)
|
|
{
|
|
{
|
|
@@ -793,97 +895,8 @@ void sde_core_perf_crtc_update(struct drm_crtc *crtc,
|
|
new = &sde_crtc->new_perf;
|
|
new = &sde_crtc->new_perf;
|
|
|
|
|
|
if (_sde_core_perf_crtc_is_power_on(crtc) && !stop_req) {
|
|
if (_sde_core_perf_crtc_is_power_on(crtc) && !stop_req) {
|
|
-
|
|
|
|
- /*
|
|
|
|
- * cases for the llcc update.
|
|
|
|
- * 1. llcc is transitioning: 'inactive->active' during kickoff,
|
|
|
|
- * for current request.
|
|
|
|
- * 2. llcc is transitioning: 'active->inactive'at the end of the
|
|
|
|
- * commit or during stop
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- if ((params_changed &&
|
|
|
|
- new->llcc_active && !old->llcc_active) ||
|
|
|
|
- (!params_changed &&
|
|
|
|
- !new->llcc_active && old->llcc_active)) {
|
|
|
|
-
|
|
|
|
- SDE_DEBUG("crtc=%d p=%d new_llcc=%d, old_llcc=%d\n",
|
|
|
|
- crtc->base.id, params_changed,
|
|
|
|
- new->llcc_active, old->llcc_active);
|
|
|
|
-
|
|
|
|
- old->llcc_active = new->llcc_active;
|
|
|
|
- update_llcc = 1;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- for (i = 0; i < SDE_POWER_HANDLE_DBUS_ID_MAX; i++) {
|
|
|
|
- /*
|
|
|
|
- * cases for bus bandwidth update.
|
|
|
|
- * 1. new bandwidth vote - "ab or ib vote" is higher
|
|
|
|
- * than current vote for update request.
|
|
|
|
- * 2. new bandwidth vote - "ab or ib vote" is lower
|
|
|
|
- * than current vote at end of commit or stop.
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- if ((params_changed &&
|
|
|
|
- (new->bw_ctl[i] > old->bw_ctl[i])) ||
|
|
|
|
- (!params_changed &&
|
|
|
|
- (new->bw_ctl[i] < old->bw_ctl[i]))) {
|
|
|
|
-
|
|
|
|
- SDE_DEBUG(
|
|
|
|
- "crtc=%d p=%d new_bw=%llu,old_bw=%llu\n",
|
|
|
|
- crtc->base.id, params_changed,
|
|
|
|
- new->bw_ctl[i], old->bw_ctl[i]);
|
|
|
|
- old->bw_ctl[i] = new->bw_ctl[i];
|
|
|
|
- update_bus |= BIT(i);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if ((params_changed &&
|
|
|
|
- (new->max_per_pipe_ib[i] >
|
|
|
|
- old->max_per_pipe_ib[i])) ||
|
|
|
|
- (!params_changed &&
|
|
|
|
- (new->max_per_pipe_ib[i] <
|
|
|
|
- old->max_per_pipe_ib[i]))) {
|
|
|
|
-
|
|
|
|
- SDE_DEBUG(
|
|
|
|
- "crtc=%d p=%d new_ib=%llu,old_ib=%llu\n",
|
|
|
|
- crtc->base.id, params_changed,
|
|
|
|
- new->max_per_pipe_ib[i],
|
|
|
|
- old->max_per_pipe_ib[i]);
|
|
|
|
- old->max_per_pipe_ib[i] =
|
|
|
|
- new->max_per_pipe_ib[i];
|
|
|
|
- update_bus |= BIT(i);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /* display rsc override during solver mode */
|
|
|
|
- if (kms->perf.bw_vote_mode == DISP_RSC_MODE &&
|
|
|
|
- get_sde_rsc_current_state(SDE_RSC_INDEX) !=
|
|
|
|
- SDE_RSC_CLK_STATE) {
|
|
|
|
- /* update new bandwidth in all cases */
|
|
|
|
- if (params_changed && ((new->bw_ctl[i] !=
|
|
|
|
- old->bw_ctl[i]) ||
|
|
|
|
- (new->max_per_pipe_ib[i] !=
|
|
|
|
- old->max_per_pipe_ib[i]))) {
|
|
|
|
- old->bw_ctl[i] = new->bw_ctl[i];
|
|
|
|
- old->max_per_pipe_ib[i] =
|
|
|
|
- new->max_per_pipe_ib[i];
|
|
|
|
- update_bus |= BIT(i);
|
|
|
|
- /*
|
|
|
|
- * reduce bw vote is not required in solver
|
|
|
|
- * mode
|
|
|
|
- */
|
|
|
|
- } else if (!params_changed) {
|
|
|
|
- update_bus &= ~BIT(i);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if ((params_changed &&
|
|
|
|
- (new->core_clk_rate > old->core_clk_rate)) ||
|
|
|
|
- (!params_changed && new->core_clk_rate &&
|
|
|
|
- (new->core_clk_rate < old->core_clk_rate))) {
|
|
|
|
- old->core_clk_rate = new->core_clk_rate;
|
|
|
|
- update_clk = 1;
|
|
|
|
- }
|
|
|
|
|
|
+ _sde_core_perf_crtc_update_check(crtc, params_changed,
|
|
|
|
+ &update_bus, &update_clk, &update_llcc);
|
|
} else {
|
|
} else {
|
|
SDE_DEBUG("crtc=%d disable\n", crtc->base.id);
|
|
SDE_DEBUG("crtc=%d disable\n", crtc->base.id);
|
|
memset(old, 0, sizeof(*old));
|
|
memset(old, 0, sizeof(*old));
|