drm/exynos: make sure that hardware overlay for fimd is disabled
authorInki Dae <inki.dae@samsung.com>
Mon, 20 Aug 2012 10:58:05 +0000 (19:58 +0900)
committerInki Dae <inki.dae@samsung.com>
Thu, 4 Oct 2012 01:05:59 +0000 (10:05 +0900)
Changelog v2:
wait for VSYNC instead of BACKPORCH.

Changelog v1:
the values set to registers will be updated into real registers
at vsync so dma operation could be malfunctioned when accessed
to memory after gem buffer was released. this patch makes sure
that hw overlay is disabled before the gem buffer is released.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
drivers/gpu/drm/exynos/exynos_drm_fimd.c

index 28733cd5274526bc8773dfa114a49f522d173c67..1da741fc74607f449fcd0be94cf12123fa0f64b9 100644 (file)
@@ -570,10 +570,22 @@ static void fimd_win_disable(struct device *dev, int zpos)
        win_data->enabled = false;
 }
 
+static void fimd_wait_for_vblank(struct device *dev)
+{
+       struct fimd_context *ctx = get_fimd_context(dev);
+       int ret;
+
+       ret = wait_for((__raw_readl(ctx->regs + VIDCON1) &
+                                       VIDCON1_VSTATUS_VSYNC), 50);
+       if (ret < 0)
+               DRM_DEBUG_KMS("vblank wait timed out.\n");
+}
+
 static struct exynos_drm_overlay_ops fimd_overlay_ops = {
        .mode_set = fimd_win_mode_set,
        .commit = fimd_win_commit,
        .disable = fimd_win_disable,
+       .wait_for_vblank = fimd_wait_for_vblank,
 };
 
 static struct exynos_drm_manager fimd_manager = {