Commit e47726a1 authored by Marek Szyprowski's avatar Marek Szyprowski Committed by Benjamin Gaignard

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: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarBenjamin 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>
parent bbd1e3a5
...@@ -64,7 +64,6 @@ struct exynos_drm_plane_state { ...@@ -64,7 +64,6 @@ struct exynos_drm_plane_state {
struct exynos_drm_rect src; struct exynos_drm_rect src;
unsigned int h_ratio; unsigned int h_ratio;
unsigned int v_ratio; unsigned int v_ratio;
unsigned int zpos;
}; };
static inline struct exynos_drm_plane_state * static inline struct exynos_drm_plane_state *
...@@ -221,7 +220,6 @@ struct exynos_drm_private { ...@@ -221,7 +220,6 @@ struct exynos_drm_private {
* this array is used to be aware of which crtc did it request vblank. * this array is used to be aware of which crtc did it request vblank.
*/ */
struct drm_crtc *crtc[MAX_CRTC]; struct drm_crtc *crtc[MAX_CRTC];
struct drm_property *plane_zpos_property;
struct device *dma_dev; struct device *dma_dev;
void *mapping; void *mapping;
......
...@@ -139,9 +139,9 @@ static void exynos_drm_plane_reset(struct drm_plane *plane) ...@@ -139,9 +139,9 @@ static void exynos_drm_plane_reset(struct drm_plane *plane)
exynos_state = kzalloc(sizeof(*exynos_state), GFP_KERNEL); exynos_state = kzalloc(sizeof(*exynos_state), GFP_KERNEL);
if (exynos_state) { if (exynos_state) {
exynos_state->zpos = exynos_plane->config->zpos;
plane->state = &exynos_state->base; plane->state = &exynos_state->base;
plane->state->plane = plane; plane->state->plane = plane;
plane->state->zpos = exynos_plane->config->zpos;
} }
} }
...@@ -157,7 +157,6 @@ exynos_drm_plane_duplicate_state(struct drm_plane *plane) ...@@ -157,7 +157,6 @@ exynos_drm_plane_duplicate_state(struct drm_plane *plane)
return NULL; return NULL;
__drm_atomic_helper_plane_duplicate_state(plane, &copy->base); __drm_atomic_helper_plane_duplicate_state(plane, &copy->base);
copy->zpos = exynos_state->zpos;
return &copy->base; return &copy->base;
} }
...@@ -170,43 +169,6 @@ static void exynos_drm_plane_destroy_state(struct drm_plane *plane, ...@@ -170,43 +169,6 @@ static void exynos_drm_plane_destroy_state(struct drm_plane *plane,
kfree(old_exynos_state); kfree(old_exynos_state);
} }
static int exynos_drm_plane_atomic_set_property(struct drm_plane *plane,
struct drm_plane_state *state,
struct drm_property *property,
uint64_t val)
{
struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
struct exynos_drm_plane_state *exynos_state =
to_exynos_plane_state(state);
struct exynos_drm_private *dev_priv = plane->dev->dev_private;
const struct exynos_drm_plane_config *config = exynos_plane->config;
if (property == dev_priv->plane_zpos_property &&
(config->capabilities & EXYNOS_DRM_PLANE_CAP_ZPOS))
exynos_state->zpos = val;
else
return -EINVAL;
return 0;
}
static int exynos_drm_plane_atomic_get_property(struct drm_plane *plane,
const struct drm_plane_state *state,
struct drm_property *property,
uint64_t *val)
{
const struct exynos_drm_plane_state *exynos_state =
container_of(state, const struct exynos_drm_plane_state, base);
struct exynos_drm_private *dev_priv = plane->dev->dev_private;
if (property == dev_priv->plane_zpos_property)
*val = exynos_state->zpos;
else
return -EINVAL;
return 0;
}
static struct drm_plane_funcs exynos_plane_funcs = { static struct drm_plane_funcs exynos_plane_funcs = {
.update_plane = drm_atomic_helper_update_plane, .update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane, .disable_plane = drm_atomic_helper_disable_plane,
...@@ -215,8 +177,6 @@ static struct drm_plane_funcs exynos_plane_funcs = { ...@@ -215,8 +177,6 @@ static struct drm_plane_funcs exynos_plane_funcs = {
.reset = exynos_drm_plane_reset, .reset = exynos_drm_plane_reset,
.atomic_duplicate_state = exynos_drm_plane_duplicate_state, .atomic_duplicate_state = exynos_drm_plane_duplicate_state,
.atomic_destroy_state = exynos_drm_plane_destroy_state, .atomic_destroy_state = exynos_drm_plane_destroy_state,
.atomic_set_property = exynos_drm_plane_atomic_set_property,
.atomic_get_property = exynos_drm_plane_atomic_get_property,
}; };
static int static int
...@@ -304,23 +264,13 @@ static const struct drm_plane_helper_funcs plane_helper_funcs = { ...@@ -304,23 +264,13 @@ static const struct drm_plane_helper_funcs plane_helper_funcs = {
}; };
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) bool immutable)
{ {
struct drm_device *dev = plane->dev; /* FIXME */
struct exynos_drm_private *dev_priv = dev->dev_private; if (immutable)
struct drm_property *prop; drm_plane_create_zpos_immutable_property(plane, 0);
else
prop = dev_priv->plane_zpos_property; drm_plane_create_zpos_property(plane, 0, 0, MAX_PLANE - 1);
if (!prop) {
prop = drm_property_create_range(dev, 0, "zpos",
0, MAX_PLANE - 1);
if (!prop)
return;
dev_priv->plane_zpos_property = prop;
}
drm_object_attach_property(&plane->base, prop, zpos);
} }
int exynos_plane_init(struct drm_device *dev, int exynos_plane_init(struct drm_device *dev,
...@@ -346,7 +296,8 @@ int exynos_plane_init(struct drm_device *dev, ...@@ -346,7 +296,8 @@ int exynos_plane_init(struct drm_device *dev,
exynos_plane->index = index; exynos_plane->index = index;
exynos_plane->config = config; exynos_plane->config = config;
exynos_plane_attach_zpos_property(&exynos_plane->base, config->zpos); exynos_plane_attach_zpos_property(&exynos_plane->base,
!(config->capabilities & EXYNOS_DRM_PLANE_CAP_ZPOS));
return 0; return 0;
} }
...@@ -477,6 +477,7 @@ static void vp_video_buffer(struct mixer_context *ctx, ...@@ -477,6 +477,7 @@ static void vp_video_buffer(struct mixer_context *ctx,
struct drm_display_mode *mode = &state->base.crtc->state->adjusted_mode; struct drm_display_mode *mode = &state->base.crtc->state->adjusted_mode;
struct mixer_resources *res = &ctx->mixer_res; struct mixer_resources *res = &ctx->mixer_res;
struct drm_framebuffer *fb = state->base.fb; struct drm_framebuffer *fb = state->base.fb;
unsigned int priority = state->base.normalized_zpos + 1;
unsigned long flags; unsigned long flags;
dma_addr_t luma_addr[2], chroma_addr[2]; dma_addr_t luma_addr[2], chroma_addr[2];
bool tiled_mode = false; bool tiled_mode = false;
...@@ -561,7 +562,7 @@ static void vp_video_buffer(struct mixer_context *ctx, ...@@ -561,7 +562,7 @@ static void vp_video_buffer(struct mixer_context *ctx,
mixer_cfg_scan(ctx, mode->vdisplay); mixer_cfg_scan(ctx, mode->vdisplay);
mixer_cfg_rgb_fmt(ctx, mode->vdisplay); mixer_cfg_rgb_fmt(ctx, mode->vdisplay);
mixer_cfg_layer(ctx, plane->index, state->zpos + 1, true); mixer_cfg_layer(ctx, plane->index, priority, true);
mixer_cfg_vp_blend(ctx); mixer_cfg_vp_blend(ctx);
mixer_run(ctx); mixer_run(ctx);
...@@ -586,6 +587,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx, ...@@ -586,6 +587,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx,
struct drm_display_mode *mode = &state->base.crtc->state->adjusted_mode; struct drm_display_mode *mode = &state->base.crtc->state->adjusted_mode;
struct mixer_resources *res = &ctx->mixer_res; struct mixer_resources *res = &ctx->mixer_res;
struct drm_framebuffer *fb = state->base.fb; struct drm_framebuffer *fb = state->base.fb;
unsigned int priority = state->base.normalized_zpos + 1;
unsigned long flags; unsigned long flags;
unsigned int win = plane->index; unsigned int win = plane->index;
unsigned int x_ratio = 0, y_ratio = 0; unsigned int x_ratio = 0, y_ratio = 0;
...@@ -677,7 +679,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx, ...@@ -677,7 +679,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx,
mixer_cfg_scan(ctx, mode->vdisplay); mixer_cfg_scan(ctx, mode->vdisplay);
mixer_cfg_rgb_fmt(ctx, mode->vdisplay); mixer_cfg_rgb_fmt(ctx, mode->vdisplay);
mixer_cfg_layer(ctx, win, state->zpos + 1, true); mixer_cfg_layer(ctx, win, priority, true);
mixer_cfg_gfx_blend(ctx, win, is_alpha_format(fb->pixel_format)); mixer_cfg_gfx_blend(ctx, win, is_alpha_format(fb->pixel_format));
/* layer update mandatory for mixer 16.0.33.0 */ /* layer update mandatory for mixer 16.0.33.0 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment