diff mbox

[3/8] drm/exynos: enable vblank in fimd wait for vblank

Message ID 1356521265-22749-4-git-send-email-prathyush.k@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Prathyush K Dec. 26, 2012, 11:27 a.m. UTC
This patch checks if vblank is enabled inside wait for vblank. If not
enabled, vblank is temporarily enabled before waiting and then disabled
afterwards. This ensures that the wait never times out.

Signed-off-by: Prathyush K <prathyush.k@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 4d1d9c1..f88eaa4 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -335,10 +335,19 @@  static void fimd_disable_vblank(struct device *dev)
 static void fimd_wait_for_vblank(struct device *dev)
 {
 	struct fimd_context *ctx = get_fimd_context(dev);
+	u32 val;
+	bool vblank_enabled = true;
 
 	if (ctx->suspended)
 		return;
 
+	val = readl(ctx->regs + VIDINTCON0);
+
+	if (!(val & VIDINTCON0_INT_FRAME)) {
+		vblank_enabled = false;
+		fimd_enable_vblank(dev);
+	}
+
 	atomic_set(&ctx->wait_vsync_event, 1);
 
 	/*
@@ -349,6 +358,9 @@  static void fimd_wait_for_vblank(struct device *dev)
 				!atomic_read(&ctx->wait_vsync_event),
 				DRM_HZ/20))
 		DRM_DEBUG_KMS("vblank wait timed out.\n");
+
+	if (!vblank_enabled)
+		fimd_disable_vblank(dev);
 }
 
 static struct exynos_drm_manager_ops fimd_manager_ops = {