Skip to contentSkip to conversation

Generic zpos property

PATCH Superseded Benjamin Gaignard 2 participants 6 messages May 13, 2016 – May 24, 2016

Subsystems (7)

v3 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v3 cover Generic zpos property

version 3:
use kmalloc_array instead of kmalloc.
Correct normalize_zpos computation (comeback to Mareck original code)

version 2:
add a zpos property into drm_plane structure to simplify code. This allow to get/set zpos value in core and not in drivers code. Fix various remarks.

version 1:
refactor Marek's patches to have per plane zpos property instead of only one in core.

Benjamin Gaignard (2):
drm: sti: use generic zpos for plane
drm: rcar: use generic code for managing zpos plane property

Marek Szyprowski (2):
drm: add generic zpos property
drm/exynos: use generic code for managing zpos plane property

 Documentation/DocBook/gpu.tmpl            |  10 ++
 drivers/gpu/drm/Makefile                  |   2 +-
 drivers/gpu/drm/drm_atomic.c              |   4 +
 drivers/gpu/drm/drm_atomic_helper.c       |   6 +
 drivers/gpu/drm/drm_blend.c               | 226 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_crtc_internal.h       |   3 +
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |   2 -
 drivers/gpu/drm/exynos/exynos_drm_plane.c |  67 ++-------
 drivers/gpu/drm/exynos/exynos_mixer.c     |   6 +-
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c    |   2 +-
 drivers/gpu/drm/rcar-du/rcar_du_drv.h     |   1 -
 drivers/gpu/drm/rcar-du/rcar_du_kms.c     |   5 -
 drivers/gpu/drm/rcar-du/rcar_du_plane.c   |   9 +-
 drivers/gpu/drm/rcar-du/rcar_du_plane.h   |   2 -
 drivers/gpu/drm/sti/sti_mixer.c           |   9 +-
 drivers/gpu/drm/sti/sti_plane.c           |  80 ++++-------
 drivers/gpu/drm/sti/sti_plane.h           |   2 -
 include/drm/drm_crtc.h                    |  28 ++++
 18 files changed, 325 insertions(+), 139 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_blend.c
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 Laurent Pinchart <[email protected]>
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH v3 1/4 drm: add generic zpos property

From: Marek Szyprowski <[email protected]>

This patch adds support for generic plane's zpos property property with well-defined semantics:
- added zpos properties to plane and plane state structures
- added helpers for normalizing zpos properties of given set of planes
- well defined semantics: planes are sorted by zpos values and then plane id value if zpos equals

Normalized zpos values are calculated automatically when generic muttable zpos property has been initialized. Drivers can simply use plane_state->normalized_zpos in their atomic_check and/or plane_update callbacks without any additional calls to DRM core.

Compare to Marek's original patch zpos property is now specific to each plane and no more to the core.
Normalize function take care of the range of per plane defined range before set normalized_zpos.

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 Laurent Pinchart <[email protected]>
---
 Documentation/DocBook/gpu.tmpl      |  10 ++
 drivers/gpu/drm/Makefile            |   2 +-
 drivers/gpu/drm/drm_atomic.c        |   4 +
 drivers/gpu/drm/drm_atomic_helper.c |   6 +
 drivers/gpu/drm/drm_blend.c         | 226 ++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_crtc_internal.h |   3 +
 include/drm/drm_crtc.h              |  28 +++++
 7 files changed, 278 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/drm_blend.c
Documentation/DocBook/gpu.tmpl +10 -0
index 9dd48f7..0df6abb 100644
@@ -2151,6 +2151,16 @@ void intel_crt_init(struct drm_device *dev)
 		the underlying hardware).</td>
 	</tr>
 	<tr>
+	<td valign="top" > "zpos" </td>
+	<td valign="top" >RANGE</td>
+	<td valign="top" >Min= driver dependent, Max= driver dependent</td>
+	<td valign="top" >Plane</td>
+	<td valign="top" >Plane's 'z' position during blending operation (0 for background, highest for frontmost).
+		If two planes assigned to same CRTC have equal zpos values, the plane with higher plane
+		id is treated as closer to front. Can be IMMUTABLE if driver doesn't support changing
+		planes' order. Exact value range is driver dependent.</td>
+	</tr>
+	<tr>
 	<td rowspan="20" valign="top" >i915</td>
 	<td rowspan="2" valign="top" >Generic</td>
 	<td valign="top" >"Broadcast RGB"</td>
drivers/gpu/drm/Makefile +1 -1
index 2bd3e5a..df88253 100644
@@ -2,7 +2,7 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-drm-y       :=	drm_auth.o drm_bufs.o drm_cache.o \
+drm-y       :=	drm_auth.o drm_bufs.o drm_blend.o drm_cache.o \
 		drm_context.o drm_dma.o \
 		drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \
 		drm_lock.o drm_memory.o drm_drv.o drm_vm.o \
drivers/gpu/drm/drm_atomic.c +4 -0
index 86e89db..bd457ca 100644
@@ -700,6 +700,8 @@ int drm_atomic_plane_set_property(struct drm_plane *plane,
 		state->src_h = val;
 	} else if (property == config->rotation_property) {
 		state->rotation = val;
+	} else if (property == plane->zpos_property) {
+		state->zpos = val;
 	} else if (plane->funcs->atomic_set_property) {
 		return plane->funcs->atomic_set_property(plane, state,
 				property, val);
@@ -756,6 +758,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
 		*val = state->src_h;
 	} else if (property == config->rotation_property) {
 		*val = state->rotation;
+	} else if (property == plane->zpos_property) {
+		*val = state->zpos;
 	} else if (plane->funcs->atomic_get_property) {
 		return plane->funcs->atomic_get_property(plane, state, property, val);
 	} else {
drivers/gpu/drm/drm_atomic_helper.c +6 -0
index 997fd21..f10652f 100644
@@ -32,6 +32,8 @@
 #include <drm/drm_atomic_helper.h>
 #include <linux/fence.h>
 
+#include "drm_crtc_internal.h"
+
 /**
  * DOC: overview
  *
@@ -587,6 +589,10 @@ drm_atomic_helper_check_planes(struct drm_device *dev,
 	struct drm_plane_state *plane_state;
 	int i, ret = 0;
 
+	ret = drm_atomic_helper_normalize_zpos(dev, state);
+	if (ret)
+		return ret;
+
 	for_each_plane_in_state(state, plane, plane_state, i) {
 		const struct drm_plane_helper_funcs *funcs;
 
drivers/gpu/drm/drm_blend.c new file +226 -0

226 lines not on this page · raw message

drivers/gpu/drm/drm_crtc_internal.h +3 -0
index a78c138..37d9068 100644
@@ -42,3 +42,6 @@ int drm_atomic_get_property(struct drm_mode_object *obj,
 int drm_mode_atomic_ioctl(struct drm_device *dev,
 			  void *data, struct drm_file *file_priv);
 
+/* drm_blend.c */
+int drm_atomic_helper_normalize_zpos(struct drm_device *dev,
+				     struct drm_atomic_state *state);
include/drm/drm_crtc.h +28 -0
index d1559cd..921c93f 100644
@@ -305,6 +305,7 @@ struct drm_plane_helper_funcs;
  * @mode_changed: crtc_state->mode or crtc_state->enable has been changed
  * @active_changed: crtc_state->active has been toggled.
  * @connectors_changed: connectors to this crtc have been updated
+ * @zpos_changed: zpos values of planes on this crtc have been updated
  * @color_mgmt_changed: color management properties have changed (degamma or
  *	gamma LUT or CSC matrix)
  * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes
@@ -340,6 +341,7 @@ struct drm_crtc_state {
 	bool mode_changed : 1;
 	bool active_changed : 1;
 	bool connectors_changed : 1;
+	bool zpos_changed : 1;
 	bool color_mgmt_changed : 1;
 
 	/* attached planes bitmask:
@@ -1263,6 +1265,9 @@ struct drm_connector {
  *	plane (in 16.16)
  * @src_w: width of visible portion of plane (in 16.16)
  * @src_h: height of visible portion of plane (in 16.16)
+ * @zpos: priority of the given plane on crtc (optional)
+ * @normalized_zpos: normalized value of zpos: unique, range from 0 to N-1
+ *	 for given crtc
  * @state: backpointer to global drm_atomic_state
  */
 struct drm_plane_state {
@@ -1283,6 +1288,10 @@ struct drm_plane_state {
 	/* Plane rotation */
 	unsigned int rotation;
 
+	/* Plane zpos */
+	unsigned int zpos;
+	unsigned int normalized_zpos;
+
 	struct drm_atomic_state *state;
 };
 
@@ -1516,6 +1525,7 @@ enum drm_plane_type {
  * @properties: property tracking for this plane
  * @type: type of plane (overlay, primary, cursor)
  * @state: current atomic state for this plane
+ * @zpos_property: zpos property for this plane
  */
 struct drm_plane {
 	struct drm_device *dev;
@@ -1546,6 +1556,8 @@ struct drm_plane {
 	const struct drm_plane_helper_funcs *helper_private;
 
 	struct drm_plane_state *state;
+
+	struct drm_property *zpos_property;
 };
 
 /**
@@ -2554,6 +2566,22 @@ extern struct drm_property *drm_mode_create_rotation_property(struct drm_device
 extern unsigned int drm_rotation_simplify(unsigned int rotation,
 					  unsigned int supported_rotations);
 
+int drm_plane_atomic_set_zpos_property(struct drm_plane *plane,
+				       struct drm_plane_state *state,
+				       struct drm_property *property,
+				       uint64_t val);
+
+int drm_plane_atomic_get_zpos_property(struct drm_plane *plane,
+				       const struct drm_plane_state *state,
+				       struct drm_property *property,
+				       uint64_t *val);
+
+int drm_plane_create_zpos_property(struct drm_plane *plane,
+				   unsigned int min, unsigned int max);
+int drm_plane_create_zpos_immutable_property(struct drm_plane *plane,
+					     unsigned int min,
+					     unsigned int max);
+
 /* Helpers */
 
 static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

PATCH v3 2/4 drm: sti: use generic zpos for plane

In reply to Benjamin Gaignard

remove private zpos property and use instead the generic new. zpos range is now fixed per plane type and normalized before being using in mixer.

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 Laurent Pinchart <[email protected]>
---
 drivers/gpu/drm/sti/sti_mixer.c |  9 ++---
 drivers/gpu/drm/sti/sti_plane.c | 80 +++++++++++++++--------------------------
 drivers/gpu/drm/sti/sti_plane.h |  2 --
 3 files changed, 31 insertions(+), 60 deletions(-)
drivers/gpu/drm/sti/sti_mixer.c +3 -6
index e7425c3..d93f537 100644
@@ -245,13 +245,10 @@ static void sti_mixer_set_background_area(struct sti_mixer *mixer,
 
 int sti_mixer_set_plane_depth(struct sti_mixer *mixer, struct sti_plane *plane)
 {
-	int plane_id, depth = plane->zorder;
+	int plane_id, depth = plane->drm_plane.state->normalized_zpos;
 	unsigned int i;
 	u32 mask, val;
 
-	if ((depth < 1) || (depth > GAM_MIXER_NB_DEPTH_LEVEL))
-		return 1;
-
 	switch (plane->desc) {
 	case STI_GDP_0:
 		plane_id = GAM_DEPTH_GDP0_ID;
@@ -284,8 +281,8 @@ int sti_mixer_set_plane_depth(struct sti_mixer *mixer, struct sti_plane *plane)
 			break;
 	}
 
-	mask |= GAM_DEPTH_MASK_ID << (3 * (depth - 1));
-	plane_id = plane_id << (3 * (depth - 1));
+	mask |= GAM_DEPTH_MASK_ID << (3 * depth);
+	plane_id = plane_id << (3 * depth);
 
 	DRM_DEBUG_DRIVER("%s %s depth=%d\n", sti_mixer_to_str(mixer),
 			 sti_plane_to_str(plane), depth);
drivers/gpu/drm/sti/sti_plane.c +28 -52

112 lines not on this page · raw message

drivers/gpu/drm/sti/sti_plane.h +0 -2
index c50a3b9..2747773 100644
@@ -68,14 +68,12 @@ struct sti_fps_info {
  * @plane:              drm plane it is bound to (if any)
  * @desc:               plane type & id
  * @status:             to know the status of the plane
- * @zorder:             plane z-order
  * @fps_info:           frame per second info
  */
 struct sti_plane {
 	struct drm_plane drm_plane;
 	enum sti_plane_desc desc;
 	enum sti_plane_status status;
-	int zorder;
 	struct sti_fps_info fps_info;
 };
 
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

PATCH v3 3/4 drm/exynos: use generic code for managing zpos plane property

In reply to Benjamin Gaignard

From: Marek Szyprowski <[email protected]>

This patch replaces zpos property handling custom code in Exynos DRM driver with calls to generic DRM code.

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 Laurent Pinchart <[email protected]>
---
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |  2 -
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 67 +++++--------------------------
 drivers/gpu/drm/exynos/exynos_mixer.c     |  6 ++-
 3 files changed, 13 insertions(+), 62 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_drv.h +0 -2
index cc33ec9..b34a7b9 100644
@@ -64,7 +64,6 @@ struct exynos_drm_plane_state {
 	struct exynos_drm_rect src;
 	unsigned int h_ratio;
 	unsigned int v_ratio;
-	unsigned int zpos;
 };
 
 static inline struct exynos_drm_plane_state *
@@ -221,7 +220,6 @@ struct exynos_drm_private {
 	 * this array is used to be aware of which crtc did it request vblank.
 	 */
 	struct drm_crtc *crtc[MAX_CRTC];
-	struct drm_property *plane_zpos_property;
 
 	struct device *dma_dev;
 	unsigned long da_start;
drivers/gpu/drm/exynos/exynos_drm_plane.c +9 -58

106 lines not on this page · raw message

drivers/gpu/drm/exynos/exynos_mixer.c +4 -2
index 74a4269..e1d47f9 100644
@@ -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 mixer_resources *res = &ctx->mixer_res;
 	struct drm_framebuffer *fb = state->base.fb;
+	unsigned int priority = state->base.normalized_zpos + 1;
 	unsigned long flags;
 	dma_addr_t luma_addr[2], chroma_addr[2];
 	bool tiled_mode = false;
@@ -561,7 +562,7 @@ static void vp_video_buffer(struct mixer_context *ctx,
 
 	mixer_cfg_scan(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_run(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 mixer_resources *res = &ctx->mixer_res;
 	struct drm_framebuffer *fb = state->base.fb;
+	unsigned int priority = state->base.normalized_zpos + 1;
 	unsigned long flags;
 	unsigned int win = plane->index;
 	unsigned int x_ratio = 0, y_ratio = 0;
@@ -677,7 +679,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx,
 
 	mixer_cfg_scan(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));
 
 	/* layer update mandatory for mixer 16.0.33.0 */
Signature · 1 line
1.9.1
#4 lore raw

PATCH v3 4/4 drm: rcar: use generic code for managing zpos plane property

In reply to Benjamin Gaignard

This patch replaces zpos property handling custom code in rcar DRM driver with calls to generic DRM code.

Cc Daniel Vetter <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Marek Szyprowski <[email protected]>
---
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c  | 2 +-
 drivers/gpu/drm/rcar-du/rcar_du_drv.h   | 1 -
 drivers/gpu/drm/rcar-du/rcar_du_kms.c   | 5 -----
 drivers/gpu/drm/rcar-du/rcar_du_plane.c | 9 ++-------
 drivers/gpu/drm/rcar-du/rcar_du_plane.h | 2 --
 5 files changed, 3 insertions(+), 16 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_crtc.c +1 -1
index 0d8bdda..28d2cb6 100644
@@ -196,7 +196,7 @@ void rcar_du_crtc_route_output(struct drm_crtc *crtc,
 
 static unsigned int plane_zpos(struct rcar_du_plane *plane)
 {
-	return to_rcar_plane_state(plane->plane.state)->zpos;
+	return plane->plane.state->normalized_zpos;
 }
 
 static const struct rcar_du_format_info *
drivers/gpu/drm/rcar-du/rcar_du_drv.h +0 -1
index ed35467..c843c31 100644
@@ -92,7 +92,6 @@ struct rcar_du_device {
 	struct {
 		struct drm_property *alpha;
 		struct drm_property *colorkey;
-		struct drm_property *zpos;
 	} props;
 
 	unsigned int dpad0_source;
drivers/gpu/drm/rcar-du/rcar_du_kms.c +0 -5
index e70a4f3..4ace0aa 100644
@@ -527,11 +527,6 @@ static int rcar_du_properties_init(struct rcar_du_device *rcdu)
 	if (rcdu->props.colorkey == NULL)
 		return -ENOMEM;
 
-	rcdu->props.zpos =
-		drm_property_create_range(rcdu->ddev, 0, "zpos", 1, 7);
-	if (rcdu->props.zpos == NULL)
-		return -ENOMEM;
-
 	return 0;
 }
 
drivers/gpu/drm/rcar-du/rcar_du_plane.c +2 -7
index 8460ae1..4764afc 100644
@@ -656,7 +656,7 @@ static void rcar_du_plane_reset(struct drm_plane *plane)
 	state->source = RCAR_DU_PLANE_MEMORY;
 	state->alpha = 255;
 	state->colorkey = RCAR_DU_COLORKEY_NONE;
-	state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1;
+	plane->state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1;
 
 	plane->state = &state->state;
 	plane->state->plane = plane;
@@ -674,8 +674,6 @@ static int rcar_du_plane_atomic_set_property(struct drm_plane *plane,
 		rstate->alpha = val;
 	else if (property == rcdu->props.colorkey)
 		rstate->colorkey = val;
-	else if (property == rcdu->props.zpos)
-		rstate->zpos = val;
 	else
 		return -EINVAL;
 
@@ -694,8 +692,6 @@ static int rcar_du_plane_atomic_get_property(struct drm_plane *plane,
 		*val = rstate->alpha;
 	else if (property == rcdu->props.colorkey)
 		*val = rstate->colorkey;
-	else if (property == rcdu->props.zpos)
-		*val = rstate->zpos;
 	else
 		return -EINVAL;
 
@@ -767,8 +763,7 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp)
 		drm_object_attach_property(&plane->plane.base,
 					   rcdu->props.colorkey,
 					   RCAR_DU_COLORKEY_NONE);
-		drm_object_attach_property(&plane->plane.base,
-					   rcdu->props.zpos, 1);
+		drm_plane_create_zpos_property(&plane->plane, 1, 7);
 	}
 
 	return 0;
drivers/gpu/drm/rcar-du/rcar_du_plane.h +0 -2
index b18b7b2..8b91dd3 100644
@@ -51,7 +51,6 @@ static inline struct rcar_du_plane *to_rcar_plane(struct drm_plane *plane)
  * @hwindex: 0-based hardware plane index, -1 means unused
  * @alpha: value of the plane alpha property
  * @colorkey: value of the plane colorkey property
- * @zpos: value of the plane zpos property
  */
 struct rcar_du_plane_state {
 	struct drm_plane_state state;
@@ -62,7 +61,6 @@ struct rcar_du_plane_state {
 
 	unsigned int alpha;
 	unsigned int colorkey;
-	unsigned int zpos;
 };
 
 static inline struct rcar_du_plane_state *
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

Re: [PATCH v3 4/4] drm: rcar: use generic code for managing zpos plane property

Hi Benjamin,

Thank you for the patch.

Quoted 63 lines · On Friday 13 May 2016 09:15:27 Benjamin Gaignard wrote:

This patch replaces zpos property handling custom code in rcar DRM driver with calls to generic DRM code.

Cc Daniel Vetter <[email protected]>
Cc Ville Syrjala <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Marek Szyprowski <[email protected]>
---
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c  | 2 +-
 drivers/gpu/drm/rcar-du/rcar_du_drv.h   | 1 -
 drivers/gpu/drm/rcar-du/rcar_du_kms.c   | 5 -----
 drivers/gpu/drm/rcar-du/rcar_du_plane.c | 9 ++-------
 drivers/gpu/drm/rcar-du/rcar_du_plane.h | 2 --
 5 files changed, 3 insertions(+), 16 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 0d8bdda..28d2cb6 100644

drivers/gpu/drm/rcar-du/rcar_du_crtc.c +1 -1
@@ -196,7 +196,7 @@ void rcar_du_crtc_route_output(struct drm_crtc *crtc,
 
 static unsigned int plane_zpos(struct rcar_du_plane *plane)
 {
-	return to_rcar_plane_state(plane->plane.state)->zpos;
+	return plane->plane.state->normalized_zpos;
 }
 
 static const struct rcar_du_format_info *
(quoted diff) +0 -0

b/drivers/gpu/drm/rcar-du/rcar_du_drv.h index ed35467..c843c31 100644

drivers/gpu/drm/rcar-du/rcar_du_drv.h +0 -1
@@ -92,7 +92,6 @@ struct rcar_du_device {
 	struct {
 		struct drm_property *alpha;
 		struct drm_property *colorkey;
-		struct drm_property *zpos;
 	} props;
 
 	unsigned int dpad0_source;
(quoted diff) +0 -0

b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index e70a4f3..4ace0aa 100644

drivers/gpu/drm/rcar-du/rcar_du_kms.c +0 -5
@@ -527,11 +527,6 @@ static int rcar_du_properties_init(struct
 rcar_du_device *rcdu) if (rcdu->props.colorkey == NULL)
 		return -ENOMEM;
 
-	rcdu->props.zpos =
-		drm_property_create_range(rcdu->ddev, 0, "zpos", 1, 7);
-	if (rcdu->props.zpos == NULL)
-		return -ENOMEM;
-
 	return 0;
 }
 
(quoted diff) +0 -0

b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index 8460ae1..4764afc 100644

drivers/gpu/drm/rcar-du/rcar_du_plane.c static void rcar_du_plane_reset(struct drm_plane *plane) · line 659

Quoted 5 lines
drivers/gpu/drm/rcar-du/rcar_du_plane.c +1 -1
@@ -656,7 +656,7 @@ static void rcar_du_plane_reset(struct drm_plane *plane)
 state->source = RCAR_DU_PLANE_MEMORY;
 	state->alpha = 255;
 	state->colorkey = RCAR_DU_COLORKEY_NONE;
-	state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1;
+	plane->state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1;

plane->state is NULL at this point, this should be state->state.zpos = ...

Quoted 50 lines
drivers/gpu/drm/rcar-du/rcar_du_plane.c +1 -6
 	plane->state = &state->state;
 	plane->state->plane = plane;
@@ -674,8 +674,6 @@ static int rcar_du_plane_atomic_set_property(struct
 drm_plane *plane, rstate->alpha = val;
 	else if (property == rcdu->props.colorkey)
 		rstate->colorkey = val;
-	else if (property == rcdu->props.zpos)
-		rstate->zpos = val;
 	else
 		return -EINVAL;
 
@@ -694,8 +692,6 @@ static int rcar_du_plane_atomic_get_property(struct
 drm_plane *plane, *val = rstate->alpha;
 	else if (property == rcdu->props.colorkey)
 		*val = rstate->colorkey;
-	else if (property == rcdu->props.zpos)
-		*val = rstate->zpos;
 	else
 		return -EINVAL;
 
@@ -767,8 +763,7 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp)
 		drm_object_attach_property(&plane->plane.base,
 					   rcdu->props.colorkey,
 					   RCAR_DU_COLORKEY_NONE);
-		drm_object_attach_property(&plane->plane.base,
-					   rcdu->props.zpos, 1);
+		drm_plane_create_zpos_property(&plane->plane, 1, 7);
 	}
 
 	return 0;
(quoted diff) +0 -0

b/drivers/gpu/drm/rcar-du/rcar_du_plane.h index b18b7b2..8b91dd3 100644

drivers/gpu/drm/rcar-du/rcar_du_plane.h +0 -0
@@ -51,7 +51,6 @@ static inline struct rcar_du_plane *to_rcar_plane(struct

drm_plane *plane) * @hwindex: 0-based hardware plane index, -1 means unused
* @alpha: value of the plane alpha property
* @colorkey: value of the plane colorkey property
- * @zpos: value of the plane zpos property
*/
struct rcar_du_plane_state {

drivers/gpu/drm/rcar-du/rcar_du_plane.h +0 -1
 	struct drm_plane_state state;
@@ -62,7 +61,6 @@ struct rcar_du_plane_state {
 
 	unsigned int alpha;
 	unsigned int colorkey;
-	unsigned int zpos;
 };
 
 static inline struct rcar_du_plane_state *
Signature · 8 lines
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel