Skip to content

Commit e47726a

Browse files
mszyprowBenjamin-Gaignard
authored andcommitted
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 <[email protected]> Signed-off-by: Benjamin Gaignard <[email protected]> Cc: Inki Dae <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Ville Syrjala <[email protected]> Cc: Joonyoung Shim <[email protected]> Cc: Seung-Woo Kim <[email protected]> Cc: Andrzej Hajda <[email protected]> Cc: Krzysztof Kozlowski <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Tobias Jakobi <[email protected]> Cc: Gustavo Padovan <[email protected]> Cc: [email protected] Cc: [email protected] Cc: Laurent Pinchart <[email protected]>
1 parent bbd1e3a commit e47726a

File tree

3 files changed

+13
-62
lines changed

3 files changed

+13
-62
lines changed

drivers/gpu/drm/exynos/exynos_drm_drv.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ struct exynos_drm_plane_state {
6464
struct exynos_drm_rect src;
6565
unsigned int h_ratio;
6666
unsigned int v_ratio;
67-
unsigned int zpos;
6867
};
6968

7069
static inline struct exynos_drm_plane_state *
@@ -221,7 +220,6 @@ struct exynos_drm_private {
221220
* this array is used to be aware of which crtc did it request vblank.
222221
*/
223222
struct drm_crtc *crtc[MAX_CRTC];
224-
struct drm_property *plane_zpos_property;
225223

226224
struct device *dma_dev;
227225
void *mapping;

drivers/gpu/drm/exynos/exynos_drm_plane.c

Lines changed: 9 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ static void exynos_drm_plane_reset(struct drm_plane *plane)
139139

140140
exynos_state = kzalloc(sizeof(*exynos_state), GFP_KERNEL);
141141
if (exynos_state) {
142-
exynos_state->zpos = exynos_plane->config->zpos;
143142
plane->state = &exynos_state->base;
144143
plane->state->plane = plane;
144+
plane->state->zpos = exynos_plane->config->zpos;
145145
}
146146
}
147147

@@ -157,7 +157,6 @@ exynos_drm_plane_duplicate_state(struct drm_plane *plane)
157157
return NULL;
158158

159159
__drm_atomic_helper_plane_duplicate_state(plane, &copy->base);
160-
copy->zpos = exynos_state->zpos;
161160
return &copy->base;
162161
}
163162

@@ -170,43 +169,6 @@ static void exynos_drm_plane_destroy_state(struct drm_plane *plane,
170169
kfree(old_exynos_state);
171170
}
172171

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-
210172
static struct drm_plane_funcs exynos_plane_funcs = {
211173
.update_plane = drm_atomic_helper_update_plane,
212174
.disable_plane = drm_atomic_helper_disable_plane,
@@ -215,8 +177,6 @@ static struct drm_plane_funcs exynos_plane_funcs = {
215177
.reset = exynos_drm_plane_reset,
216178
.atomic_duplicate_state = exynos_drm_plane_duplicate_state,
217179
.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,
220180
};
221181

222182
static int
@@ -304,23 +264,13 @@ static const struct drm_plane_helper_funcs plane_helper_funcs = {
304264
};
305265

306266
static void exynos_plane_attach_zpos_property(struct drm_plane *plane,
307-
unsigned int zpos)
267+
bool immutable)
308268
{
309-
struct drm_device *dev = plane->dev;
310-
struct exynos_drm_private *dev_priv = dev->dev_private;
311-
struct drm_property *prop;
312-
313-
prop = dev_priv->plane_zpos_property;
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);
269+
/* FIXME */
270+
if (immutable)
271+
drm_plane_create_zpos_immutable_property(plane, 0);
272+
else
273+
drm_plane_create_zpos_property(plane, 0, 0, MAX_PLANE - 1);
324274
}
325275

326276
int exynos_plane_init(struct drm_device *dev,
@@ -346,7 +296,8 @@ int exynos_plane_init(struct drm_device *dev,
346296
exynos_plane->index = index;
347297
exynos_plane->config = config;
348298

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));
350301

351302
return 0;
352303
}

drivers/gpu/drm/exynos/exynos_mixer.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ static void vp_video_buffer(struct mixer_context *ctx,
477477
struct drm_display_mode *mode = &state->base.crtc->state->adjusted_mode;
478478
struct mixer_resources *res = &ctx->mixer_res;
479479
struct drm_framebuffer *fb = state->base.fb;
480+
unsigned int priority = state->base.normalized_zpos + 1;
480481
unsigned long flags;
481482
dma_addr_t luma_addr[2], chroma_addr[2];
482483
bool tiled_mode = false;
@@ -561,7 +562,7 @@ static void vp_video_buffer(struct mixer_context *ctx,
561562

562563
mixer_cfg_scan(ctx, mode->vdisplay);
563564
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);
565566
mixer_cfg_vp_blend(ctx);
566567
mixer_run(ctx);
567568

@@ -586,6 +587,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx,
586587
struct drm_display_mode *mode = &state->base.crtc->state->adjusted_mode;
587588
struct mixer_resources *res = &ctx->mixer_res;
588589
struct drm_framebuffer *fb = state->base.fb;
590+
unsigned int priority = state->base.normalized_zpos + 1;
589591
unsigned long flags;
590592
unsigned int win = plane->index;
591593
unsigned int x_ratio = 0, y_ratio = 0;
@@ -677,7 +679,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx,
677679

678680
mixer_cfg_scan(ctx, mode->vdisplay);
679681
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);
681683
mixer_cfg_gfx_blend(ctx, win, is_alpha_format(fb->pixel_format));
682684

683685
/* layer update mandatory for mixer 16.0.33.0 */

0 commit comments

Comments
 (0)