diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2016-05-11 11:16:06 -0400 |
---|---|---|
committer | Benjamin Gaignard <benjamin.gaignard@linaro.org> | 2016-07-29 04:02:58 -0400 |
commit | e47726a11e11ffaefb5b3d6103f5d2ffa366f8ef (patch) | |
tree | 886073a103a66205df50e30fc92c26c9ef7474ec | |
parent | bbd1e3a5dcf1542f83e39d5a39f68765e5428439 (diff) |
drm/exynos: use generic code for managing zpos plane property
This patch replaces zpos property handling custom code in Exynos DRM
driver with calls to generic DRM code.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Cc: Gustavo Padovan <gustavo@padovan.org>
Cc: vincent.abriou@st.com
Cc: fabien.dessenne@st.com
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_drv.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_plane.c | 67 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_mixer.c | 6 |
3 files changed, 13 insertions, 62 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index b39d521f093d..7f1a49d5bdbe 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
@@ -64,7 +64,6 @@ struct exynos_drm_plane_state { | |||
64 | struct exynos_drm_rect src; | 64 | struct exynos_drm_rect src; |
65 | unsigned int h_ratio; | 65 | unsigned int h_ratio; |
66 | unsigned int v_ratio; | 66 | unsigned int v_ratio; |
67 | unsigned int zpos; | ||
68 | }; | 67 | }; |
69 | 68 | ||
70 | static inline struct exynos_drm_plane_state * | 69 | static inline struct exynos_drm_plane_state * |
@@ -221,7 +220,6 @@ struct exynos_drm_private { | |||
221 | * this array is used to be aware of which crtc did it request vblank. | 220 | * this array is used to be aware of which crtc did it request vblank. |
222 | */ | 221 | */ |
223 | struct drm_crtc *crtc[MAX_CRTC]; | 222 | struct drm_crtc *crtc[MAX_CRTC]; |
224 | struct drm_property *plane_zpos_property; | ||
225 | 223 | ||
226 | struct device *dma_dev; | 224 | struct device *dma_dev; |
227 | void *mapping; | 225 | void *mapping; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index 77f12c00abf9..7f32419b25ea 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c | |||
@@ -139,9 +139,9 @@ static void exynos_drm_plane_reset(struct drm_plane *plane) | |||
139 | 139 | ||
140 | exynos_state = kzalloc(sizeof(*exynos_state), GFP_KERNEL); | 140 | exynos_state = kzalloc(sizeof(*exynos_state), GFP_KERNEL); |
141 | if (exynos_state) { | 141 | if (exynos_state) { |
142 | exynos_state->zpos = exynos_plane->config->zpos; | ||
143 | plane->state = &exynos_state->base; | 142 | plane->state = &exynos_state->base; |
144 | plane->state->plane = plane; | 143 | plane->state->plane = plane; |
144 | plane->state->zpos = exynos_plane->config->zpos; | ||
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
@@ -157,7 +157,6 @@ exynos_drm_plane_duplicate_state(struct drm_plane *plane) | |||
157 | return NULL; | 157 | return NULL; |
158 | 158 | ||
159 | __drm_atomic_helper_plane_duplicate_state(plane, ©->base); | 159 | __drm_atomic_helper_plane_duplicate_state(plane, ©->base); |
160 | copy->zpos = exynos_state->zpos; | ||
161 | return ©->base; | 160 | return ©->base; |
162 | } | 161 | } |
163 | 162 | ||
@@ -170,43 +169,6 @@ static void exynos_drm_plane_destroy_state(struct drm_plane *plane, | |||
170 | kfree(old_exynos_state); | 169 | kfree(old_exynos_state); |
171 | } | 170 | } |
172 | 171 | ||
173 | static int exynos_drm_plane_atomic_set_property(struct drm_plane *plane, | ||
174 | struct drm_plane_state *state, | ||
175 | struct drm_property *property, | ||
176 | uint64_t val) | ||
177 | { | ||
178 | struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane); | ||
179 | struct exynos_drm_plane_state *exynos_state = | ||
180 | to_exynos_plane_state(state); | ||
181 | struct exynos_drm_private *dev_priv = plane->dev->dev_private; | ||
182 | const struct exynos_drm_plane_config *config = exynos_plane->config; | ||
183 | |||
184 | if (property == dev_priv->plane_zpos_property && | ||
185 | (config->capabilities & EXYNOS_DRM_PLANE_CAP_ZPOS)) | ||
186 | exynos_state->zpos = val; | ||
187 | else | ||
188 | return -EINVAL; | ||
189 | |||
190 | return 0; | ||
191 | } | ||
192 | |||
193 | static int exynos_drm_plane_atomic_get_property(struct drm_plane *plane, | ||
194 | const struct drm_plane_state *state, | ||
195 | struct drm_property *property, | ||
196 | uint64_t *val) | ||
197 | { | ||
198 | const struct exynos_drm_plane_state *exynos_state = | ||
199 | container_of(state, const struct exynos_drm_plane_state, base); | ||
200 | struct exynos_drm_private *dev_priv = plane->dev->dev_private; | ||
201 | |||
202 | if (property == dev_priv->plane_zpos_property) | ||
203 | *val = exynos_state->zpos; | ||
204 | else | ||
205 | return -EINVAL; | ||
206 | |||
207 | return 0; | ||
208 | } | ||
209 | |||
210 | static struct drm_plane_funcs exynos_plane_funcs = { | 172 | static struct drm_plane_funcs exynos_plane_funcs = { |
211 | .update_plane = drm_atomic_helper_update_plane, | 173 | .update_plane = drm_atomic_helper_update_plane, |
212 | .disable_plane = drm_atomic_helper_disable_plane, | 174 | .disable_plane = drm_atomic_helper_disable_plane, |
@@ -215,8 +177,6 @@ static struct drm_plane_funcs exynos_plane_funcs = { | |||
215 | .reset = exynos_drm_plane_reset, | 177 | .reset = exynos_drm_plane_reset, |
216 | .atomic_duplicate_state = exynos_drm_plane_duplicate_state, | 178 | .atomic_duplicate_state = exynos_drm_plane_duplicate_state, |
217 | .atomic_destroy_state = exynos_drm_plane_destroy_state, | 179 | .atomic_destroy_state = exynos_drm_plane_destroy_state, |
218 | .atomic_set_property = exynos_drm_plane_atomic_set_property, | ||
219 | .atomic_get_property = exynos_drm_plane_atomic_get_property, | ||
220 | }; | 180 | }; |
221 | 181 | ||
222 | static int | 182 | static int |
@@ -304,23 +264,13 @@ static const struct drm_plane_helper_funcs plane_helper_funcs = { | |||
304 | }; | 264 | }; |
305 | 265 | ||
306 | static void exynos_plane_attach_zpos_property(struct drm_plane *plane, | 266 | static void exynos_plane_attach_zpos_property(struct drm_plane *plane, |
307 | unsigned int zpos) | 267 | bool immutable) |
308 | { | 268 | { |
309 | struct drm_device *dev = plane->dev; | 269 | /* FIXME */ |
310 | struct exynos_drm_private *dev_priv = dev->dev_private; | 270 | if (immutable) |
311 | struct drm_property *prop; | 271 | drm_plane_create_zpos_immutable_property(plane, 0); |
312 | 272 | else | |
313 | prop = dev_priv->plane_zpos_property; | 273 | drm_plane_create_zpos_property(plane, 0, 0, MAX_PLANE - 1); |
314 | if (!prop) { | ||
315 | prop = drm_property_create_range(dev, 0, "zpos", | ||
316 | 0, MAX_PLANE - 1); | ||
317 | if (!prop) | ||
318 | return; | ||
319 | |||
320 | dev_priv->plane_zpos_property = prop; | ||
321 | } | ||
322 | |||
323 | drm_object_attach_property(&plane->base, prop, zpos); | ||
324 | } | 274 | } |
325 | 275 | ||
326 | int exynos_plane_init(struct drm_device *dev, | 276 | int exynos_plane_init(struct drm_device *dev, |
@@ -346,7 +296,8 @@ int exynos_plane_init(struct drm_device *dev, | |||
346 | exynos_plane->index = index; | 296 | exynos_plane->index = index; |
347 | exynos_plane->config = config; | 297 | exynos_plane->config = config; |
348 | 298 | ||
349 | exynos_plane_attach_zpos_property(&exynos_plane->base, config->zpos); | 299 | exynos_plane_attach_zpos_property(&exynos_plane->base, |
300 | !(config->capabilities & EXYNOS_DRM_PLANE_CAP_ZPOS)); | ||
350 | 301 | ||
351 | return 0; | 302 | return 0; |
352 | } | 303 | } |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 74a4269cc1b0..e1d47f9435fc 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -477,6 +477,7 @@ static void vp_video_buffer(struct mixer_context *ctx, | |||
477 | struct drm_display_mode *mode = &state->base.crtc->state->adjusted_mode; | 477 | struct drm_display_mode *mode = &state->base.crtc->state->adjusted_mode; |
478 | struct mixer_resources *res = &ctx->mixer_res; | 478 | struct mixer_resources *res = &ctx->mixer_res; |
479 | struct drm_framebuffer *fb = state->base.fb; | 479 | struct drm_framebuffer *fb = state->base.fb; |
480 | unsigned int priority = state->base.normalized_zpos + 1; | ||
480 | unsigned long flags; | 481 | unsigned long flags; |
481 | dma_addr_t luma_addr[2], chroma_addr[2]; | 482 | dma_addr_t luma_addr[2], chroma_addr[2]; |
482 | bool tiled_mode = false; | 483 | bool tiled_mode = false; |
@@ -561,7 +562,7 @@ static void vp_video_buffer(struct mixer_context *ctx, | |||
561 | 562 | ||
562 | mixer_cfg_scan(ctx, mode->vdisplay); | 563 | mixer_cfg_scan(ctx, mode->vdisplay); |
563 | mixer_cfg_rgb_fmt(ctx, mode->vdisplay); | 564 | mixer_cfg_rgb_fmt(ctx, mode->vdisplay); |
564 | mixer_cfg_layer(ctx, plane->index, state->zpos + 1, true); | 565 | mixer_cfg_layer(ctx, plane->index, priority, true); |
565 | mixer_cfg_vp_blend(ctx); | 566 | mixer_cfg_vp_blend(ctx); |
566 | mixer_run(ctx); | 567 | mixer_run(ctx); |
567 | 568 | ||
@@ -586,6 +587,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx, | |||
586 | struct drm_display_mode *mode = &state->base.crtc->state->adjusted_mode; | 587 | struct drm_display_mode *mode = &state->base.crtc->state->adjusted_mode; |
587 | struct mixer_resources *res = &ctx->mixer_res; | 588 | struct mixer_resources *res = &ctx->mixer_res; |
588 | struct drm_framebuffer *fb = state->base.fb; | 589 | struct drm_framebuffer *fb = state->base.fb; |
590 | unsigned int priority = state->base.normalized_zpos + 1; | ||
589 | unsigned long flags; | 591 | unsigned long flags; |
590 | unsigned int win = plane->index; | 592 | unsigned int win = plane->index; |
591 | unsigned int x_ratio = 0, y_ratio = 0; | 593 | unsigned int x_ratio = 0, y_ratio = 0; |
@@ -677,7 +679,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx, | |||
677 | 679 | ||
678 | mixer_cfg_scan(ctx, mode->vdisplay); | 680 | mixer_cfg_scan(ctx, mode->vdisplay); |
679 | mixer_cfg_rgb_fmt(ctx, mode->vdisplay); | 681 | mixer_cfg_rgb_fmt(ctx, mode->vdisplay); |
680 | mixer_cfg_layer(ctx, win, state->zpos + 1, true); | 682 | mixer_cfg_layer(ctx, win, priority, true); |
681 | mixer_cfg_gfx_blend(ctx, win, is_alpha_format(fb->pixel_format)); | 683 | mixer_cfg_gfx_blend(ctx, win, is_alpha_format(fb->pixel_format)); |
682 | 684 | ||
683 | /* layer update mandatory for mixer 16.0.33.0 */ | 685 | /* layer update mandatory for mixer 16.0.33.0 */ |