drm/exynos/decon5433: wait for two vblanks before framebuffer removal
authorAndrzej Hajda <a.hajda@samsung.com>
Tue, 2 Aug 2016 17:10:37 +0000 (19:10 +0200)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 4 Aug 2016 04:34:17 +0000 (13:34 +0900)
After window disable DECON can access its DMA buffer in current and next
scanout. To avoid possible page fault driver should ensure that two scanouts
passed before freeing framebuffer.

Change-Id: I5508f6686ff51d555eb1497b7a6d21b990fd6003
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
drivers/gpu/drm/exynos/exynos5433_drm_decon.c

index e22bc0f..0d6c368 100644 (file)
@@ -94,7 +94,7 @@ static void decon_wait_for_vblank(struct exynos_drm_crtc *crtc)
        if (ctx->suspended)
                return;
 
-       atomic_set(&ctx->wait_vsync_event, 1);
+       atomic_set(&ctx->wait_vsync_event, 2);
 
        /*
         * wait for FIMD to signal VSYNC interrupt or return after
@@ -658,7 +658,7 @@ static void decon_clear_channel(struct decon_context *ctx)
 
        decon_update(ctx);
 
-       atomic_set(&ctx->wait_vsync_event, 1);
+       atomic_set(&ctx->wait_vsync_event, 2);
 
        /*
         * wait for FIMD to signal VSYNC interrupt or return after
@@ -753,7 +753,7 @@ static irqreturn_t decon_irq_handler(int irq, void *dev_id)
 
 out:
        if (atomic_read(&ctx->wait_vsync_event)) {
-               atomic_set(&ctx->wait_vsync_event, 0);
+               atomic_dec_if_positive(&ctx->wait_vsync_event);
                wake_up(&ctx->wait_vsync_queue);
        }