drm/exynos: pass struct exynos_drm_plane in update/enable
authorGustavo Padovan <gustavo.padovan@collabora.co.uk>
Mon, 3 Aug 2015 05:39:36 +0000 (14:39 +0900)
committerInki Dae <inki.dae@samsung.com>
Sun, 16 Aug 2015 01:23:34 +0000 (10:23 +0900)
We already have the plane pointer in before calling .update_plane() or
disable_plane() so pass it directly to those calls avoiding a new
conversion from zpos to struct exynos_drm_plane.

v2: don't remove check for suspended in FIMD (comment by Joonyoung)

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
drivers/gpu/drm/exynos/exynos5433_drm_decon.c
drivers/gpu/drm/exynos/exynos7_drm_decon.c
drivers/gpu/drm/exynos/exynos_drm_drv.h
drivers/gpu/drm/exynos/exynos_drm_fimd.c
drivers/gpu/drm/exynos/exynos_drm_plane.c
drivers/gpu/drm/exynos/exynos_drm_vidi.c
drivers/gpu/drm/exynos/exynos_mixer.c

index 83fbf387f4d8c26148de9ba98c18126b249ec47e..a4ea09665b83f72551117231ccd2445b3b4da4f6 100644 (file)
@@ -219,17 +219,13 @@ static void decon_shadow_protect_win(struct decon_context *ctx, int win,
        writel(val, ctx->addr + DECON_SHADOWCON);
 }
 
-static void decon_update_plane(struct exynos_drm_crtc *crtc, unsigned int win)
+static void decon_update_plane(struct exynos_drm_crtc *crtc,
+                              struct exynos_drm_plane *plane)
 {
        struct decon_context *ctx = crtc->ctx;
-       struct exynos_drm_plane *plane;
+       unsigned int win = plane->zpos;
        u32 val;
 
-       if (win < 0 || win >= WINDOWS_NR)
-               return;
-
-       plane = &ctx->planes[win];
-
        if (ctx->suspended)
                return;
 
@@ -277,17 +273,13 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, unsigned int win)
                atomic_set(&ctx->win_updated, 1);
 }
 
-static void decon_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win)
+static void decon_disable_plane(struct exynos_drm_crtc *crtc,
+                               struct exynos_drm_plane *plane)
 {
        struct decon_context *ctx = crtc->ctx;
-       struct exynos_drm_plane *plane;
+       unsigned int win = plane->zpos;
        u32 val;
 
-       if (win < 0 || win >= WINDOWS_NR)
-               return;
-
-       plane = &ctx->planes[win];
-
        if (ctx->suspended)
                return;
 
@@ -378,7 +370,7 @@ static void decon_disable(struct exynos_drm_crtc *crtc)
         * a destroyed buffer later.
         */
        for (i = 0; i < WINDOWS_NR; i++)
-               decon_disable_plane(crtc, i);
+               decon_disable_plane(crtc, &ctx->planes[i]);
 
        decon_swreset(ctx);
 
index 31210bef3eceb63a5aca4139cf458f92114560be..0bb393867da45ca315eb43181f151b18829c7ed9 100644 (file)
@@ -383,24 +383,20 @@ static void decon_shadow_protect_win(struct decon_context *ctx,
        writel(val, ctx->regs + SHADOWCON);
 }
 
-static void decon_update_plane(struct exynos_drm_crtc *crtc, unsigned int win)
+static void decon_update_plane(struct exynos_drm_crtc *crtc,
+                              struct exynos_drm_plane *plane)
 {
        struct decon_context *ctx = crtc->ctx;
        struct drm_display_mode *mode = &crtc->base.state->adjusted_mode;
-       struct exynos_drm_plane *plane;
        int padding;
        unsigned long val, alpha;
        unsigned int last_x;
        unsigned int last_y;
+       unsigned int win = plane->zpos;
 
        if (ctx->suspended)
                return;
 
-       if (win < 0 || win >= WINDOWS_NR)
-               return;
-
-       plane = &ctx->planes[win];
-
        /*
         * SHADOWCON/PRTCON register is used for enabling timing.
         *
@@ -493,17 +489,13 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, unsigned int win)
        writel(val, ctx->regs + DECON_UPDATE);
 }
 
-static void decon_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win)
+static void decon_disable_plane(struct exynos_drm_crtc *crtc,
+                               struct exynos_drm_plane *plane)
 {
        struct decon_context *ctx = crtc->ctx;
-       struct exynos_drm_plane *plane;
+       unsigned int win = plane->zpos;
        u32 val;
 
-       if (win < 0 || win >= WINDOWS_NR)
-               return;
-
-       plane = &ctx->planes[win];
-
        if (ctx->suspended)
                return;
 
@@ -599,7 +591,7 @@ static void decon_disable(struct exynos_drm_crtc *crtc)
         * a destroyed buffer later.
         */
        for (i = 0; i < WINDOWS_NR; i++)
-               decon_disable_plane(crtc, i);
+               decon_disable_plane(crtc, &ctx->planes[i]);
 
        clk_disable_unprepare(ctx->vclk);
        clk_disable_unprepare(ctx->eclk);
index ac7eb317cc88c5797f181c3ee0532111e55a46d1..18d04d0e7364932d6ed8a4d16775a41331717a11 100644 (file)
@@ -173,8 +173,10 @@ struct exynos_drm_crtc_ops {
        int (*enable_vblank)(struct exynos_drm_crtc *crtc);
        void (*disable_vblank)(struct exynos_drm_crtc *crtc);
        void (*wait_for_vblank)(struct exynos_drm_crtc *crtc);
-       void (*update_plane)(struct exynos_drm_crtc *crtc, unsigned int zpos);
-       void (*disable_plane)(struct exynos_drm_crtc *crtc, unsigned int zpos);
+       void (*update_plane)(struct exynos_drm_crtc *crtc,
+                            struct exynos_drm_plane *plane);
+       void (*disable_plane)(struct exynos_drm_crtc *crtc,
+                             struct exynos_drm_plane *plane);
        void (*te_handler)(struct exynos_drm_crtc *crtc);
        void (*clock_enable)(struct exynos_drm_crtc *crtc, bool enable);
 };
index 81bc34253510830eaa0d9f43123ed82832221902..2527997c4f24e804fb48aed46b4fc23c2a02261e 100644 (file)
@@ -607,22 +607,18 @@ static void fimd_shadow_protect_win(struct fimd_context *ctx,
        writel(val, ctx->regs + reg);
 }
 
-static void fimd_update_plane(struct exynos_drm_crtc *crtc, unsigned int win)
+static void fimd_update_plane(struct exynos_drm_crtc *crtc,
+                             struct exynos_drm_plane *plane)
 {
        struct fimd_context *ctx = crtc->ctx;
-       struct exynos_drm_plane *plane;
        dma_addr_t dma_addr;
        unsigned long val, size, offset;
        unsigned int last_x, last_y, buf_offsize, line_size;
+       unsigned int win = plane->zpos;
 
        if (ctx->suspended)
                return;
 
-       if (win < 0 || win >= WINDOWS_NR)
-               return;
-
-       plane = &ctx->planes[win];
-
        /*
         * SHADOWCON/PRTCON register is used for enabling timing.
         *
@@ -715,15 +711,11 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, unsigned int win)
                atomic_set(&ctx->win_updated, 1);
 }
 
-static void fimd_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win)
+static void fimd_disable_plane(struct exynos_drm_crtc *crtc,
+                              struct exynos_drm_plane *plane)
 {
        struct fimd_context *ctx = crtc->ctx;
-       struct exynos_drm_plane *plane;
-
-       if (win < 0 || win >= WINDOWS_NR)
-               return;
-
-       plane = &ctx->planes[win];
+       unsigned int win = plane->zpos;
 
        if (ctx->suspended)
                return;
@@ -785,7 +777,7 @@ static void fimd_disable(struct exynos_drm_crtc *crtc)
         * a destroyed buffer later.
         */
        for (i = 0; i < WINDOWS_NR; i++)
-               fimd_disable_plane(crtc, i);
+               fimd_disable_plane(crtc, &ctx->planes[i]);
 
        fimd_enable_vblank(crtc);
        fimd_wait_for_vblank(crtc);
index eb9eec944326a314bda55f3e2cc314f777fb9089..b5aa5b75d82b0949da083703283b8290b36551c3 100644 (file)
@@ -180,7 +180,7 @@ static void exynos_plane_atomic_update(struct drm_plane *plane,
                              state->src_w >> 16, state->src_h >> 16);
 
        if (exynos_crtc->ops->update_plane)
-               exynos_crtc->ops->update_plane(exynos_crtc, exynos_plane->zpos);
+               exynos_crtc->ops->update_plane(exynos_crtc, exynos_plane);
 }
 
 static void exynos_plane_atomic_disable(struct drm_plane *plane,
@@ -194,7 +194,7 @@ static void exynos_plane_atomic_disable(struct drm_plane *plane,
 
        if (exynos_crtc->ops->disable_plane)
                exynos_crtc->ops->disable_plane(exynos_crtc,
-                                               exynos_plane->zpos);
+                                               exynos_plane);
 }
 
 static const struct drm_plane_helper_funcs plane_helper_funcs = {
index 59d85ef04650577d96963acaa944a4cf596fec89..ade59eeb855402b978703f43f04dc80a6c5da5cb 100644 (file)
@@ -118,19 +118,14 @@ static void vidi_disable_vblank(struct exynos_drm_crtc *crtc)
                ctx->vblank_on = false;
 }
 
-static void vidi_update_plane(struct exynos_drm_crtc *crtc, unsigned int win)
+static void vidi_update_plane(struct exynos_drm_crtc *crtc,
+                             struct exynos_drm_plane *plane)
 {
        struct vidi_context *ctx = crtc->ctx;
-       struct exynos_drm_plane *plane;
 
        if (ctx->suspended)
                return;
 
-       if (win < 0 || win >= WINDOWS_NR)
-               return;
-
-       plane = &ctx->planes[win];
-
        DRM_DEBUG_KMS("dma_addr = %pad\n", plane->dma_addr);
 
        if (ctx->vblank_on)
index 72bdded845f48ce9702f341cc397d21b06020c0f..9275d3af385ff503c9fa6b87f753034fa351c8aa 100644 (file)
@@ -927,28 +927,30 @@ static void mixer_disable_vblank(struct exynos_drm_crtc *crtc)
        mixer_reg_writemask(res, MXR_INT_EN, 0, MXR_INT_EN_VSYNC);
 }
 
-static void mixer_update_plane(struct exynos_drm_crtc *crtc, unsigned int win)
+static void mixer_update_plane(struct exynos_drm_crtc *crtc,
+                              struct exynos_drm_plane *plane)
 {
        struct mixer_context *mixer_ctx = crtc->ctx;
 
-       DRM_DEBUG_KMS("win: %d\n", win);
+       DRM_DEBUG_KMS("win: %d\n", plane->zpos);
 
        if (!test_bit(MXR_BIT_POWERED, &mixer_ctx->flags))
                return;
 
-       if (win > 1 && mixer_ctx->vp_enabled)
-               vp_video_buffer(mixer_ctx, win);
+       if (plane->zpos > 1 && mixer_ctx->vp_enabled)
+               vp_video_buffer(mixer_ctx, plane->zpos);
        else
-               mixer_graph_buffer(mixer_ctx, win);
+               mixer_graph_buffer(mixer_ctx, plane->zpos);
 }
 
-static void mixer_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win)
+static void mixer_disable_plane(struct exynos_drm_crtc *crtc,
+                               struct exynos_drm_plane *plane)
 {
        struct mixer_context *mixer_ctx = crtc->ctx;
        struct mixer_resources *res = &mixer_ctx->mixer_res;
        unsigned long flags;
 
-       DRM_DEBUG_KMS("win: %d\n", win);
+       DRM_DEBUG_KMS("win: %d\n", plane->zpos);
 
        if (!test_bit(MXR_BIT_POWERED, &mixer_ctx->flags))
                return;
@@ -956,7 +958,7 @@ static void mixer_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win)
        spin_lock_irqsave(&res->reg_slock, flags);
        mixer_vsync_set_update(mixer_ctx, false);
 
-       mixer_cfg_layer(mixer_ctx, win, false);
+       mixer_cfg_layer(mixer_ctx, plane->zpos, false);
 
        mixer_vsync_set_update(mixer_ctx, true);
        spin_unlock_irqrestore(&res->reg_slock, flags);
@@ -1053,7 +1055,7 @@ static void mixer_disable(struct exynos_drm_crtc *crtc)
        mixer_regs_dump(ctx);
 
        for (i = 0; i < MIXER_WIN_NR; i++)
-               mixer_disable_plane(crtc, i);
+               mixer_disable_plane(crtc, &ctx->planes[i]);
 
        clear_bit(MXR_BIT_POWERED, &ctx->flags);