@@ -1000,26 +1000,25 @@ void drm_encoder_cleanup(struct drm_encoder *encoder)
1000
1000
EXPORT_SYMBOL (drm_encoder_cleanup );
1001
1001
1002
1002
/**
1003
- * drm_plane_init - Initialise a new plane object
1003
+ * drm_universal_plane_init - Initialize a new universal plane object
1004
1004
* @dev: DRM device
1005
1005
* @plane: plane object to init
1006
1006
* @possible_crtcs: bitmask of possible CRTCs
1007
1007
* @funcs: callbacks for the new plane
1008
1008
* @formats: array of supported formats (%DRM_FORMAT_*)
1009
1009
* @format_count: number of elements in @formats
1010
- * @priv: plane is private (hidden from userspace)?
1010
+ * @type: type of plane (overlay, primary, cursor)
1011
1011
*
1012
- * Inits a preallocate plane object created as base part of a driver plane
1013
- * object.
1012
+ * Initializes a plane object of type @type.
1014
1013
*
1015
1014
* Returns:
1016
1015
* Zero on success, error code on failure.
1017
1016
*/
1018
- int drm_plane_init (struct drm_device * dev , struct drm_plane * plane ,
1019
- unsigned long possible_crtcs ,
1020
- const struct drm_plane_funcs * funcs ,
1021
- const uint32_t * formats , uint32_t format_count ,
1022
- bool priv )
1017
+ int drm_universal_plane_init (struct drm_device * dev , struct drm_plane * plane ,
1018
+ unsigned long possible_crtcs ,
1019
+ const struct drm_plane_funcs * funcs ,
1020
+ const uint32_t * formats , uint32_t format_count ,
1021
+ enum drm_plane_type type )
1023
1022
{
1024
1023
int ret ;
1025
1024
@@ -1044,26 +1043,49 @@ int drm_plane_init(struct drm_device *dev, struct drm_plane *plane,
1044
1043
memcpy (plane -> format_types , formats , format_count * sizeof (uint32_t ));
1045
1044
plane -> format_count = format_count ;
1046
1045
plane -> possible_crtcs = possible_crtcs ;
1047
- plane -> type = DRM_PLANE_TYPE_OVERLAY ;
1046
+ plane -> type = type ;
1048
1047
1049
- /* private planes are not exposed to userspace, but depending on
1050
- * display hardware, might be convenient to allow sharing programming
1051
- * for the scanout engine with the crtc implementation.
1052
- */
1053
- if (!priv ) {
1054
- list_add_tail (& plane -> head , & dev -> mode_config .plane_list );
1055
- dev -> mode_config .num_total_plane ++ ;
1056
- if (plane -> type == DRM_PLANE_TYPE_OVERLAY )
1057
- dev -> mode_config .num_overlay_plane ++ ;
1058
- } else {
1059
- INIT_LIST_HEAD (& plane -> head );
1060
- }
1048
+ list_add_tail (& plane -> head , & dev -> mode_config .plane_list );
1049
+ dev -> mode_config .num_total_plane ++ ;
1050
+ if (plane -> type == DRM_PLANE_TYPE_OVERLAY )
1051
+ dev -> mode_config .num_overlay_plane ++ ;
1061
1052
1062
1053
out :
1063
1054
drm_modeset_unlock_all (dev );
1064
1055
1065
1056
return ret ;
1066
1057
}
1058
+ EXPORT_SYMBOL (drm_universal_plane_init );
1059
+
1060
+ /**
1061
+ * drm_plane_init - Initialize a legacy plane
1062
+ * @dev: DRM device
1063
+ * @plane: plane object to init
1064
+ * @possible_crtcs: bitmask of possible CRTCs
1065
+ * @funcs: callbacks for the new plane
1066
+ * @formats: array of supported formats (%DRM_FORMAT_*)
1067
+ * @format_count: number of elements in @formats
1068
+ * @is_primary: plane type (primary vs overlay)
1069
+ *
1070
+ * Legacy API to initialize a DRM plane.
1071
+ *
1072
+ * New drivers should call drm_universal_plane_init() instead.
1073
+ *
1074
+ * Returns:
1075
+ * Zero on success, error code on failure.
1076
+ */
1077
+ int drm_plane_init (struct drm_device * dev , struct drm_plane * plane ,
1078
+ unsigned long possible_crtcs ,
1079
+ const struct drm_plane_funcs * funcs ,
1080
+ const uint32_t * formats , uint32_t format_count ,
1081
+ bool is_primary )
1082
+ {
1083
+ enum drm_plane_type type ;
1084
+
1085
+ type = is_primary ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY ;
1086
+ return drm_universal_plane_init (dev , plane , possible_crtcs , funcs ,
1087
+ formats , format_count , type );
1088
+ }
1067
1089
EXPORT_SYMBOL (drm_plane_init );
1068
1090
1069
1091
/**
@@ -1081,13 +1103,13 @@ void drm_plane_cleanup(struct drm_plane *plane)
1081
1103
drm_modeset_lock_all (dev );
1082
1104
kfree (plane -> format_types );
1083
1105
drm_mode_object_put (dev , & plane -> base );
1084
- /* if not added to a list, it must be a private plane */
1085
- if (! list_empty (& plane -> head )) {
1086
- list_del ( & plane -> head );
1087
- dev -> mode_config . num_total_plane -- ;
1088
- if ( plane -> type == DRM_PLANE_TYPE_OVERLAY )
1089
- dev -> mode_config . num_overlay_plane -- ;
1090
- }
1106
+
1107
+ BUG_ON ( list_empty (& plane -> head ));
1108
+
1109
+ list_del ( & plane -> head ) ;
1110
+ dev -> mode_config . num_total_plane -- ;
1111
+ if ( plane -> type == DRM_PLANE_TYPE_OVERLAY )
1112
+ dev -> mode_config . num_overlay_plane -- ;
1091
1113
drm_modeset_unlock_all (dev );
1092
1114
}
1093
1115
EXPORT_SYMBOL (drm_plane_cleanup );
0 commit comments