aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo Padovan <gustavo.padovan@collabora.co.uk>2014-11-27 11:56:09 -0500
committerInki Dae <daeinki@gmail.com>2015-01-25 07:28:08 -0500
commitadf5691c333620560fb90f2c551a42da8ed14f15 (patch)
tree21746bfd43b37a9c36b621c6ec2a901ab86e9fb1
parentdc81252ff50d7ededc3dfd2c8236efb5c110a14e (diff)
drm/exynos: create exynos_check_plane()
Split update plane in two parts, an initial check part that can fail and the update part that can't fail. This is a important step for the upcoming atomic modesetting support. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Inki Dae <inki.dae@samsung.com>
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_crtc.c11
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_plane.c34
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_plane.h11
3 files changed, 36 insertions, 20 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 357fcd59aa48..a85c451ba392 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -92,6 +92,7 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
92 struct drm_framebuffer *fb = crtc->primary->fb; 92 struct drm_framebuffer *fb = crtc->primary->fb;
93 unsigned int crtc_w; 93 unsigned int crtc_w;
94 unsigned int crtc_h; 94 unsigned int crtc_h;
95 int ret;
95 96
96 /* 97 /*
97 * copy the mode data adjusted by mode_fixup() into crtc->mode 98 * copy the mode data adjusted by mode_fixup() into crtc->mode
@@ -99,10 +100,16 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
99 */ 100 */
100 memcpy(&crtc->mode, adjusted_mode, sizeof(*adjusted_mode)); 101 memcpy(&crtc->mode, adjusted_mode, sizeof(*adjusted_mode));
101 102
103 ret = exynos_check_plane(crtc->primary, fb);
104 if (ret < 0)
105 return ret;
106
102 crtc_w = fb->width - x; 107 crtc_w = fb->width - x;
103 crtc_h = fb->height - y; 108 crtc_h = fb->height - y;
104 return exynos_plane_mode_set(crtc->primary, crtc, fb, 0, 0, 109 exynos_plane_mode_set(crtc->primary, crtc, fb, 0, 0,
105 crtc_w, crtc_h, x, y, crtc_w, crtc_h); 110 crtc_w, crtc_h, x, y, crtc_w, crtc_h);
111
112 return 0;
106} 113}
107 114
108static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, 115static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 95442e69db75..358cff67e5ce 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -12,6 +12,7 @@
12#include <drm/drmP.h> 12#include <drm/drmP.h>
13 13
14#include <drm/exynos_drm.h> 14#include <drm/exynos_drm.h>
15#include <drm/drm_plane_helper.h>
15#include "exynos_drm_drv.h" 16#include "exynos_drm_drv.h"
16#include "exynos_drm_crtc.h" 17#include "exynos_drm_crtc.h"
17#include "exynos_drm_fb.h" 18#include "exynos_drm_fb.h"
@@ -61,16 +62,9 @@ static int exynos_plane_get_size(int start, unsigned length, unsigned last)
61 return size; 62 return size;
62} 63}
63 64
64int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, 65int exynos_check_plane(struct drm_plane *plane, struct drm_framebuffer *fb)
65 struct drm_framebuffer *fb, int crtc_x, int crtc_y,
66 unsigned int crtc_w, unsigned int crtc_h,
67 uint32_t src_x, uint32_t src_y,
68 uint32_t src_w, uint32_t src_h)
69{ 66{
70 struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane); 67 struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
71 struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
72 unsigned int actual_w;
73 unsigned int actual_h;
74 int nr; 68 int nr;
75 int i; 69 int i;
76 70
@@ -89,6 +83,20 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
89 i, (unsigned long)exynos_plane->dma_addr[i]); 83 i, (unsigned long)exynos_plane->dma_addr[i]);
90 } 84 }
91 85
86 return 0;
87}
88
89void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
90 struct drm_framebuffer *fb, int crtc_x, int crtc_y,
91 unsigned int crtc_w, unsigned int crtc_h,
92 uint32_t src_x, uint32_t src_y,
93 uint32_t src_w, uint32_t src_h)
94{
95 struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
96 struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
97 unsigned int actual_w;
98 unsigned int actual_h;
99
92 actual_w = exynos_plane_get_size(crtc_x, crtc_w, crtc->mode.hdisplay); 100 actual_w = exynos_plane_get_size(crtc_x, crtc_w, crtc->mode.hdisplay);
93 actual_h = exynos_plane_get_size(crtc_y, crtc_h, crtc->mode.vdisplay); 101 actual_h = exynos_plane_get_size(crtc_y, crtc_h, crtc->mode.vdisplay);
94 102
@@ -135,8 +143,6 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
135 143
136 if (exynos_crtc->ops->win_mode_set) 144 if (exynos_crtc->ops->win_mode_set)
137 exynos_crtc->ops->win_mode_set(exynos_crtc, exynos_plane); 145 exynos_crtc->ops->win_mode_set(exynos_crtc, exynos_plane);
138
139 return 0;
140} 146}
141 147
142void exynos_plane_dpms(struct drm_plane *plane, int mode) 148void exynos_plane_dpms(struct drm_plane *plane, int mode)
@@ -177,12 +183,14 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
177 struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane); 183 struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
178 int ret; 184 int ret;
179 185
180 ret = exynos_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y, 186 ret = exynos_check_plane(plane, fb);
181 crtc_w, crtc_h, src_x >> 16, src_y >> 16,
182 src_w >> 16, src_h >> 16);
183 if (ret < 0) 187 if (ret < 0)
184 return ret; 188 return ret;
185 189
190 exynos_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y,
191 crtc_w, crtc_h, src_x >> 16, src_y >> 16,
192 src_w >> 16, src_h >> 16);
193
186 if (exynos_crtc->ops->win_commit) 194 if (exynos_crtc->ops->win_commit)
187 exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos); 195 exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
188 196
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.h b/drivers/gpu/drm/exynos/exynos_drm_plane.h
index d25c079a3f44..59d40755095b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.h
@@ -9,11 +9,12 @@
9 * 9 *
10 */ 10 */
11 11
12int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, 12int exynos_check_plane(struct drm_plane *plane, struct drm_framebuffer *fb);
13 struct drm_framebuffer *fb, int crtc_x, int crtc_y, 13void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
14 unsigned int crtc_w, unsigned int crtc_h, 14 struct drm_framebuffer *fb, int crtc_x, int crtc_y,
15 uint32_t src_x, uint32_t src_y, 15 unsigned int crtc_w, unsigned int crtc_h,
16 uint32_t src_w, uint32_t src_h); 16 uint32_t src_x, uint32_t src_y,
17 uint32_t src_w, uint32_t src_h);
17int exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, 18int exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
18 struct drm_framebuffer *fb, int crtc_x, int crtc_y, 19 struct drm_framebuffer *fb, int crtc_x, int crtc_y,
19 unsigned int crtc_w, unsigned int crtc_h, 20 unsigned int crtc_w, unsigned int crtc_h,