drm/exynos/decon5433: update shadow registers iff there are active windows
authorAndrzej Hajda <a.hajda@samsung.com>
Tue, 9 Aug 2016 08:44:25 +0000 (10:44 +0200)
committerAndrzej Hajda <a.hajda@samsung.com>
Tue, 9 Aug 2016 10:02:49 +0000 (12:02 +0200)
Improper usage of DECON_UPDATE register leads to subtle errors.
If it set in decon_commit when there are no active windows it results
in slow registry updates - all subsequent shadow registry updates takes more
than full vblank. On the other side if it is not set when there are
active windows it results in garbage on the screen after suspend/resume of
FB console.

The patch hopefully fixes it.

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

index 0d6c368026d6c7f561815b4ed02f988353e574bd..e3cc259041ad2536e439cbf998218ec6b1733910 100644 (file)
@@ -176,9 +176,11 @@ static void decon_wait_for_update(struct decon_context *ctx)
 static void decon_commit(struct exynos_drm_crtc *crtc)
 {
        struct decon_context *ctx = crtc->ctx;
+       struct exynos5433_decon_driver_data *drv_data = ctx->drv_data;
        struct drm_display_mode *mode = &crtc->base.mode;
        bool interlaced = false;
        u32 val;
+       int win;
 
        if (ctx->suspended)
                return;
@@ -254,7 +256,14 @@ static void decon_commit(struct exynos_drm_crtc *crtc)
        }
        /* enable output and display signal */
        decon_set_bits(ctx, DECON_VIDCON0, VIDCON0_ENVID | VIDCON0_ENVID_F, ~0);
-       decon_update(ctx);
+
+       /* update iff there are active windows */
+       for (win = drv_data->first_win; win < WINDOWS_NR; win++) {
+               if (ctx->planes[win].enabled) {
+                       decon_update(ctx);
+                       break;
+               }
+       }
 }
 
 #define BIT_VAL(x, e, s)       (((x) & ((1 << ((e) - (s) + 1)) - 1)) << (s))