]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/exynos: preset zpos value for overlay planes
authorGustavo Padovan <gustavo.padovan@collabora.co.uk>
Fri, 3 Apr 2015 12:05:52 +0000 (21:05 +0900)
committerInki Dae <inki.dae@samsung.com>
Mon, 13 Apr 2015 02:39:39 +0000 (11:39 +0900)
Usually userspace don't want to have two overlay planes on the same zpos
so this change assign a different zpos for each plane. Before this change
a zpos of value zero was created for all planes so the userspace had to
set up the zpos of every plane it wanted to use.

Also all places that were storing zpos positions are now unsigned int.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
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_plane.h
drivers/gpu/drm/exynos/exynos_drm_vidi.c
drivers/gpu/drm/exynos/exynos_mixer.c

index c5dfd99653d8104b424889a54814bd895db06fb2..84a3638c69a63783a518235ec63381dd20bae2a0 100644 (file)
@@ -378,7 +378,7 @@ static void decon_win_set_colkey(struct decon_context *ctx, unsigned int win)
  * @protect: 1 to protect (disable updates)
  */
 static void decon_shadow_protect_win(struct decon_context *ctx,
-                                                       int win, bool protect)
+                                    unsigned int win, bool protect)
 {
        u32 bits, val;
 
@@ -392,12 +392,12 @@ static void decon_shadow_protect_win(struct decon_context *ctx,
        writel(val, ctx->regs + SHADOWCON);
 }
 
-static void decon_win_commit(struct exynos_drm_crtc *crtc, int zpos)
+static void decon_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
 {
        struct decon_context *ctx = crtc->ctx;
        struct drm_display_mode *mode = &crtc->base.mode;
        struct exynos_drm_plane *plane;
-       int padding, win = zpos;
+       int padding;
        unsigned long val, alpha;
        unsigned int last_x;
        unsigned int last_y;
@@ -405,9 +405,6 @@ static void decon_win_commit(struct exynos_drm_crtc *crtc, int zpos)
        if (ctx->suspended)
                return;
 
-       if (win == DEFAULT_ZPOS)
-               win = ctx->default_win;
-
        if (win < 0 || win >= WINDOWS_NR)
                return;
 
@@ -513,16 +510,12 @@ static void decon_win_commit(struct exynos_drm_crtc *crtc, int zpos)
        plane->enabled = true;
 }
 
-static void decon_win_disable(struct exynos_drm_crtc *crtc, int zpos)
+static void decon_win_disable(struct exynos_drm_crtc *crtc, unsigned int win)
 {
        struct decon_context *ctx = crtc->ctx;
        struct exynos_drm_plane *plane;
-       int win = zpos;
        u32 val;
 
-       if (win == DEFAULT_ZPOS)
-               win = ctx->default_win;
-
        if (win < 0 || win >= WINDOWS_NR)
                return;
 
@@ -764,7 +757,8 @@ static int decon_bind(struct device *dev, struct device *master, void *data)
        struct drm_device *drm_dev = data;
        struct exynos_drm_plane *exynos_plane;
        enum drm_plane_type type;
-       int zpos, ret;
+       unsigned int zpos;
+       int ret;
 
        ret = decon_ctx_initialize(ctx, drm_dev);
        if (ret) {
@@ -776,7 +770,7 @@ static int decon_bind(struct device *dev, struct device *master, void *data)
                type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY :
                                                DRM_PLANE_TYPE_OVERLAY;
                ret = exynos_plane_init(drm_dev, &ctx->planes[zpos],
-                                       1 << ctx->pipe, type);
+                                       1 << ctx->pipe, type, zpos);
                if (ret)
                        return ret;
        }
index 8a2f9430969d56343076552d0cab2082161aa922..26d6de1955dce6bc56ecb1bb6386cf81c45b2eae 100644 (file)
@@ -21,7 +21,6 @@
 #define MAX_CRTC       3
 #define MAX_PLANE      5
 #define MAX_FB_BUFFER  4
-#define DEFAULT_ZPOS   -1
 
 #define to_exynos_crtc(x)      container_of(x, struct exynos_drm_crtc, base)
 #define to_exynos_plane(x)     container_of(x, struct exynos_drm_plane, base)
@@ -104,7 +103,7 @@ struct exynos_drm_plane {
        unsigned int pitch;
        uint32_t pixel_format;
        dma_addr_t dma_addr[MAX_FB_BUFFER];
-       int zpos;
+       unsigned int zpos;
        unsigned int index_color;
 
        bool default_win:1;
@@ -189,8 +188,8 @@ 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 (*win_commit)(struct exynos_drm_crtc *crtc, int zpos);
-       void (*win_disable)(struct exynos_drm_crtc *crtc, int zpos);
+       void (*win_commit)(struct exynos_drm_crtc *crtc, unsigned int zpos);
+       void (*win_disable)(struct exynos_drm_crtc *crtc, unsigned int zpos);
        void (*te_handler)(struct exynos_drm_crtc *crtc);
 };
 
index ab97162dd76c4abdecc16a08ee5791467c0866a7..7964b278eefb7dd42c08c439d8c04d5b5703cd72 100644 (file)
@@ -597,7 +597,7 @@ static void fimd_win_set_colkey(struct fimd_context *ctx, unsigned int win)
  * @protect: 1 to protect (disable updates)
  */
 static void fimd_shadow_protect_win(struct fimd_context *ctx,
-                                                       int win, bool protect)
+                                   unsigned int win, bool protect)
 {
        u32 reg, bits, val;
 
@@ -617,11 +617,10 @@ static void fimd_shadow_protect_win(struct fimd_context *ctx,
        writel(val, ctx->regs + reg);
 }
 
-static void fimd_win_commit(struct exynos_drm_crtc *crtc, int zpos)
+static void fimd_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
 {
        struct fimd_context *ctx = crtc->ctx;
        struct exynos_drm_plane *plane;
-       int win = zpos;
        dma_addr_t dma_addr;
        unsigned long val, size, offset;
        unsigned int last_x, last_y, buf_offsize, line_size;
@@ -629,9 +628,6 @@ static void fimd_win_commit(struct exynos_drm_crtc *crtc, int zpos)
        if (ctx->suspended)
                return;
 
-       if (win == DEFAULT_ZPOS)
-               win = ctx->default_win;
-
        if (win < 0 || win >= WINDOWS_NR)
                return;
 
@@ -737,14 +733,10 @@ static void fimd_win_commit(struct exynos_drm_crtc *crtc, int zpos)
                atomic_set(&ctx->win_updated, 1);
 }
 
-static void fimd_win_disable(struct exynos_drm_crtc *crtc, int zpos)
+static void fimd_win_disable(struct exynos_drm_crtc *crtc, unsigned int win)
 {
        struct fimd_context *ctx = crtc->ctx;
        struct exynos_drm_plane *plane;
-       int win = zpos;
-
-       if (win == DEFAULT_ZPOS)
-               win = ctx->default_win;
 
        if (win < 0 || win >= WINDOWS_NR)
                return;
@@ -1007,7 +999,8 @@ static int fimd_bind(struct device *dev, struct device *master, void *data)
        struct exynos_drm_private *priv = drm_dev->dev_private;
        struct exynos_drm_plane *exynos_plane;
        enum drm_plane_type type;
-       int zpos, ret;
+       unsigned int zpos;
+       int ret;
 
        ctx->drm_dev = drm_dev;
        ctx->pipe = priv->pipe++;
@@ -1016,7 +1009,7 @@ static int fimd_bind(struct device *dev, struct device *master, void *data)
                type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY :
                                                DRM_PLANE_TYPE_OVERLAY;
                ret = exynos_plane_init(drm_dev, &ctx->planes[zpos],
-                                       1 << ctx->pipe, type);
+                                       1 << ctx->pipe, type, zpos);
                if (ret)
                        return ret;
        }
index 4014c746a534fbd1333f743db12efc3336b5363f..cee980e86fcda0e1b5f27f8bd2a5154c409fa09c 100644 (file)
@@ -207,7 +207,8 @@ static struct drm_plane_funcs exynos_plane_funcs = {
        .set_property   = exynos_plane_set_property,
 };
 
-static void exynos_plane_attach_zpos_property(struct drm_plane *plane)
+static void exynos_plane_attach_zpos_property(struct drm_plane *plane,
+                                             unsigned int zpos)
 {
        struct drm_device *dev = plane->dev;
        struct exynos_drm_private *dev_priv = dev->dev_private;
@@ -223,12 +224,13 @@ static void exynos_plane_attach_zpos_property(struct drm_plane *plane)
                dev_priv->plane_zpos_property = prop;
        }
 
-       drm_object_attach_property(&plane->base, prop, 0);
+       drm_object_attach_property(&plane->base, prop, zpos);
 }
 
 int exynos_plane_init(struct drm_device *dev,
                      struct exynos_drm_plane *exynos_plane,
-                     unsigned long possible_crtcs, enum drm_plane_type type)
+                     unsigned long possible_crtcs, enum drm_plane_type type,
+                     unsigned int zpos)
 {
        int err;
 
@@ -240,10 +242,10 @@ int exynos_plane_init(struct drm_device *dev,
                return err;
        }
 
-       if (type == DRM_PLANE_TYPE_PRIMARY)
-               exynos_plane->zpos = DEFAULT_ZPOS;
-       else
-               exynos_plane_attach_zpos_property(&exynos_plane->base);
+       exynos_plane->zpos = zpos;
+
+       if (type == DRM_PLANE_TYPE_OVERLAY)
+               exynos_plane_attach_zpos_property(&exynos_plane->base, zpos);
 
        return 0;
 }
index d8a349491c68389e3560bf2c38663b9100ae214b..f360590d14128f2f48329a0da2cfb177a89d62bd 100644 (file)
@@ -22,4 +22,5 @@ int exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
                        uint32_t src_w, uint32_t src_h);
 int exynos_plane_init(struct drm_device *dev,
                      struct exynos_drm_plane *exynos_plane,
-                     unsigned long possible_crtcs, enum drm_plane_type type);
+                     unsigned long possible_crtcs, enum drm_plane_type type,
+                     unsigned int zpos);
index da5ee15f6136ae930e0e198dd3c002becd845d75..27e84ec21694d587f26a78d258c216d52bd450ea 100644 (file)
@@ -117,18 +117,14 @@ static void vidi_disable_vblank(struct exynos_drm_crtc *crtc)
                ctx->vblank_on = false;
 }
 
-static void vidi_win_commit(struct exynos_drm_crtc *crtc, int zpos)
+static void vidi_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
 {
        struct vidi_context *ctx = crtc->ctx;
        struct exynos_drm_plane *plane;
-       int win = zpos;
 
        if (ctx->suspended)
                return;
 
-       if (win == DEFAULT_ZPOS)
-               win = ctx->default_win;
-
        if (win < 0 || win >= WINDOWS_NR)
                return;
 
@@ -142,14 +138,10 @@ static void vidi_win_commit(struct exynos_drm_crtc *crtc, int zpos)
                schedule_work(&ctx->work);
 }
 
-static void vidi_win_disable(struct exynos_drm_crtc *crtc, int zpos)
+static void vidi_win_disable(struct exynos_drm_crtc *crtc, unsigned int win)
 {
        struct vidi_context *ctx = crtc->ctx;
        struct exynos_drm_plane *plane;
-       int win = zpos;
-
-       if (win == DEFAULT_ZPOS)
-               win = ctx->default_win;
 
        if (win < 0 || win >= WINDOWS_NR)
                return;
@@ -472,7 +464,8 @@ static int vidi_bind(struct device *dev, struct device *master, void *data)
        struct drm_device *drm_dev = data;
        struct exynos_drm_plane *exynos_plane;
        enum drm_plane_type type;
-       int zpos, ret;
+       unsigned int zpos;
+       int ret;
 
        vidi_ctx_initialize(ctx, drm_dev);
 
@@ -480,7 +473,7 @@ static int vidi_bind(struct device *dev, struct device *master, void *data)
                type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY :
                                                DRM_PLANE_TYPE_OVERLAY;
                ret = exynos_plane_init(drm_dev, &ctx->planes[zpos],
-                                       1 << ctx->pipe, type);
+                                       1 << ctx->pipe, type, zpos);
                if (ret)
                        return ret;
        }
index d181cb1ce71ab5d037d99064e97a094d48ec8aaa..f79d70a3855dca0a81a1bbf2bbb40b381bd854e8 100644 (file)
@@ -898,10 +898,9 @@ 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_win_commit(struct exynos_drm_crtc *crtc, int zpos)
+static void mixer_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
 {
        struct mixer_context *mixer_ctx = crtc->ctx;
-       int win = zpos == DEFAULT_ZPOS ? MIXER_DEFAULT_WIN : zpos;
 
        DRM_DEBUG_KMS("win: %d\n", win);
 
@@ -920,11 +919,10 @@ static void mixer_win_commit(struct exynos_drm_crtc *crtc, int zpos)
        mixer_ctx->planes[win].enabled = true;
 }
 
-static void mixer_win_disable(struct exynos_drm_crtc *crtc, int zpos)
+static void mixer_win_disable(struct exynos_drm_crtc *crtc, unsigned int win)
 {
        struct mixer_context *mixer_ctx = crtc->ctx;
        struct mixer_resources *res = &mixer_ctx->mixer_res;
-       int win = zpos == DEFAULT_ZPOS ? MIXER_DEFAULT_WIN : zpos;
        unsigned long flags;
 
        DRM_DEBUG_KMS("win: %d\n", win);
@@ -1179,7 +1177,8 @@ static int mixer_bind(struct device *dev, struct device *manager, void *data)
        struct drm_device *drm_dev = data;
        struct exynos_drm_plane *exynos_plane;
        enum drm_plane_type type;
-       int zpos, ret;
+       unsigned int zpos;
+       int ret;
 
        ret = mixer_initialize(ctx, drm_dev);
        if (ret)
@@ -1189,7 +1188,7 @@ static int mixer_bind(struct device *dev, struct device *manager, void *data)
                type = (zpos == MIXER_DEFAULT_WIN) ? DRM_PLANE_TYPE_PRIMARY :
                                                DRM_PLANE_TYPE_OVERLAY;
                ret = exynos_plane_init(drm_dev, &ctx->planes[zpos],
-                                       1 << ctx->pipe, type);
+                                       1 << ctx->pipe, type, zpos);
                if (ret)
                        return ret;
        }