Skip to content

Commit 49efffc

Browse files
Peter Ujfalusitomba
authored andcommitted
drm: Add drm_mode_config->normalize_zpos boolean
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> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180321102029.15248-2-peter.ujfalusi@ti.com
1 parent f439286 commit 49efffc

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

‎drivers/gpu/drm/drm_atomic_helper.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,11 @@ EXPORT_SYMBOL(drm_atomic_helper_check_planes);
875875
* functions depend upon an updated adjusted_mode.clock to e.g. properly compute
876876
* watermarks.
877877
*
878+
* Note that zpos normalization will add all enable planes to the state which
879+
* might not desired for some drivers.
880+
* For example enable/disable of a cursor plane which have fixed zpos value
881+
* would trigger all other enabled planes to be forced to the state change.
882+
*
878883
* RETURNS:
879884
* Zero for success or -errno
880885
*/
@@ -887,6 +892,12 @@ int drm_atomic_helper_check(struct drm_device *dev,
887892
if (ret)
888893
return ret;
889894

895+
if (dev->mode_config.normalize_zpos) {
896+
ret = drm_atomic_normalize_zpos(dev, state);
897+
if (ret)
898+
return ret;
899+
}
900+
890901
ret = drm_atomic_helper_check_planes(dev, state);
891902
if (ret)
892903
return ret;

‎include/drm/drm_mode_config.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,14 @@ struct drm_mode_config {
795795
*/
796796
bool allow_fb_modifiers;
797797

798+
/**
799+
* @normalize_zpos:
800+
*
801+
* If true the drm core will call drm_atomic_normalize_zpos() as part of
802+
* atomic mode checking from drm_atomic_helper_check()
803+
*/
804+
bool normalize_zpos;
805+
798806
/**
799807
* @modifiers_property: Plane property to list support modifier/format
800808
* combination.

‎include/drm/drm_plane.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ struct drm_modeset_acquire_ctx;
5151
* plane with a lower ID.
5252
* @normalized_zpos: normalized value of zpos: unique, range from 0 to N-1
5353
* where N is the number of active planes for given crtc. Note that
54-
* the driver must call drm_atomic_normalize_zpos() to update this before
55-
* it can be trusted.
54+
* the driver must set drm_mode_config.normalize_zpos or call
55+
* drm_atomic_normalize_zpos() to update this before it can be trusted.
5656
* @src: clipped source coordinates of the plane (in 16.16)
5757
* @dst: clipped destination coordinates of the plane
5858
* @state: backpointer to global drm_atomic_state

0 commit comments

Comments
 (0)