summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMidas Chien <midaschieh@google.com>2022-04-13 14:28:46 +0800
committerMidas Chien <midaschieh@google.com>2022-04-13 14:54:38 +0800
commitb741254fee48121a6dacb7ee6b737eec7154a33d (patch)
tree757a129d2f71f49fc29a9d154da2f0e1712b4868
parent4a0b780c854ae3363a678f91e5877b5f9928e9ab (diff)
downloaddisplay-android-gs-raviole-5.10-s-qpr3-beta-3.tar.gz
This reverts commit 84b348ec35ddfc2f8c8499abc6403f97ac41312c. Change causes underrun when resume at 60hz Bug: 228421805 Signed-off-by: Midas Chien <midaschieh@google.com> Change-Id: Ibc9d7ad7722c768d3df1aadde5edbf206c5fc869
-rw-r--r--samsung/cal_common/decon_cal.h1
-rw-r--r--samsung/exynos_drm_bts.c2
-rw-r--r--samsung/exynos_drm_decon.c66
-rw-r--r--samsung/exynos_drm_decon.h8
-rw-r--r--samsung/exynos_drm_fb.c2
5 files changed, 30 insertions, 49 deletions
diff --git a/samsung/cal_common/decon_cal.h b/samsung/cal_common/decon_cal.h
index bea2b4d..b2f6f96 100644
--- a/samsung/cal_common/decon_cal.h
+++ b/samsung/cal_common/decon_cal.h
@@ -218,6 +218,7 @@ struct decon_config {
struct exynos_dsc dsc;
unsigned int out_bpc;
unsigned int in_bpc;
+ unsigned int vblank_usec;
int main_dsim_id;
};
diff --git a/samsung/exynos_drm_bts.c b/samsung/exynos_drm_bts.c
index d452034..5b5d4a2 100644
--- a/samsung/exynos_drm_bts.c
+++ b/samsung/exynos_drm_bts.c
@@ -182,7 +182,7 @@ static u32 dpu_bts_get_vblank_time_ns(struct decon_device *decon)
if (decon->config.mode.op_mode == DECON_VIDEO_MODE)
v_blank_t_ns = (decon->bts.vbp + decon->bts.vfp) * line_t_ns;
else
- v_blank_t_ns = decon->bts.vblank_usec * 1000U;
+ v_blank_t_ns = decon->config.vblank_usec * 1000U;
DPU_DEBUG_BTS(" -line_t_ns(%u) v_blank_t_ns(%u)\n",
line_t_ns, v_blank_t_ns);
diff --git a/samsung/exynos_drm_decon.c b/samsung/exynos_drm_decon.c
index 6bf460d..e6c1438 100644
--- a/samsung/exynos_drm_decon.c
+++ b/samsung/exynos_drm_decon.c
@@ -73,9 +73,7 @@ static const struct of_device_id decon_driver_dt_match[] = {
};
MODULE_DEVICE_TABLE(of, decon_driver_dt_match);
-static void decon_mode_update_bts(struct decon_device *decon,
- const struct drm_display_mode *mode,
- const unsigned int vblank_usec);
+static void decon_mode_update_bts(struct decon_device *decon, const struct drm_display_mode *mode);
static void decon_seamless_mode_set(struct exynos_drm_crtc *exynos_crtc,
struct drm_crtc_state *old_crtc_state);
static int decon_request_te_irq(struct exynos_drm_crtc *exynos_crtc,
@@ -351,6 +349,7 @@ static void decon_update_config(struct decon_config *config,
decon_update_dsi_config(config, crtc_state, exynos_conn_state);
config->out_bpc = exynos_conn_state->exynos_mode.bpc;
+ config->vblank_usec = exynos_conn_state->exynos_mode.vblank_usec;
}
static bool decon_is_seamless_possible(const struct decon_device *decon,
@@ -809,9 +808,7 @@ static void _decon_enable(struct decon_device *decon)
decon_enable_irqs(decon);
}
-static void decon_mode_update_bts(struct decon_device *decon,
- const struct drm_display_mode *mode,
- const unsigned int vblank_usec)
+static void decon_mode_update_bts(struct decon_device *decon, const struct drm_display_mode *mode)
{
struct videomode vm;
@@ -821,7 +818,6 @@ static void decon_mode_update_bts(struct decon_device *decon,
decon->bts.vfp = vm.vfront_porch;
decon->bts.vsa = vm.vsync_len;
decon->bts.fps = drm_mode_vrefresh(mode);
- decon->bts.vblank_usec = vblank_usec;
decon->config.image_width = mode->hdisplay;
decon->config.image_height = mode->vdisplay;
@@ -830,10 +826,22 @@ static void decon_mode_update_bts(struct decon_device *decon,
mode->hdisplay, mode->vdisplay, decon->bts.fps);
}
+static void decon_mode_set(struct exynos_drm_crtc *crtc,
+ const struct drm_display_mode *mode,
+ const struct drm_display_mode *adjusted_mode)
+{
+ struct decon_device *decon = crtc->ctx;
+ int i;
+
+ for (i = 0; i < MAX_WIN_PER_DECON; i++)
+ decon->bts.win_config[i].state = DPU_WIN_STATE_DISABLED;
+
+ decon_mode_update_bts(decon, adjusted_mode);
+}
+
#if IS_ENABLED(CONFIG_EXYNOS_BTS)
static void decon_seamless_mode_bts_update(struct decon_device *decon,
- const struct drm_display_mode *mode,
- const unsigned int vblank_usec)
+ const struct drm_display_mode *mode)
{
DPU_ATRACE_BEGIN(__func__);
@@ -848,46 +856,23 @@ static void decon_seamless_mode_bts_update(struct decon_device *decon,
* 2 once the issue is clarified.
*/
if (decon->bts.fps > drm_mode_vrefresh(mode)) {
- decon->bts.pending_vblank_usec = vblank_usec;
atomic_set(&decon->bts.delayed_update, 3);
} else {
- decon_mode_update_bts(decon, mode, vblank_usec);
+ decon_mode_update_bts(decon, mode);
atomic_set(&decon->bts.delayed_update, 0);
}
DPU_ATRACE_END(__func__);
}
-#define DEFAULT_VBLANK_USEC 100
-
-static unsigned int decon_get_vblank_usec(const struct drm_crtc_state *crtc_state,
- const struct drm_atomic_state *old_state)
-{
- const struct exynos_drm_connector_state *exynos_conn_state =
- crtc_get_exynos_connector_state(old_state, crtc_state);
-
- if (WARN_ON(!exynos_conn_state))
- return DEFAULT_VBLANK_USEC;
-
- return exynos_conn_state->exynos_mode.vblank_usec;
-}
-
void decon_mode_bts_pre_update(struct decon_device *decon,
- const struct drm_crtc_state *crtc_state,
- const struct drm_atomic_state *old_state)
+ const struct drm_crtc_state *crtc_state)
{
const struct exynos_drm_crtc_state *exynos_crtc_state = to_exynos_crtc_state(crtc_state);
- if (exynos_crtc_state->seamless_mode_changed) {
- unsigned int vblank_usec = decon_get_vblank_usec(crtc_state, old_state);
-
- decon_seamless_mode_bts_update(decon, &crtc_state->adjusted_mode, vblank_usec);
- } else if (drm_atomic_crtc_needs_modeset(crtc_state)) {
- unsigned int vblank_usec = decon_get_vblank_usec(crtc_state, old_state);
-
- decon_mode_update_bts(decon, &crtc_state->mode, vblank_usec);
- } else if (!atomic_dec_if_positive(&decon->bts.delayed_update)) {
- decon_mode_update_bts(decon, &crtc_state->mode, decon->bts.pending_vblank_usec);
- }
+ if (exynos_crtc_state->seamless_mode_changed)
+ decon_seamless_mode_bts_update(decon, &crtc_state->adjusted_mode);
+ else if (!atomic_dec_if_positive(&decon->bts.delayed_update))
+ decon_mode_update_bts(decon, &crtc_state->mode);
decon->bts.ops->calc_bw(decon);
decon->bts.ops->update_bw(decon, false);
@@ -943,10 +928,8 @@ static void _decon_stop(struct decon_device *decon, bool reset)
* Make sure all window connections are disabled when getting disabled,
* in case there are any stale mappings.
*/
- for (i = 0; i < MAX_WIN_PER_DECON; ++i) {
- decon->bts.win_config[i].state = DPU_WIN_STATE_DISABLED;
+ for (i = 0; i < MAX_WIN_PER_DECON; ++i)
decon_reg_set_win_enable(decon->id, i, 0);
- }
for (i = 0; i < decon->dpp_cnt; ++i) {
struct dpp_device *dpp = decon->dpp[i];
@@ -1208,6 +1191,7 @@ static const struct exynos_drm_crtc_ops decon_crtc_ops = {
.disable = decon_disable,
.enable_vblank = decon_enable_vblank,
.disable_vblank = decon_disable_vblank,
+ .mode_set = decon_mode_set,
.atomic_check = decon_atomic_check,
.atomic_begin = decon_atomic_begin,
.update_plane = decon_update_plane,
diff --git a/samsung/exynos_drm_decon.h b/samsung/exynos_drm_decon.h
index 83e9bdf..43ce834 100644
--- a/samsung/exynos_drm_decon.h
+++ b/samsung/exynos_drm_decon.h
@@ -149,8 +149,6 @@ struct dpu_bts {
u32 vfp;
u32 vsa;
u32 fps;
- u32 pending_vblank_usec;
- u32 vblank_usec;
/* includes writeback dpp */
struct dpu_bts_bw rt_bw[MAX_DPP_CNT];
@@ -482,12 +480,10 @@ void decon_force_vblank_event(struct decon_device *decon);
#if IS_ENABLED(CONFIG_EXYNOS_BTS)
void decon_mode_bts_pre_update(struct decon_device *decon,
- const struct drm_crtc_state *crtc_state,
- const struct drm_atomic_state *state);
+ const struct drm_crtc_state *crtc_state);
#else
void decon_mode_bts_pre_update(struct decon_device *decon,
- const struct drm_crtc_state *crtc_state,
- const struct drm_atomic_state *state) { }
+ const struct drm_crtc_state *crtc_state) { }
#endif
#if IS_ENABLED(CONFIG_EXYNOS_ITMON)
diff --git a/samsung/exynos_drm_fb.c b/samsung/exynos_drm_fb.c
index 0f07e34..89c1e6e 100644
--- a/samsung/exynos_drm_fb.c
+++ b/samsung/exynos_drm_fb.c
@@ -401,7 +401,7 @@ static void exynos_atomic_bts_pre_update(struct drm_device *dev,
}
DPU_EVENT_LOG_ATOMIC_COMMIT(decon->id);
- decon_mode_bts_pre_update(decon, new_crtc_state, old_state);
+ decon_mode_bts_pre_update(decon, new_crtc_state);
}
}