From e5282853a63907f56abaaade9bd8b4e09266b913 Mon Sep 17 00:00:00 2001 From: Ondrej Jirman Date: Mon, 31 Oct 2022 03:23:11 +0100 Subject: [PATCH 203/464] drm/sun4i: Mark one of the UI planes as a cursor one Signed-off-by: Ondrej Jirman --- drivers/gpu/drm/sun4i/sun8i_mixer.c | 7 ++++++- drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 7 ++----- drivers/gpu/drm/sun4i/sun8i_ui_layer.h | 4 +++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c index 94e3787b1b70..95e2368982ea 100644 --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c @@ -357,8 +357,13 @@ static struct drm_plane **sun8i_layers_init(struct drm_device *drm, for (i = 0; i < mixer->cfg->ui_num; i++) { struct sun8i_layer *layer; + enum drm_plane_type type = DRM_PLANE_TYPE_OVERLAY; + if (i == 0) + type = DRM_PLANE_TYPE_PRIMARY; + else if (i == (mixer->cfg->ui_num - 1)) + type = DRM_PLANE_TYPE_CURSOR; - layer = sun8i_ui_layer_init_one(drm, mixer, i); + layer = sun8i_ui_layer_init_one(drm, mixer, i, type); if (IS_ERR(layer)) { dev_err(drm->dev, "Couldn't initialize %s plane\n", i ? "overlay" : "primary"); diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c index b90e5edef4e8..0349e8bdffd6 100644 --- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.c +++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.c @@ -277,9 +277,9 @@ static const uint64_t sun8i_layer_modifiers[] = { struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm, struct sun8i_mixer *mixer, - int index) + int index, + enum drm_plane_type type) { - enum drm_plane_type type = DRM_PLANE_TYPE_OVERLAY; int channel = mixer->cfg->vi_num + index; struct sun8i_layer *layer; unsigned int plane_cnt; @@ -289,9 +289,6 @@ struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm, if (!layer) return ERR_PTR(-ENOMEM); - if (index == 0) - type = DRM_PLANE_TYPE_PRIMARY; - /* possible crtcs are set later */ ret = drm_universal_plane_init(drm, &layer->plane, 0, &sun8i_ui_layer_funcs, diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_layer.h b/drivers/gpu/drm/sun4i/sun8i_ui_layer.h index 83892f6ff211..d4530e9f64e0 100644 --- a/drivers/gpu/drm/sun4i/sun8i_ui_layer.h +++ b/drivers/gpu/drm/sun4i/sun8i_ui_layer.h @@ -51,5 +51,7 @@ struct sun8i_layer; struct sun8i_layer *sun8i_ui_layer_init_one(struct drm_device *drm, struct sun8i_mixer *mixer, - int index); + int index, + enum drm_plane_type type); + #endif /* _SUN8I_UI_LAYER_H_ */ -- 2.34.1