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.ujfal...@ti.com>
---
 drivers/gpu/drm/drm_atomic_helper.c | 6 ++++++
 include/drm/drm_device.h            | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index ab4032167094..143cab4b2a89 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -885,6 +885,12 @@ int drm_atomic_helper_check(struct drm_device *dev,
        if (ret)
                return ret;
 
+       if (dev->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_device.h b/include/drm/drm_device.h
index 7c4fa32f3fc6..9c45d1155bfd 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -121,6 +121,14 @@ struct drm_device {
         */
        bool vblank_disable_immediate;
 
+       /**
+        * @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;
+
        /**
         * @vblank:
         *
-- 
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

Reply via email to