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

Hi,

Changes since v3:
- Moved the new normalize_zpos bool to be around another bools
- Extended the commit message for sti that the drm_atomic_helper_check() is
  going to ask for async_update due to the legacy cursor usage.

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] 12+ messages in thread

* [PATCH v4 1/6] drm: Add drm_mode_config->normalize_zpos boolean
  2018-02-06 12:05 [PATCH v4 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
@ 2018-02-06 12:05 ` Peter Ujfalusi
  2018-02-06 12:05 ` [PATCH v4 2/6] drm/exynos: Let core take care of normalizing the zpos Peter Ujfalusi
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Peter Ujfalusi @ 2018-02-06 12:05 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..0743c01b9f69 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -783,6 +783,14 @@ struct drm_mode_config {
 	 */
 	bool allow_fb_modifiers;
 
+	/**
+	 * @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;
+
 	/**
 	 * @modifiers_property: Plane property to list support modifier/format
 	 * combination.
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] 12+ messages in thread

* [PATCH v4 2/6] drm/exynos: Let core take care of normalizing the zpos
  2018-02-06 12:05 [PATCH v4 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
  2018-02-06 12:05 ` [PATCH v4 1/6] drm: Add drm_mode_config->normalize_zpos boolean Peter Ujfalusi
@ 2018-02-06 12:05 ` Peter Ujfalusi
  2018-02-06 12:05 ` [PATCH v4 3/6] drm/tegra: " Peter Ujfalusi
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Peter Ujfalusi @ 2018-02-06 12:05 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] 12+ messages in thread

* [PATCH v4 3/6] drm/tegra: Let core take care of normalizing the zpos
  2018-02-06 12:05 [PATCH v4 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
  2018-02-06 12:05 ` [PATCH v4 1/6] drm: Add drm_mode_config->normalize_zpos boolean Peter Ujfalusi
  2018-02-06 12:05 ` [PATCH v4 2/6] drm/exynos: Let core take care of normalizing the zpos Peter Ujfalusi
@ 2018-02-06 12:05 ` Peter Ujfalusi
  2018-02-06 12:05 ` [PATCH v4 4/6] drm/sti: " Peter Ujfalusi
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Peter Ujfalusi @ 2018-02-06 12:05 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] 12+ messages in thread

* [PATCH v4 4/6] drm/sti: Let core take care of normalizing the zpos
  2018-02-06 12:05 [PATCH v4 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
                   ` (2 preceding siblings ...)
  2018-02-06 12:05 ` [PATCH v4 3/6] drm/tegra: " Peter Ujfalusi
@ 2018-02-06 12:05 ` Peter Ujfalusi
  2018-02-06 12:05 ` [PATCH v4 5/6] drm: rcar-du: " Peter Ujfalusi
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Peter Ujfalusi @ 2018-02-06 12:05 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.

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)

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] 12+ messages in thread

* [PATCH v4 5/6] drm: rcar-du: Let core take care of normalizing the zpos
  2018-02-06 12:05 [PATCH v4 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
                   ` (3 preceding siblings ...)
  2018-02-06 12:05 ` [PATCH v4 4/6] drm/sti: " Peter Ujfalusi
@ 2018-02-06 12:05 ` Peter Ujfalusi
  2018-02-06 12:05 ` [PATCH v4 6/6] drm/omap: Use normalized zpos for plane placement Peter Ujfalusi
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Peter Ujfalusi @ 2018-02-06 12:05 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] 12+ messages in thread

* [PATCH v4 6/6] drm/omap: Use normalized zpos for plane placement
  2018-02-06 12:05 [PATCH v4 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
                   ` (4 preceding siblings ...)
  2018-02-06 12:05 ` [PATCH v4 5/6] drm: rcar-du: " Peter Ujfalusi
@ 2018-02-06 12:05 ` Peter Ujfalusi
  2018-03-01  7:31   ` Tomi Valkeinen
  2018-03-07  9:18 ` [PATCH v4 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
  2018-03-28  9:30 ` Tomi Valkeinen
  7 siblings, 1 reply; 12+ messages in thread
From: Peter Ujfalusi @ 2018-02-06 12:05 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] 12+ messages in thread

* Re: [PATCH v4 6/6] drm/omap: Use normalized zpos for plane placement
  2018-02-06 12:05 ` [PATCH v4 6/6] drm/omap: Use normalized zpos for plane placement Peter Ujfalusi
@ 2018-03-01  7:31   ` Tomi Valkeinen
  0 siblings, 0 replies; 12+ messages in thread
From: Tomi Valkeinen @ 2018-03-01  7:31 UTC (permalink / raw)
  To: Peter Ujfalusi, laurent.pinchart, daniel, airlied; +Cc: dri-devel

On 06/02/18 14:05, Peter Ujfalusi wrote:
> 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>

Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

 Tomi

-- 
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] 12+ messages in thread

* Re: [PATCH v4 0/6] drm: zpos normalization cleanup and omapdrm to use it
  2018-02-06 12:05 [PATCH v4 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
                   ` (5 preceding siblings ...)
  2018-02-06 12:05 ` [PATCH v4 6/6] drm/omap: Use normalized zpos for plane placement Peter Ujfalusi
@ 2018-03-07  9:18 ` Peter Ujfalusi
  2018-03-28  9:30 ` Tomi Valkeinen
  7 siblings, 0 replies; 12+ messages in thread
From: Peter Ujfalusi @ 2018-03-07  9:18 UTC (permalink / raw)
  To: laurent.pinchart, daniel, airlied; +Cc: tomi.valkeinen, dri-devel

Hi,

On 2018-02-06 14:05, Peter Ujfalusi wrote:
> Hi,
> 
> Changes since v3:
> - Moved the new normalize_zpos bool to be around another bools
> - Extended the commit message for sti that the drm_atomic_helper_check() is
>   going to ask for async_update due to the legacy cursor usage.

I think I have addressed all comments for the v4 and got Acked-by from
Tomi as well.

The series should apply cleanly on drm-next, but I can rebase and resend
if it is required.

Thanks,
- Péter

> 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(-)
> 

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] 12+ messages in thread

* Re: [PATCH v4 0/6] drm: zpos normalization cleanup and omapdrm to use it
  2018-02-06 12:05 [PATCH v4 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
                   ` (6 preceding siblings ...)
  2018-03-07  9:18 ` [PATCH v4 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
@ 2018-03-28  9:30 ` Tomi Valkeinen
  2018-03-28 12:10   ` Peter Ujfalusi
  7 siblings, 1 reply; 12+ messages in thread
From: Tomi Valkeinen @ 2018-03-28  9:30 UTC (permalink / raw)
  To: Peter Ujfalusi, laurent.pinchart, daniel, airlied; +Cc: dri-devel

Hi,

On 06/02/18 14:05, Peter Ujfalusi wrote:
> Hi,
> 
> Changes since v3:
> - Moved the new normalize_zpos bool to be around another bools
> - Extended the commit message for sti that the drm_atomic_helper_check() is
>   going to ask for async_update due to the legacy cursor usage.
> 
> 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()

Thanks. I think this looks fine, I'll push via drm-misc.

 Tomi

-- 
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] 12+ messages in thread

* Re: [PATCH v4 0/6] drm: zpos normalization cleanup and omapdrm to use it
  2018-03-28  9:30 ` Tomi Valkeinen
@ 2018-03-28 12:10   ` Peter Ujfalusi
  2018-03-28 12:13     ` Tomi Valkeinen
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Ujfalusi @ 2018-03-28 12:10 UTC (permalink / raw)
  To: Tomi Valkeinen, laurent.pinchart, daniel, airlied; +Cc: dri-devel



On 2018-03-28 12:30, Tomi Valkeinen wrote:
> Hi,
> 
> On 06/02/18 14:05, Peter Ujfalusi wrote:
>> Hi,
>>
>> Changes since v3:
>> - Moved the new normalize_zpos bool to be around another bools
>> - Extended the commit message for sti that the drm_atomic_helper_check() is
>>   going to ask for async_update due to the legacy cursor usage.
>>
>> 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()
> 
> Thanks. I think this looks fine, I'll push via drm-misc.

There is v5 on the list.

> 
>  Tomi
> 

- 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] 12+ messages in thread

* Re: [PATCH v4 0/6] drm: zpos normalization cleanup and omapdrm to use it
  2018-03-28 12:10   ` Peter Ujfalusi
@ 2018-03-28 12:13     ` Tomi Valkeinen
  0 siblings, 0 replies; 12+ messages in thread
From: Tomi Valkeinen @ 2018-03-28 12:13 UTC (permalink / raw)
  To: Peter Ujfalusi, laurent.pinchart, daniel, airlied; +Cc: dri-devel

On 28/03/18 15:10, Peter Ujfalusi wrote:

>> Thanks. I think this looks fine, I'll push via drm-misc.
> 
> There is v5 on the list.

Yep, that's what I pushed. Somehow I managed to reply to this older
thread...

 Tomi

-- 
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] 12+ messages in thread

end of thread, other threads:[~2018-03-28 12:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-06 12:05 [PATCH v4 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
2018-02-06 12:05 ` [PATCH v4 1/6] drm: Add drm_mode_config->normalize_zpos boolean Peter Ujfalusi
2018-02-06 12:05 ` [PATCH v4 2/6] drm/exynos: Let core take care of normalizing the zpos Peter Ujfalusi
2018-02-06 12:05 ` [PATCH v4 3/6] drm/tegra: " Peter Ujfalusi
2018-02-06 12:05 ` [PATCH v4 4/6] drm/sti: " Peter Ujfalusi
2018-02-06 12:05 ` [PATCH v4 5/6] drm: rcar-du: " Peter Ujfalusi
2018-02-06 12:05 ` [PATCH v4 6/6] drm/omap: Use normalized zpos for plane placement Peter Ujfalusi
2018-03-01  7:31   ` Tomi Valkeinen
2018-03-07  9:18 ` [PATCH v4 0/6] drm: zpos normalization cleanup and omapdrm to use it Peter Ujfalusi
2018-03-28  9:30 ` Tomi Valkeinen
2018-03-28 12:10   ` Peter Ujfalusi
2018-03-28 12:13     ` Tomi Valkeinen

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.