Skip to contentSkip to conversation

drm/plane-helper: Use proper plane init function

PATCH Applied Matt Roper 2 participants 2 messages Jun 30, 2014 – Jul 8, 2014

Subsystems (2)
lore
Share & tools
lore

Matt Roper

author
#0 lore raw

PATCH 1/1 drm/plane-helper: Use proper plane init function

drm_plane_init() (the legacy plane initialization function) takes a bool as its final parameter; originally this indicated whether a plane was 'private' to the driver (before the DRM core understood non-overlay planes), now it indicates whether the plane is a primary plane (private planes were used by some drivers to represent primary planes internally). The newer drm_universal_plane_init() take an 'enum drm_plane_type' as its final parameter to allow the caller to specify the specific plane type desired (primary, cursor, or overlay).

Due to a rebasing mistake, the primary plane helper is currently passing DRM_PLANE_TYPE_PRIMARY (enum value = 1) for drm_plane_init()'s boolean 'is_primary' parameter. This winds up giving the correct behavior since DRM_PLANE_TYPE_PRIMARY evaluates as true, but is confusing to anyone reading the code since we're passing an enum value (one of three possible values) for a boolean parameter.

Replace the primary plane helper's call to drm_plane_init() with drm_universal_plane_init() so that the parameter and value types match up as expected.

---
 drivers/gpu/drm/drm_plane_helper.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_plane_helper.c +4 -3
index 6d13314..827ec1a 100644
@@ -335,9 +335,10 @@ struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev,
 	}
 
 	/* possible_crtc's will be filled in later by crtc_init */
-	ret = drm_plane_init(dev, primary, 0, &drm_primary_helper_funcs,
-			     formats, num_formats,
-			     DRM_PLANE_TYPE_PRIMARY);
+	ret = drm_universal_plane_init(dev, primary, 0,
+				       &drm_primary_helper_funcs,
+				       formats, num_formats,
+				       DRM_PLANE_TYPE_PRIMARY);
 	if (ret) {
 		kfree(primary);
 		primary = NULL;
Signature · 1 line
1.8.5.1
#1 lore raw
Quoted 16 lines · Matt Roper

drm_plane_init() (the legacy plane initialization function) takes a bool as its final parameter; originally this indicated whether a plane was 'private' to the driver (before the DRM core understood non-overlay planes), now it indicates whether the plane is a primary plane (private planes were used by some drivers to represent primary planes internally). The newer drm_universal_plane_init() take an 'enum drm_plane_type' as its final parameter to allow the caller to specify the specific plane type desired (primary, cursor, or overlay).

Due to a rebasing mistake, the primary plane helper is currently passing DRM_PLANE_TYPE_PRIMARY (enum value = 1) for drm_plane_init()'s boolean 'is_primary' parameter. This winds up giving the correct behavior since DRM_PLANE_TYPE_PRIMARY evaluates as true, but is confusing to anyone reading the code since we're passing an enum value (one of three possible values) for a boolean parameter.

Quoted 5 lines

Replace the primary plane helper's call to drm_plane_init() with drm_universal_plane_init() so that the parameter and value types match up as expected.

Applied to topic/core-stuff.
-Daniel

Quoted 29 lines
---
 drivers/gpu/drm/drm_plane_helper.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_plane_helper.c +4 -3
index 6d13314..827ec1a 100644
@@ -335,9 +335,10 @@ struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev,
 	}
 
 	/* possible_crtc's will be filled in later by crtc_init */
-	ret = drm_plane_init(dev, primary, 0, &drm_primary_helper_funcs,
-			     formats, num_formats,
-			     DRM_PLANE_TYPE_PRIMARY);
+	ret = drm_universal_plane_init(dev, primary, 0,
+				       &drm_primary_helper_funcs,
+				       formats, num_formats,
+				       DRM_PLANE_TYPE_PRIMARY);
 	if (ret) {
 		kfree(primary);
 		primary = NULL;
Signature · 6 lines
1.8.5.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch