aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorGustavo Padovan <gustavo.padovan@collabora.co.uk>2015-04-03 08:05:52 -0400
committerInki Dae <inki.dae@samsung.com>2015-04-12 22:39:39 -0400
commit6e2a3b66e78b693065ee67af91175a1a7e4dc209 (patch)
tree1d76d7b08ad8d60c908a0136e8af3ba2c74df76e /drivers/gpu
parent7ee14cdcbc4f813b9c5875d6e8e3daef71c366b3 (diff)
drm/exynos: preset zpos value for overlay planes
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>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/exynos/exynos7_drm_decon.c20
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.h7
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimd.c19
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_plane.c16
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_plane.h3
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_vidi.c17
-rw-r--r--drivers/gpu/drm/exynos/exynos_mixer.c11
7 files changed, 37 insertions, 56 deletions
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index c5dfd99653d8..84a3638c69a6 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -378,7 +378,7 @@ static void decon_win_set_colkey(struct decon_context *ctx, unsigned int win)
378 * @protect: 1 to protect (disable updates) 378 * @protect: 1 to protect (disable updates)
379 */ 379 */
380static void decon_shadow_protect_win(struct decon_context *ctx, 380static void decon_shadow_protect_win(struct decon_context *ctx,
381 int win, bool protect) 381 unsigned int win, bool protect)
382{ 382{
383 u32 bits, val; 383 u32 bits, val;
384 384
@@ -392,12 +392,12 @@ static void decon_shadow_protect_win(struct decon_context *ctx,
392 writel(val, ctx->regs + SHADOWCON); 392 writel(val, ctx->regs + SHADOWCON);
393} 393}
394 394
395static void decon_win_commit(struct exynos_drm_crtc *crtc, int zpos) 395static void decon_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
396{ 396{
397 struct decon_context *ctx = crtc->ctx; 397 struct decon_context *ctx = crtc->ctx;
398 struct drm_display_mode *mode = &crtc->base.mode; 398 struct drm_display_mode *mode = &crtc->base.mode;
399 struct exynos_drm_plane *plane; 399 struct exynos_drm_plane *plane;
400 int padding, win = zpos; 400 int padding;
401 unsigned long val, alpha; 401 unsigned long val, alpha;
402 unsigned int last_x; 402 unsigned int last_x;
403 unsigned int last_y; 403 unsigned int last_y;
@@ -405,9 +405,6 @@ static void decon_win_commit(struct exynos_drm_crtc *crtc, int zpos)
405 if (ctx->suspended) 405 if (ctx->suspended)
406 return; 406 return;
407 407
408 if (win == DEFAULT_ZPOS)
409 win = ctx->default_win;
410
411 if (win < 0 || win >= WINDOWS_NR) 408 if (win < 0 || win >= WINDOWS_NR)
412 return; 409 return;
413 410
@@ -513,16 +510,12 @@ static void decon_win_commit(struct exynos_drm_crtc *crtc, int zpos)
513 plane->enabled = true; 510 plane->enabled = true;
514} 511}
515 512
516static void decon_win_disable(struct exynos_drm_crtc *crtc, int zpos) 513static void decon_win_disable(struct exynos_drm_crtc *crtc, unsigned int win)
517{ 514{
518 struct decon_context *ctx = crtc->ctx; 515 struct decon_context *ctx = crtc->ctx;
519 struct exynos_drm_plane *plane; 516 struct exynos_drm_plane *plane;
520 int win = zpos;
521 u32 val; 517 u32 val;
522 518
523 if (win == DEFAULT_ZPOS)
524 win = ctx->default_win;
525
526 if (win < 0 || win >= WINDOWS_NR) 519 if (win < 0 || win >= WINDOWS_NR)
527 return; 520 return;
528 521
@@ -764,7 +757,8 @@ static int decon_bind(struct device *dev, struct device *master, void *data)
764 struct drm_device *drm_dev = data; 757 struct drm_device *drm_dev = data;
765 struct exynos_drm_plane *exynos_plane; 758 struct exynos_drm_plane *exynos_plane;
766 enum drm_plane_type type; 759 enum drm_plane_type type;
767 int zpos, ret; 760 unsigned int zpos;
761 int ret;
768 762
769 ret = decon_ctx_initialize(ctx, drm_dev); 763 ret = decon_ctx_initialize(ctx, drm_dev);
770 if (ret) { 764 if (ret) {
@@ -776,7 +770,7 @@ static int decon_bind(struct device *dev, struct device *master, void *data)
776 type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY : 770 type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY :
777 DRM_PLANE_TYPE_OVERLAY; 771 DRM_PLANE_TYPE_OVERLAY;
778 ret = exynos_plane_init(drm_dev, &ctx->planes[zpos], 772 ret = exynos_plane_init(drm_dev, &ctx->planes[zpos],
779 1 << ctx->pipe, type); 773 1 << ctx->pipe, type, zpos);
780 if (ret) 774 if (ret)
781 return ret; 775 return ret;
782 } 776 }
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 8a2f9430969d..26d6de1955dc 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -21,7 +21,6 @@
21#define MAX_CRTC 3 21#define MAX_CRTC 3
22#define MAX_PLANE 5 22#define MAX_PLANE 5
23#define MAX_FB_BUFFER 4 23#define MAX_FB_BUFFER 4
24#define DEFAULT_ZPOS -1
25 24
26#define to_exynos_crtc(x) container_of(x, struct exynos_drm_crtc, base) 25#define to_exynos_crtc(x) container_of(x, struct exynos_drm_crtc, base)
27#define to_exynos_plane(x) container_of(x, struct exynos_drm_plane, base) 26#define to_exynos_plane(x) container_of(x, struct exynos_drm_plane, base)
@@ -104,7 +103,7 @@ struct exynos_drm_plane {
104 unsigned int pitch; 103 unsigned int pitch;
105 uint32_t pixel_format; 104 uint32_t pixel_format;
106 dma_addr_t dma_addr[MAX_FB_BUFFER]; 105 dma_addr_t dma_addr[MAX_FB_BUFFER];
107 int zpos; 106 unsigned int zpos;
108 unsigned int index_color; 107 unsigned int index_color;
109 108
110 bool default_win:1; 109 bool default_win:1;
@@ -189,8 +188,8 @@ struct exynos_drm_crtc_ops {
189 int (*enable_vblank)(struct exynos_drm_crtc *crtc); 188 int (*enable_vblank)(struct exynos_drm_crtc *crtc);
190 void (*disable_vblank)(struct exynos_drm_crtc *crtc); 189 void (*disable_vblank)(struct exynos_drm_crtc *crtc);
191 void (*wait_for_vblank)(struct exynos_drm_crtc *crtc); 190 void (*wait_for_vblank)(struct exynos_drm_crtc *crtc);
192 void (*win_commit)(struct exynos_drm_crtc *crtc, int zpos); 191 void (*win_commit)(struct exynos_drm_crtc *crtc, unsigned int zpos);
193 void (*win_disable)(struct exynos_drm_crtc *crtc, int zpos); 192 void (*win_disable)(struct exynos_drm_crtc *crtc, unsigned int zpos);
194 void (*te_handler)(struct exynos_drm_crtc *crtc); 193 void (*te_handler)(struct exynos_drm_crtc *crtc);
195}; 194};
196 195
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index ab97162dd76c..7964b278eefb 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -597,7 +597,7 @@ static void fimd_win_set_colkey(struct fimd_context *ctx, unsigned int win)
597 * @protect: 1 to protect (disable updates) 597 * @protect: 1 to protect (disable updates)
598 */ 598 */
599static void fimd_shadow_protect_win(struct fimd_context *ctx, 599static void fimd_shadow_protect_win(struct fimd_context *ctx,
600 int win, bool protect) 600 unsigned int win, bool protect)
601{ 601{
602 u32 reg, bits, val; 602 u32 reg, bits, val;
603 603
@@ -617,11 +617,10 @@ static void fimd_shadow_protect_win(struct fimd_context *ctx,
617 writel(val, ctx->regs + reg); 617 writel(val, ctx->regs + reg);
618} 618}
619 619
620static void fimd_win_commit(struct exynos_drm_crtc *crtc, int zpos) 620static void fimd_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
621{ 621{
622 struct fimd_context *ctx = crtc->ctx; 622 struct fimd_context *ctx = crtc->ctx;
623 struct exynos_drm_plane *plane; 623 struct exynos_drm_plane *plane;
624 int win = zpos;
625 dma_addr_t dma_addr; 624 dma_addr_t dma_addr;
626 unsigned long val, size, offset; 625 unsigned long val, size, offset;
627 unsigned int last_x, last_y, buf_offsize, line_size; 626 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)
629 if (ctx->suspended) 628 if (ctx->suspended)
630 return; 629 return;
631 630
632 if (win == DEFAULT_ZPOS)
633 win = ctx->default_win;
634
635 if (win < 0 || win >= WINDOWS_NR) 631 if (win < 0 || win >= WINDOWS_NR)
636 return; 632 return;
637 633
@@ -737,14 +733,10 @@ static void fimd_win_commit(struct exynos_drm_crtc *crtc, int zpos)
737 atomic_set(&ctx->win_updated, 1); 733 atomic_set(&ctx->win_updated, 1);
738} 734}
739 735
740static void fimd_win_disable(struct exynos_drm_crtc *crtc, int zpos) 736static void fimd_win_disable(struct exynos_drm_crtc *crtc, unsigned int win)
741{ 737{
742 struct fimd_context *ctx = crtc->ctx; 738 struct fimd_context *ctx = crtc->ctx;
743 struct exynos_drm_plane *plane; 739 struct exynos_drm_plane *plane;
744 int win = zpos;
745
746 if (win == DEFAULT_ZPOS)
747 win = ctx->default_win;
748 740
749 if (win < 0 || win >= WINDOWS_NR) 741 if (win < 0 || win >= WINDOWS_NR)
750 return; 742 return;
@@ -1007,7 +999,8 @@ static int fimd_bind(struct device *dev, struct device *master, void *data)
1007 struct exynos_drm_private *priv = drm_dev->dev_private; 999 struct exynos_drm_private *priv = drm_dev->dev_private;
1008 struct exynos_drm_plane *exynos_plane; 1000 struct exynos_drm_plane *exynos_plane;
1009 enum drm_plane_type type; 1001 enum drm_plane_type type;
1010 int zpos, ret; 1002 unsigned int zpos;
1003 int ret;
1011 1004
1012 ctx->drm_dev = drm_dev; 1005 ctx->drm_dev = drm_dev;
1013 ctx->pipe = priv->pipe++; 1006 ctx->pipe = priv->pipe++;
@@ -1016,7 +1009,7 @@ static int fimd_bind(struct device *dev, struct device *master, void *data)
1016 type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY : 1009 type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY :
1017 DRM_PLANE_TYPE_OVERLAY; 1010 DRM_PLANE_TYPE_OVERLAY;
1018 ret = exynos_plane_init(drm_dev, &ctx->planes[zpos], 1011 ret = exynos_plane_init(drm_dev, &ctx->planes[zpos],
1019 1 << ctx->pipe, type); 1012 1 << ctx->pipe, type, zpos);
1020 if (ret) 1013 if (ret)
1021 return ret; 1014 return ret;
1022 } 1015 }
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 4014c746a534..cee980e86fcd 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -207,7 +207,8 @@ static struct drm_plane_funcs exynos_plane_funcs = {
207 .set_property = exynos_plane_set_property, 207 .set_property = exynos_plane_set_property,
208}; 208};
209 209
210static void exynos_plane_attach_zpos_property(struct drm_plane *plane) 210static void exynos_plane_attach_zpos_property(struct drm_plane *plane,
211 unsigned int zpos)
211{ 212{
212 struct drm_device *dev = plane->dev; 213 struct drm_device *dev = plane->dev;
213 struct exynos_drm_private *dev_priv = dev->dev_private; 214 struct exynos_drm_private *dev_priv = dev->dev_private;
@@ -223,12 +224,13 @@ static void exynos_plane_attach_zpos_property(struct drm_plane *plane)
223 dev_priv->plane_zpos_property = prop; 224 dev_priv->plane_zpos_property = prop;
224 } 225 }
225 226
226 drm_object_attach_property(&plane->base, prop, 0); 227 drm_object_attach_property(&plane->base, prop, zpos);
227} 228}
228 229
229int exynos_plane_init(struct drm_device *dev, 230int exynos_plane_init(struct drm_device *dev,
230 struct exynos_drm_plane *exynos_plane, 231 struct exynos_drm_plane *exynos_plane,
231 unsigned long possible_crtcs, enum drm_plane_type type) 232 unsigned long possible_crtcs, enum drm_plane_type type,
233 unsigned int zpos)
232{ 234{
233 int err; 235 int err;
234 236
@@ -240,10 +242,10 @@ int exynos_plane_init(struct drm_device *dev,
240 return err; 242 return err;
241 } 243 }
242 244
243 if (type == DRM_PLANE_TYPE_PRIMARY) 245 exynos_plane->zpos = zpos;
244 exynos_plane->zpos = DEFAULT_ZPOS; 246
245 else 247 if (type == DRM_PLANE_TYPE_OVERLAY)
246 exynos_plane_attach_zpos_property(&exynos_plane->base); 248 exynos_plane_attach_zpos_property(&exynos_plane->base, zpos);
247 249
248 return 0; 250 return 0;
249} 251}
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.h b/drivers/gpu/drm/exynos/exynos_drm_plane.h
index d8a349491c68..f360590d1412 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.h
@@ -22,4 +22,5 @@ int exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
22 uint32_t src_w, uint32_t src_h); 22 uint32_t src_w, uint32_t src_h);
23int exynos_plane_init(struct drm_device *dev, 23int exynos_plane_init(struct drm_device *dev,
24 struct exynos_drm_plane *exynos_plane, 24 struct exynos_drm_plane *exynos_plane,
25 unsigned long possible_crtcs, enum drm_plane_type type); 25 unsigned long possible_crtcs, enum drm_plane_type type,
26 unsigned int zpos);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
index da5ee15f6136..27e84ec21694 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
@@ -117,18 +117,14 @@ static void vidi_disable_vblank(struct exynos_drm_crtc *crtc)
117 ctx->vblank_on = false; 117 ctx->vblank_on = false;
118} 118}
119 119
120static void vidi_win_commit(struct exynos_drm_crtc *crtc, int zpos) 120static void vidi_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
121{ 121{
122 struct vidi_context *ctx = crtc->ctx; 122 struct vidi_context *ctx = crtc->ctx;
123 struct exynos_drm_plane *plane; 123 struct exynos_drm_plane *plane;
124 int win = zpos;
125 124
126 if (ctx->suspended) 125 if (ctx->suspended)
127 return; 126 return;
128 127
129 if (win == DEFAULT_ZPOS)
130 win = ctx->default_win;
131
132 if (win < 0 || win >= WINDOWS_NR) 128 if (win < 0 || win >= WINDOWS_NR)
133 return; 129 return;
134 130
@@ -142,14 +138,10 @@ static void vidi_win_commit(struct exynos_drm_crtc *crtc, int zpos)
142 schedule_work(&ctx->work); 138 schedule_work(&ctx->work);
143} 139}
144 140
145static void vidi_win_disable(struct exynos_drm_crtc *crtc, int zpos) 141static void vidi_win_disable(struct exynos_drm_crtc *crtc, unsigned int win)
146{ 142{
147 struct vidi_context *ctx = crtc->ctx; 143 struct vidi_context *ctx = crtc->ctx;
148 struct exynos_drm_plane *plane; 144 struct exynos_drm_plane *plane;
149 int win = zpos;
150
151 if (win == DEFAULT_ZPOS)
152 win = ctx->default_win;
153 145
154 if (win < 0 || win >= WINDOWS_NR) 146 if (win < 0 || win >= WINDOWS_NR)
155 return; 147 return;
@@ -472,7 +464,8 @@ static int vidi_bind(struct device *dev, struct device *master, void *data)
472 struct drm_device *drm_dev = data; 464 struct drm_device *drm_dev = data;
473 struct exynos_drm_plane *exynos_plane; 465 struct exynos_drm_plane *exynos_plane;
474 enum drm_plane_type type; 466 enum drm_plane_type type;
475 int zpos, ret; 467 unsigned int zpos;
468 int ret;
476 469
477 vidi_ctx_initialize(ctx, drm_dev); 470 vidi_ctx_initialize(ctx, drm_dev);
478 471
@@ -480,7 +473,7 @@ static int vidi_bind(struct device *dev, struct device *master, void *data)
480 type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY : 473 type = (zpos == ctx->default_win) ? DRM_PLANE_TYPE_PRIMARY :
481 DRM_PLANE_TYPE_OVERLAY; 474 DRM_PLANE_TYPE_OVERLAY;
482 ret = exynos_plane_init(drm_dev, &ctx->planes[zpos], 475 ret = exynos_plane_init(drm_dev, &ctx->planes[zpos],
483 1 << ctx->pipe, type); 476 1 << ctx->pipe, type, zpos);
484 if (ret) 477 if (ret)
485 return ret; 478 return ret;
486 } 479 }
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index d181cb1ce71a..f79d70a3855d 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -898,10 +898,9 @@ static void mixer_disable_vblank(struct exynos_drm_crtc *crtc)
898 mixer_reg_writemask(res, MXR_INT_EN, 0, MXR_INT_EN_VSYNC); 898 mixer_reg_writemask(res, MXR_INT_EN, 0, MXR_INT_EN_VSYNC);
899} 899}
900 900
901static void mixer_win_commit(struct exynos_drm_crtc *crtc, int zpos) 901static void mixer_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
902{ 902{
903 struct mixer_context *mixer_ctx = crtc->ctx; 903 struct mixer_context *mixer_ctx = crtc->ctx;
904 int win = zpos == DEFAULT_ZPOS ? MIXER_DEFAULT_WIN : zpos;
905 904
906 DRM_DEBUG_KMS("win: %d\n", win); 905 DRM_DEBUG_KMS("win: %d\n", win);
907 906
@@ -920,11 +919,10 @@ static void mixer_win_commit(struct exynos_drm_crtc *crtc, int zpos)
920 mixer_ctx->planes[win].enabled = true; 919 mixer_ctx->planes[win].enabled = true;
921} 920}
922 921
923static void mixer_win_disable(struct exynos_drm_crtc *crtc, int zpos) 922static void mixer_win_disable(struct exynos_drm_crtc *crtc, unsigned int win)
924{ 923{
925 struct mixer_context *mixer_ctx = crtc->ctx; 924 struct mixer_context *mixer_ctx = crtc->ctx;
926 struct mixer_resources *res = &mixer_ctx->mixer_res; 925 struct mixer_resources *res = &mixer_ctx->mixer_res;
927 int win = zpos == DEFAULT_ZPOS ? MIXER_DEFAULT_WIN : zpos;
928 unsigned long flags; 926 unsigned long flags;
929 927
930 DRM_DEBUG_KMS("win: %d\n", win); 928 DRM_DEBUG_KMS("win: %d\n", win);
@@ -1179,7 +1177,8 @@ static int mixer_bind(struct device *dev, struct device *manager, void *data)
1179 struct drm_device *drm_dev = data; 1177 struct drm_device *drm_dev = data;
1180 struct exynos_drm_plane *exynos_plane; 1178 struct exynos_drm_plane *exynos_plane;
1181 enum drm_plane_type type; 1179 enum drm_plane_type type;
1182 int zpos, ret; 1180 unsigned int zpos;
1181 int ret;
1183 1182
1184 ret = mixer_initialize(ctx, drm_dev); 1183 ret = mixer_initialize(ctx, drm_dev);
1185 if (ret) 1184 if (ret)
@@ -1189,7 +1188,7 @@ static int mixer_bind(struct device *dev, struct device *manager, void *data)
1189 type = (zpos == MIXER_DEFAULT_WIN) ? DRM_PLANE_TYPE_PRIMARY : 1188 type = (zpos == MIXER_DEFAULT_WIN) ? DRM_PLANE_TYPE_PRIMARY :
1190 DRM_PLANE_TYPE_OVERLAY; 1189 DRM_PLANE_TYPE_OVERLAY;
1191 ret = exynos_plane_init(drm_dev, &ctx->planes[zpos], 1190 ret = exynos_plane_init(drm_dev, &ctx->planes[zpos],
1192 1 << ctx->pipe, type); 1191 1 << ctx->pipe, type, zpos);
1193 if (ret) 1192 if (ret)
1194 return ret; 1193 return ret;
1195 } 1194 }