All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/6] drm: zpos normalization cleanup and omapdrm to use it
@ 2018-01-25 14:26 Peter Ujfalusi
  2018-01-25 14:26 ` [PATCH v3 1/6] drm: Add drm_mode_config->normalize_zpos boolean Peter Ujfalusi
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Peter Ujfalusi @ 2018-01-25 14:26 UTC (permalink / raw)
  To: laurent.pinchart, daniel, airlied; +Cc: tomi.valkeinen, dri-devel

Hi,

Changes since v2:
- Fixed commit messages (s/drm_device/drm_mode_config)
- Added ack from Benjamin Gaignard to drm/sti patch

Changes since v1:
- normalize_zpos flag moved to drm_mode_config
- Added comment to note the side effect of normalization and updated the comment
  for normalized_zpos in the header file as well.
- Added Acked-by from Daniel to patch 2-6 but not for patch 1 as I'm not sure if
  the comments I have added matches with what is expected to be.

The first patch is adding a flag to drm_device that drivers can set if they want
the zpos to be normalized.

Then convert exynos, tegra, sti and rcar-du to use this flag instead of
re-implementing the drm_atomic_helper_check() locally just to add the call to
drm_atomic_normalize_zpos().

The last patch is moving omapdrm to use the zpos normalization as well to comply
with the UAPI documentation regarding to zpos.

Laurent's note in an earlier thread:
https://marc.info/?l=dri-devel&m=151567355225029&w=2

"The problem is that zpos normalization requires accessing the state of all 
enabled planes for a CRTC in order to compute (and store) the normalized zpos 
values. This thus forces all planes to be added to the commit state, even when 
the commit doesn't touch the zpos property. I assume this caused issues 
(possibly performance issues) in drivers that then performed hardware setup of 
all planes as a result."

can be addressed later in the core for all users of drm_atomic_normalize_zpos()

Regards,
Peter
---
Peter Ujfalusi (6):
  drm: Add drm_mode_config->normalize_zpos boolean
  drm/exynos: Let core take care of normalizing the zpos
  drm/tegra: Let core take care of normalizing the zpos
  drm/sti: Let core take care of normalizing the zpos
  drm: rcar-du: Let core take care of normalizing the zpos
  drm/omap: Use normalized zpos for plane placement

 drivers/gpu/drm/drm_atomic_helper.c     | 11 +++++++++++
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 20 --------------------
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  1 -
 drivers/gpu/drm/exynos/exynos_drm_fb.c  |  4 +++-
 drivers/gpu/drm/omapdrm/omap_drv.c      |  3 +++
 drivers/gpu/drm/omapdrm/omap_plane.c    |  2 +-
 drivers/gpu/drm/rcar-du/rcar_du_kms.c   | 11 ++---------
 drivers/gpu/drm/sti/sti_drv.c           | 24 +++---------------------
 drivers/gpu/drm/tegra/drm.c             | 27 +++------------------------
 include/drm/drm_mode_config.h           |  8 ++++++++
 include/drm/drm_plane.h                 |  4 ++--
 11 files changed, 36 insertions(+), 79 deletions(-)

-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v3 1/6] drm: Add drm_mode_config->normalize_zpos boolean
  2018-01-25 14:26 [PATCH v3 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
@ 2018-01-25 14:26 ` Peter Ujfalusi
  2018-01-25 14:40   ` Ville Syrjälä
  2018-01-25 14:26 ` [PATCH v3 2/6] drm/exynos: Let core take care of normalizing the zpos Peter Ujfalusi
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Peter Ujfalusi @ 2018-01-25 14:26 UTC (permalink / raw)
  To: laurent.pinchart, daniel, airlied; +Cc: tomi.valkeinen, dri-devel

Instead of drivers duplicating the drm_atomic_helper_check() code to be
able to normalize the zpos they can use the normalize_zpos flag to let the
drm core to do it.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/gpu/drm/drm_atomic_helper.c | 11 +++++++++++
 include/drm/drm_mode_config.h       |  8 ++++++++
 include/drm/drm_plane.h             |  4 ++--
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index ab4032167094..0f6a4949e6dc 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -873,6 +873,11 @@ EXPORT_SYMBOL(drm_atomic_helper_check_planes);
  * functions depend upon an updated adjusted_mode.clock to e.g. properly compute
  * watermarks.
  *
+ * Note that zpos normalization will add all enable planes to the state which
+ * might not desired for some drivers.
+ * For example enable/disable of a cursor plane which have fixed zpos value
+ * would trigger all other enabled planes to be forced to the state change.
+ *
  * RETURNS:
  * Zero for success or -errno
  */
@@ -885,6 +890,12 @@ int drm_atomic_helper_check(struct drm_device *dev,
 	if (ret)
 		return ret;
 
+	if (dev->mode_config.normalize_zpos) {
+		ret = drm_atomic_normalize_zpos(dev, state);
+		if (ret)
+			return ret;
+	}
+
 	ret = drm_atomic_helper_check_planes(dev, state);
 	if (ret)
 		return ret;
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 2cb6f02df64a..987ab63ae037 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -792,6 +792,14 @@ struct drm_mode_config {
 	/* cursor size */
 	uint32_t cursor_width, cursor_height;
 
+	/**
+	 * @normalize_zpos:
+	 *
+	 * If true the drm core will call drm_atomic_normalize_zpos() as part of
+	 * atomic mode checking from drm_atomic_helper_check()
+	 */
+	bool normalize_zpos;
+
 	/**
 	 * @suspend_state:
 	 *
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 8185e3468a23..2c0adb124e0f 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -50,8 +50,8 @@ struct drm_modeset_acquire_ctx;
  *	plane with a lower ID.
  * @normalized_zpos: normalized value of zpos: unique, range from 0 to N-1
  *	where N is the number of active planes for given crtc. Note that
- *	the driver must call drm_atomic_normalize_zpos() to update this before
- *	it can be trusted.
+ *	the driver must set drm_mode_config.normalize_zpos or call
+ *	drm_atomic_normalize_zpos() to update this before it can be trusted.
  * @src: clipped source coordinates of the plane (in 16.16)
  * @dst: clipped destination coordinates of the plane
  * @state: backpointer to global drm_atomic_state
-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 2/6] drm/exynos: Let core take care of normalizing the zpos
  2018-01-25 14:26 [PATCH v3 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
  2018-01-25 14:26 ` [PATCH v3 1/6] drm: Add drm_mode_config->normalize_zpos boolean Peter Ujfalusi
@ 2018-01-25 14:26 ` Peter Ujfalusi
  2018-01-25 14:26 ` [PATCH v3 3/6] drm/tegra: " Peter Ujfalusi
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Peter Ujfalusi @ 2018-01-25 14:26 UTC (permalink / raw)
  To: laurent.pinchart, daniel, airlied
  Cc: Seung-Woo Kim, dri-devel, Kyungmin Park, tomi.valkeinen

Instead of re-implementing the drm_atomic_helper_check() locally with just
adding drm_atomic_normalize_zpos() into it, set the
drm_mode_config->normalize_zpos.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Inki Dae <inki.dae@samsung.com>
CC: Joonyoung Shim <jy0922.shim@samsung.com>
CC: Seung-Woo Kim <sw0312.kim@samsung.com>
CC: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 20 --------------------
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  1 -
 drivers/gpu/drm/exynos/exynos_drm_fb.c  |  4 +++-
 3 files changed, 3 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index a518e9c6d6cc..39284bb7c2c2 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -37,26 +37,6 @@
 #define DRIVER_MAJOR	1
 #define DRIVER_MINOR	0
 
-int exynos_atomic_check(struct drm_device *dev,
-			struct drm_atomic_state *state)
-{
-	int ret;
-
-	ret = drm_atomic_helper_check_modeset(dev, state);
-	if (ret)
-		return ret;
-
-	ret = drm_atomic_normalize_zpos(dev, state);
-	if (ret)
-		return ret;
-
-	ret = drm_atomic_helper_check_planes(dev, state);
-	if (ret)
-		return ret;
-
-	return ret;
-}
-
 static int exynos_drm_open(struct drm_device *dev, struct drm_file *file)
 {
 	struct drm_exynos_file_private *file_priv;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index df2262f70d91..075957cb6ba1 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -275,7 +275,6 @@ static inline int exynos_dpi_bind(struct drm_device *dev,
 
 int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state,
 			 bool nonblock);
-int exynos_atomic_check(struct drm_device *dev, struct drm_atomic_state *state);
 
 
 extern struct platform_driver fimd_driver;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index 0faaf829f5bf..2379d732da67 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -206,7 +206,7 @@ static struct drm_mode_config_helper_funcs exynos_drm_mode_config_helpers = {
 static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = {
 	.fb_create = exynos_user_fb_create,
 	.output_poll_changed = drm_fb_helper_output_poll_changed,
-	.atomic_check = exynos_atomic_check,
+	.atomic_check = drm_atomic_helper_check,
 	.atomic_commit = drm_atomic_helper_commit,
 };
 
@@ -227,4 +227,6 @@ void exynos_drm_mode_config_init(struct drm_device *dev)
 	dev->mode_config.helper_private = &exynos_drm_mode_config_helpers;
 
 	dev->mode_config.allow_fb_modifiers = true;
+
+	dev->mode_config.normalize_zpos = true;
 }
-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 3/6] drm/tegra: Let core take care of normalizing the zpos
  2018-01-25 14:26 [PATCH v3 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
  2018-01-25 14:26 ` [PATCH v3 1/6] drm: Add drm_mode_config->normalize_zpos boolean Peter Ujfalusi
  2018-01-25 14:26 ` [PATCH v3 2/6] drm/exynos: Let core take care of normalizing the zpos Peter Ujfalusi
@ 2018-01-25 14:26 ` Peter Ujfalusi
  2018-01-25 14:26 ` [PATCH v3 4/6] drm/sti: " Peter Ujfalusi
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Peter Ujfalusi @ 2018-01-25 14:26 UTC (permalink / raw)
  To: laurent.pinchart, daniel, airlied
  Cc: tomi.valkeinen, Thierry Reding, dri-devel

Instead of re-implementing the drm_atomic_helper_check() locally with just
adding drm_atomic_normalize_zpos() into it, set the
drm_mode_config->normalize_zpos.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Thierry Reding <thierry.reding@gmail.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/tegra/drm.c | 27 +++------------------------
 1 file changed, 3 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index d50bddb2e447..037c79d9c6fd 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -33,29 +33,6 @@ struct tegra_drm_file {
 	struct mutex lock;
 };
 
-static int tegra_atomic_check(struct drm_device *drm,
-			      struct drm_atomic_state *state)
-{
-	int err;
-
-	err = drm_atomic_helper_check_modeset(drm, state);
-	if (err < 0)
-		return err;
-
-	err = drm_atomic_normalize_zpos(drm, state);
-	if (err < 0)
-		return err;
-
-	err = drm_atomic_helper_check_planes(drm, state);
-	if (err < 0)
-		return err;
-
-	if (state->legacy_cursor_update)
-		state->async_update = !drm_atomic_helper_async_check(drm, state);
-
-	return 0;
-}
-
 static struct drm_atomic_state *
 tegra_atomic_state_alloc(struct drm_device *drm)
 {
@@ -90,7 +67,7 @@ static const struct drm_mode_config_funcs tegra_drm_mode_config_funcs = {
 #ifdef CONFIG_DRM_FBDEV_EMULATION
 	.output_poll_changed = drm_fb_helper_output_poll_changed,
 #endif
-	.atomic_check = tegra_atomic_check,
+	.atomic_check = drm_atomic_helper_check,
 	.atomic_commit = drm_atomic_helper_commit,
 	.atomic_state_alloc = tegra_atomic_state_alloc,
 	.atomic_state_clear = tegra_atomic_state_clear,
@@ -179,6 +156,8 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
 
 	drm->mode_config.allow_fb_modifiers = true;
 
+	drm->mode_config.normalize_zpos = true;
+
 	drm->mode_config.funcs = &tegra_drm_mode_config_funcs;
 	drm->mode_config.helper_private = &tegra_drm_mode_config_helpers;
 
-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 4/6] drm/sti: Let core take care of normalizing the zpos
  2018-01-25 14:26 [PATCH v3 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
                   ` (2 preceding siblings ...)
  2018-01-25 14:26 ` [PATCH v3 3/6] drm/tegra: " Peter Ujfalusi
@ 2018-01-25 14:26 ` Peter Ujfalusi
  2018-01-25 14:26 ` [PATCH v3 5/6] drm: rcar-du: " Peter Ujfalusi
  2018-01-25 14:26 ` [PATCH v3 6/6] drm/omap: Use normalized zpos for plane placement Peter Ujfalusi
  5 siblings, 0 replies; 13+ messages in thread
From: Peter Ujfalusi @ 2018-01-25 14:26 UTC (permalink / raw)
  To: laurent.pinchart, daniel, airlied
  Cc: tomi.valkeinen, Vincent Abriou, dri-devel

Instead of re-implementing the drm_atomic_helper_check() locally with just
adding drm_atomic_normalize_zpos() into it, set the
drm_mode_config->normalize_zpos.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Benjamin Gaignard <benjamin.gaignard@linaro.org>
CC: Vincent Abriou <vincent.abriou@st.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
---
 drivers/gpu/drm/sti/sti_drv.c | 24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 55b6967d27e1..90c46b49c931 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -119,30 +119,10 @@ static int sti_drm_dbg_init(struct drm_minor *minor)
 	return ret;
 }
 
-static int sti_atomic_check(struct drm_device *dev,
-			    struct drm_atomic_state *state)
-{
-	int ret;
-
-	ret = drm_atomic_helper_check_modeset(dev, state);
-	if (ret)
-		return ret;
-
-	ret = drm_atomic_normalize_zpos(dev, state);
-	if (ret)
-		return ret;
-
-	ret = drm_atomic_helper_check_planes(dev, state);
-	if (ret)
-		return ret;
-
-	return ret;
-}
-
 static const struct drm_mode_config_funcs sti_mode_config_funcs = {
 	.fb_create = drm_gem_fb_create,
 	.output_poll_changed = drm_fb_helper_output_poll_changed,
-	.atomic_check = sti_atomic_check,
+	.atomic_check = drm_atomic_helper_check,
 	.atomic_commit = drm_atomic_helper_commit,
 };
 
@@ -160,6 +140,8 @@ static void sti_mode_config_init(struct drm_device *dev)
 	dev->mode_config.max_height = STI_MAX_FB_HEIGHT;
 
 	dev->mode_config.funcs = &sti_mode_config_funcs;
+
+	dev->mode_config.normalize_zpos = true;
 }
 
 DEFINE_DRM_GEM_CMA_FOPS(sti_driver_fops);
-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 5/6] drm: rcar-du: Let core take care of normalizing the zpos
  2018-01-25 14:26 [PATCH v3 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
                   ` (3 preceding siblings ...)
  2018-01-25 14:26 ` [PATCH v3 4/6] drm/sti: " Peter Ujfalusi
@ 2018-01-25 14:26 ` Peter Ujfalusi
  2018-01-25 14:26 ` [PATCH v3 6/6] drm/omap: Use normalized zpos for plane placement Peter Ujfalusi
  5 siblings, 0 replies; 13+ messages in thread
From: Peter Ujfalusi @ 2018-01-25 14:26 UTC (permalink / raw)
  To: laurent.pinchart, daniel, airlied; +Cc: tomi.valkeinen, dri-devel

Set the drm_mode_config->normalize_zpos and call drm_atomic_helper_check()
from rcar_du_atomic_check() instead of re implementing the function locally.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/rcar-du/rcar_du_kms.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index 566d1a948c8f..384f98aa4ca3 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -234,15 +234,7 @@ static int rcar_du_atomic_check(struct drm_device *dev,
 	struct rcar_du_device *rcdu = dev->dev_private;
 	int ret;
 
-	ret = drm_atomic_helper_check_modeset(dev, state);
-	if (ret)
-		return ret;
-
-	ret = drm_atomic_normalize_zpos(dev, state);
-	if (ret)
-		return ret;
-
-	ret = drm_atomic_helper_check_planes(dev, state);
+	ret = drm_atomic_helper_check(dev, state);
 	if (ret)
 		return ret;
 
@@ -531,6 +523,7 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
 	dev->mode_config.min_height = 0;
 	dev->mode_config.max_width = 4095;
 	dev->mode_config.max_height = 2047;
+	dev->mode_config.normalize_zpos = true;
 	dev->mode_config.funcs = &rcar_du_mode_config_funcs;
 	dev->mode_config.helper_private = &rcar_du_mode_config_helper;
 
-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 6/6] drm/omap: Use normalized zpos for plane placement
  2018-01-25 14:26 [PATCH v3 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
                   ` (4 preceding siblings ...)
  2018-01-25 14:26 ` [PATCH v3 5/6] drm: rcar-du: " Peter Ujfalusi
@ 2018-01-25 14:26 ` Peter Ujfalusi
  5 siblings, 0 replies; 13+ messages in thread
From: Peter Ujfalusi @ 2018-01-25 14:26 UTC (permalink / raw)
  To: laurent.pinchart, daniel, airlied; +Cc: tomi.valkeinen, dri-devel

Planes with identical zpos value will result undefined behavior:
disappearing planes, screen flickering and it is not supported by the
hardware.

Use normalized zpos to make sure that we don't encounter invalid
configuration.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Tomi Valkeinen <tomi.valkeinen@ti.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/omapdrm/omap_drv.c   | 3 +++
 drivers/gpu/drm/omapdrm/omap_plane.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index dd68b2556f5b..37ee20c773c7 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -316,6 +316,9 @@ static int omap_modeset_init(struct drm_device *dev)
 	dev->mode_config.max_width = 2048;
 	dev->mode_config.max_height = 2048;
 
+	/* We want the zpos to be normalized */
+	dev->mode_config.normalize_zpos = true;
+
 	dev->mode_config.funcs = &omap_mode_config_funcs;
 	dev->mode_config.helper_private = &omap_mode_config_helper_funcs;
 
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index 7d789d1551a1..2c19d2239bc5 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -65,7 +65,7 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
 	info.rotation_type = OMAP_DSS_ROT_NONE;
 	info.rotation = DRM_MODE_ROTATE_0;
 	info.global_alpha = 0xff;
-	info.zorder = state->zpos;
+	info.zorder = state->normalized_zpos;
 
 	/* update scanout: */
 	omap_framebuffer_update_scanout(state->fb, state, &info);
-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/6] drm: Add drm_mode_config->normalize_zpos boolean
  2018-01-25 14:26 ` [PATCH v3 1/6] drm: Add drm_mode_config->normalize_zpos boolean Peter Ujfalusi
@ 2018-01-25 14:40   ` Ville Syrjälä
  2018-01-25 14:51     ` Ville Syrjälä
  2018-01-26  8:25     ` Peter Ujfalusi
  0 siblings, 2 replies; 13+ messages in thread
From: Ville Syrjälä @ 2018-01-25 14:40 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: airlied, dri-devel, tomi.valkeinen, laurent.pinchart

On Thu, Jan 25, 2018 at 04:26:25PM +0200, Peter Ujfalusi wrote:
> Instead of drivers duplicating the drm_atomic_helper_check() code to be
> able to normalize the zpos they can use the normalize_zpos flag to let the
> drm core to do it.
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 11 +++++++++++
>  include/drm/drm_mode_config.h       |  8 ++++++++
>  include/drm/drm_plane.h             |  4 ++--
>  3 files changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index ab4032167094..0f6a4949e6dc 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -873,6 +873,11 @@ EXPORT_SYMBOL(drm_atomic_helper_check_planes);
>   * functions depend upon an updated adjusted_mode.clock to e.g. properly compute
>   * watermarks.
>   *
> + * Note that zpos normalization will add all enable planes to the state which
> + * might not desired for some drivers.
> + * For example enable/disable of a cursor plane which have fixed zpos value
> + * would trigger all other enabled planes to be forced to the state change.
> + *
>   * RETURNS:
>   * Zero for success or -errno
>   */
> @@ -885,6 +890,12 @@ int drm_atomic_helper_check(struct drm_device *dev,
>  	if (ret)
>  		return ret;
>  
> +	if (dev->mode_config.normalize_zpos) {
> +		ret = drm_atomic_normalize_zpos(dev, state);
> +		if (ret)
> +			return ret;
> +	}

I think we originally had this in drm_atomic_helper_check_planes().
Looking through some of the drivers it looks like we could maybe
kill a few more LOC by putting it there.

> +
>  	ret = drm_atomic_helper_check_planes(dev, state);
>  	if (ret)
>  		return ret;
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 2cb6f02df64a..987ab63ae037 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -792,6 +792,14 @@ struct drm_mode_config {
>  	/* cursor size */
>  	uint32_t cursor_width, cursor_height;
>  
> +	/**
> +	 * @normalize_zpos:
> +	 *
> +	 * If true the drm core will call drm_atomic_normalize_zpos() as part of
> +	 * atomic mode checking from drm_atomic_helper_check()
> +	 */
> +	bool normalize_zpos;
> +

Can we pack it next to some other bools to try and keep the struct
size down?

>  	/**
>  	 * @suspend_state:
>  	 *
> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index 8185e3468a23..2c0adb124e0f 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -50,8 +50,8 @@ struct drm_modeset_acquire_ctx;
>   *	plane with a lower ID.
>   * @normalized_zpos: normalized value of zpos: unique, range from 0 to N-1
>   *	where N is the number of active planes for given crtc. Note that
> - *	the driver must call drm_atomic_normalize_zpos() to update this before
> - *	it can be trusted.
> + *	the driver must set drm_mode_config.normalize_zpos or call
> + *	drm_atomic_normalize_zpos() to update this before it can be trusted.
>   * @src: clipped source coordinates of the plane (in 16.16)
>   * @dst: clipped destination coordinates of the plane
>   * @state: backpointer to global drm_atomic_state
> -- 
> Peter
> 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/6] drm: Add drm_mode_config->normalize_zpos boolean
  2018-01-25 14:40   ` Ville Syrjälä
@ 2018-01-25 14:51     ` Ville Syrjälä
  2018-01-26  9:29       ` Peter Ujfalusi
  2018-01-26  8:25     ` Peter Ujfalusi
  1 sibling, 1 reply; 13+ messages in thread
From: Ville Syrjälä @ 2018-01-25 14:51 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: airlied, dri-devel, tomi.valkeinen, laurent.pinchart

On Thu, Jan 25, 2018 at 04:40:48PM +0200, Ville Syrjälä wrote:
> On Thu, Jan 25, 2018 at 04:26:25PM +0200, Peter Ujfalusi wrote:
> > Instead of drivers duplicating the drm_atomic_helper_check() code to be
> > able to normalize the zpos they can use the normalize_zpos flag to let the
> > drm core to do it.
> > 
> > Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> > ---
> >  drivers/gpu/drm/drm_atomic_helper.c | 11 +++++++++++
> >  include/drm/drm_mode_config.h       |  8 ++++++++
> >  include/drm/drm_plane.h             |  4 ++--
> >  3 files changed, 21 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > index ab4032167094..0f6a4949e6dc 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -873,6 +873,11 @@ EXPORT_SYMBOL(drm_atomic_helper_check_planes);
> >   * functions depend upon an updated adjusted_mode.clock to e.g. properly compute
> >   * watermarks.
> >   *
> > + * Note that zpos normalization will add all enable planes to the state which
> > + * might not desired for some drivers.
> > + * For example enable/disable of a cursor plane which have fixed zpos value
> > + * would trigger all other enabled planes to be forced to the state change.
> > + *
> >   * RETURNS:
> >   * Zero for success or -errno
> >   */
> > @@ -885,6 +890,12 @@ int drm_atomic_helper_check(struct drm_device *dev,
> >  	if (ret)
> >  		return ret;
> >  
> > +	if (dev->mode_config.normalize_zpos) {
> > +		ret = drm_atomic_normalize_zpos(dev, state);
> > +		if (ret)
> > +			return ret;
> > +	}
> 
> I think we originally had this in drm_atomic_helper_check_planes().
> Looking through some of the drivers it looks like we could maybe
> kill a few more LOC by putting it there.

Actually, I guess it's fine as is. I though the "async" flip thing I
saw in some of the drivers wasn't in the atomic helper. But it is
there.

That actually makes me slightly worried whether it's safe to just
blindly replace the hand rolled stuff w/o "async" with
drm_atomic_helper_check(). The commit messages should perhaps
justify that somehow.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/6] drm: Add drm_mode_config->normalize_zpos boolean
  2018-01-25 14:40   ` Ville Syrjälä
  2018-01-25 14:51     ` Ville Syrjälä
@ 2018-01-26  8:25     ` Peter Ujfalusi
  1 sibling, 0 replies; 13+ messages in thread
From: Peter Ujfalusi @ 2018-01-26  8:25 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: airlied, dri-devel, tomi.valkeinen, laurent.pinchart



On 2018-01-25 16:40, Ville Syrjälä wrote:
> On Thu, Jan 25, 2018 at 04:26:25PM +0200, Peter Ujfalusi wrote:
>> Instead of drivers duplicating the drm_atomic_helper_check() code to be
>> able to normalize the zpos they can use the normalize_zpos flag to let the
>> drm core to do it.
>>
>> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
>> ---
>>  drivers/gpu/drm/drm_atomic_helper.c | 11 +++++++++++
>>  include/drm/drm_mode_config.h       |  8 ++++++++
>>  include/drm/drm_plane.h             |  4 ++--
>>  3 files changed, 21 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
>> index ab4032167094..0f6a4949e6dc 100644
>> --- a/drivers/gpu/drm/drm_atomic_helper.c
>> +++ b/drivers/gpu/drm/drm_atomic_helper.c
>> @@ -873,6 +873,11 @@ EXPORT_SYMBOL(drm_atomic_helper_check_planes);
>>   * functions depend upon an updated adjusted_mode.clock to e.g. properly compute
>>   * watermarks.
>>   *
>> + * Note that zpos normalization will add all enable planes to the state which
>> + * might not desired for some drivers.
>> + * For example enable/disable of a cursor plane which have fixed zpos value
>> + * would trigger all other enabled planes to be forced to the state change.
>> + *
>>   * RETURNS:
>>   * Zero for success or -errno
>>   */
>> @@ -885,6 +890,12 @@ int drm_atomic_helper_check(struct drm_device *dev,
>>  	if (ret)
>>  		return ret;
>>  
>> +	if (dev->mode_config.normalize_zpos) {
>> +		ret = drm_atomic_normalize_zpos(dev, state);
>> +		if (ret)
>> +			return ret;
>> +	}
> 
> I think we originally had this in drm_atomic_helper_check_planes().
> Looking through some of the drivers it looks like we could maybe
> kill a few more LOC by putting it there.

Yes, it was. Then removed and the function was duplicated in several
drivers. With this change it is moved back, but kept as optional to
avoid issues with drivers do not using the drm_atomic_normalize_zpos()

> 
>> +
>>  	ret = drm_atomic_helper_check_planes(dev, state);
>>  	if (ret)
>>  		return ret;
>> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
>> index 2cb6f02df64a..987ab63ae037 100644
>> --- a/include/drm/drm_mode_config.h
>> +++ b/include/drm/drm_mode_config.h
>> @@ -792,6 +792,14 @@ struct drm_mode_config {
>>  	/* cursor size */
>>  	uint32_t cursor_width, cursor_height;
>>  
>> +	/**
>> +	 * @normalize_zpos:
>> +	 *
>> +	 * If true the drm core will call drm_atomic_normalize_zpos() as part of
>> +	 * atomic mode checking from drm_atomic_helper_check()
>> +	 */
>> +	bool normalize_zpos;
>> +
> 
> Can we pack it next to some other bools to try and keep the struct
> size down?

Sure, I'll move it.

> 
>>  	/**
>>  	 * @suspend_state:
>>  	 *
>> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
>> index 8185e3468a23..2c0adb124e0f 100644
>> --- a/include/drm/drm_plane.h
>> +++ b/include/drm/drm_plane.h
>> @@ -50,8 +50,8 @@ struct drm_modeset_acquire_ctx;
>>   *	plane with a lower ID.
>>   * @normalized_zpos: normalized value of zpos: unique, range from 0 to N-1
>>   *	where N is the number of active planes for given crtc. Note that
>> - *	the driver must call drm_atomic_normalize_zpos() to update this before
>> - *	it can be trusted.
>> + *	the driver must set drm_mode_config.normalize_zpos or call
>> + *	drm_atomic_normalize_zpos() to update this before it can be trusted.
>>   * @src: clipped source coordinates of the plane (in 16.16)
>>   * @dst: clipped destination coordinates of the plane
>>   * @state: backpointer to global drm_atomic_state
>> -- 
>> Peter
>>
>> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
>> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/6] drm: Add drm_mode_config->normalize_zpos boolean
  2018-01-25 14:51     ` Ville Syrjälä
@ 2018-01-26  9:29       ` Peter Ujfalusi
  2018-01-26 16:43         ` Ville Syrjälä
  0 siblings, 1 reply; 13+ messages in thread
From: Peter Ujfalusi @ 2018-01-26  9:29 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: airlied, tomi.valkeinen, laurent.pinchart, dri-devel

Ville,

On 2018-01-25 16:51, Ville Syrjälä wrote:
> On Thu, Jan 25, 2018 at 04:40:48PM +0200, Ville Syrjälä wrote:
>> On Thu, Jan 25, 2018 at 04:26:25PM +0200, Peter Ujfalusi wrote:
>>> Instead of drivers duplicating the drm_atomic_helper_check() code to be
>>> able to normalize the zpos they can use the normalize_zpos flag to let the
>>> drm core to do it.
>>>
>>> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
>>> ---
>>>  drivers/gpu/drm/drm_atomic_helper.c | 11 +++++++++++
>>>  include/drm/drm_mode_config.h       |  8 ++++++++
>>>  include/drm/drm_plane.h             |  4 ++--
>>>  3 files changed, 21 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
>>> index ab4032167094..0f6a4949e6dc 100644
>>> --- a/drivers/gpu/drm/drm_atomic_helper.c
>>> +++ b/drivers/gpu/drm/drm_atomic_helper.c
>>> @@ -873,6 +873,11 @@ EXPORT_SYMBOL(drm_atomic_helper_check_planes);
>>>   * functions depend upon an updated adjusted_mode.clock to e.g. properly compute
>>>   * watermarks.
>>>   *
>>> + * Note that zpos normalization will add all enable planes to the state which
>>> + * might not desired for some drivers.
>>> + * For example enable/disable of a cursor plane which have fixed zpos value
>>> + * would trigger all other enabled planes to be forced to the state change.
>>> + *
>>>   * RETURNS:
>>>   * Zero for success or -errno
>>>   */
>>> @@ -885,6 +890,12 @@ int drm_atomic_helper_check(struct drm_device *dev,
>>>  	if (ret)
>>>  		return ret;
>>>  
>>> +	if (dev->mode_config.normalize_zpos) {
>>> +		ret = drm_atomic_normalize_zpos(dev, state);
>>> +		if (ret)
>>> +			return ret;
>>> +	}
>>
>> I think we originally had this in drm_atomic_helper_check_planes().
>> Looking through some of the drivers it looks like we could maybe
>> kill a few more LOC by putting it there.
> 
> Actually, I guess it's fine as is. I though the "async" flip thing I
> saw in some of the drivers wasn't in the atomic helper. But it is
> there.
> 
> That actually makes me slightly worried whether it's safe to just
> blindly replace the hand rolled stuff w/o "async" with
> drm_atomic_helper_check(). The commit messages should perhaps
> justify that somehow.

I only changed 'hand rolled' stuff in the drivers where the local
.atomic_check implementation is the same as the
drm_atomic_helper_check() or in case of rcar-du, where I removed the
drm_atomic_helper_check() part from the custom callback and let it call
the function itself.

I'm not sure if I understand the problem. This series does the following
in essence:

drm_atomic_helper_check(...)
{
	/* does A */
}

driver_hand_rolled_atomic_helper_check(...)
{
	/* does A */
}

- .atomic_check = driver_hand_rolled_atomic_helper_check,
+ .atomic_check = drm_atomic_helper_check,

I'm most likely missing something, but not sure what.

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/6] drm: Add drm_mode_config->normalize_zpos boolean
  2018-01-26  9:29       ` Peter Ujfalusi
@ 2018-01-26 16:43         ` Ville Syrjälä
  2018-01-30  7:54           ` Peter Ujfalusi
  0 siblings, 1 reply; 13+ messages in thread
From: Ville Syrjälä @ 2018-01-26 16:43 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: airlied, tomi.valkeinen, laurent.pinchart, dri-devel

On Fri, Jan 26, 2018 at 11:29:03AM +0200, Peter Ujfalusi wrote:
> Ville,
> 
> On 2018-01-25 16:51, Ville Syrjälä wrote:
> > On Thu, Jan 25, 2018 at 04:40:48PM +0200, Ville Syrjälä wrote:
> >> On Thu, Jan 25, 2018 at 04:26:25PM +0200, Peter Ujfalusi wrote:
> >>> Instead of drivers duplicating the drm_atomic_helper_check() code to be
> >>> able to normalize the zpos they can use the normalize_zpos flag to let the
> >>> drm core to do it.
> >>>
> >>> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> >>> ---
> >>>  drivers/gpu/drm/drm_atomic_helper.c | 11 +++++++++++
> >>>  include/drm/drm_mode_config.h       |  8 ++++++++
> >>>  include/drm/drm_plane.h             |  4 ++--
> >>>  3 files changed, 21 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> >>> index ab4032167094..0f6a4949e6dc 100644
> >>> --- a/drivers/gpu/drm/drm_atomic_helper.c
> >>> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> >>> @@ -873,6 +873,11 @@ EXPORT_SYMBOL(drm_atomic_helper_check_planes);
> >>>   * functions depend upon an updated adjusted_mode.clock to e.g. properly compute
> >>>   * watermarks.
> >>>   *
> >>> + * Note that zpos normalization will add all enable planes to the state which
> >>> + * might not desired for some drivers.
> >>> + * For example enable/disable of a cursor plane which have fixed zpos value
> >>> + * would trigger all other enabled planes to be forced to the state change.
> >>> + *
> >>>   * RETURNS:
> >>>   * Zero for success or -errno
> >>>   */
> >>> @@ -885,6 +890,12 @@ int drm_atomic_helper_check(struct drm_device *dev,
> >>>  	if (ret)
> >>>  		return ret;
> >>>  
> >>> +	if (dev->mode_config.normalize_zpos) {
> >>> +		ret = drm_atomic_normalize_zpos(dev, state);
> >>> +		if (ret)
> >>> +			return ret;
> >>> +	}
> >>
> >> I think we originally had this in drm_atomic_helper_check_planes().
> >> Looking through some of the drivers it looks like we could maybe
> >> kill a few more LOC by putting it there.
> > 
> > Actually, I guess it's fine as is. I though the "async" flip thing I
> > saw in some of the drivers wasn't in the atomic helper. But it is
> > there.
> > 
> > That actually makes me slightly worried whether it's safe to just
> > blindly replace the hand rolled stuff w/o "async" with
> > drm_atomic_helper_check(). The commit messages should perhaps
> > justify that somehow.
> 
> I only changed 'hand rolled' stuff in the drivers where the local
> .atomic_check implementation is the same as the
> drm_atomic_helper_check() or in case of rcar-du, where I removed the
> drm_atomic_helper_check() part from the custom callback and let it call
> the function itself.
> 
> I'm not sure if I understand the problem. This series does the following
> in essence:
> 
> drm_atomic_helper_check(...)
> {
> 	/* does A */
> }
> 
> driver_hand_rolled_atomic_helper_check(...)
> {
> 	/* does A */
> }
> 
> - .atomic_check = driver_hand_rolled_atomic_helper_check,
> + .atomic_check = drm_atomic_helper_check,
> 
> I'm most likely missing something, but not sure what.

The 

if (state->legacy_cursor_update)
	state->async_update = !drm_atomic_helper_async_check(drm, state);

part.

The helper has it, as does tegra, but sti does not. Would be nice to
have something in the comment message documenting why it's safe to add
it to sti and other drivers that didn't already have it.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 1/6] drm: Add drm_mode_config->normalize_zpos boolean
  2018-01-26 16:43         ` Ville Syrjälä
@ 2018-01-30  7:54           ` Peter Ujfalusi
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Ujfalusi @ 2018-01-30  7:54 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: airlied, tomi.valkeinen, laurent.pinchart, dri-devel

Ville,

On 2018-01-26 18:43, Ville Syrjälä wrote:
>> I'm not sure if I understand the problem. This series does the following
>> in essence:
>>
>> drm_atomic_helper_check(...)
>> {
>> 	/* does A */
>> }
>>
>> driver_hand_rolled_atomic_helper_check(...)
>> {
>> 	/* does A */
>> }
>>
>> - .atomic_check = driver_hand_rolled_atomic_helper_check,
>> + .atomic_check = drm_atomic_helper_check,
>>
>> I'm most likely missing something, but not sure what.
> 
> The 
> 
> if (state->legacy_cursor_update)
> 	state->async_update = !drm_atomic_helper_async_check(drm, state);
> 
> part.

Yes, you are right. this part is missing from the hand rolled
atomic_check function in the drivers I'm touching in this series.

The reason for that is that they all got their atomic_check function
copied from the core before the legacy_cursor_update check and async
check is added. Drivers just 'left behind' by not getting the same change.

Which might or might not cause issues for them, but it is still better
to use common code as much as possible to have consistent way of working
among the DRM drivers.

> The helper has it, as does tegra, but sti does not. Would be nice to
> have something in the comment message documenting why it's safe to add
> it to sti and other drivers that didn't already have it.

I purposefully created separate patches for the drivers so the change
can be reverted easier.

I can add to the commit message for the drivers something like:

Note: the drm_atomic_helper_check() now includes

if (state->legacy_cursor_update)
	state->async_update = !drm_atomic_helper_async_check(drm, state);

which was added after the driver moved away from using it
(38d868e41c4b9250d5a115c049dc2d48f4909581 drm: Don't force all planes to
be added to the state due to zpos)

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-01-30  7:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-25 14:26 [PATCH v3 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
2018-01-25 14:26 ` [PATCH v3 1/6] drm: Add drm_mode_config->normalize_zpos boolean Peter Ujfalusi
2018-01-25 14:40   ` Ville Syrjälä
2018-01-25 14:51     ` Ville Syrjälä
2018-01-26  9:29       ` Peter Ujfalusi
2018-01-26 16:43         ` Ville Syrjälä
2018-01-30  7:54           ` Peter Ujfalusi
2018-01-26  8:25     ` Peter Ujfalusi
2018-01-25 14:26 ` [PATCH v3 2/6] drm/exynos: Let core take care of normalizing the zpos Peter Ujfalusi
2018-01-25 14:26 ` [PATCH v3 3/6] drm/tegra: " Peter Ujfalusi
2018-01-25 14:26 ` [PATCH v3 4/6] drm/sti: " Peter Ujfalusi
2018-01-25 14:26 ` [PATCH v3 5/6] drm: rcar-du: " Peter Ujfalusi
2018-01-25 14:26 ` [PATCH v3 6/6] drm/omap: Use normalized zpos for plane placement Peter Ujfalusi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.