Skip to content

Commit 9922ab5

Browse files
committed
drm: Add plane type property (v2)
Add a plane type property to allow userspace to distinguish plane types. v2: Driver-specific churn eliminated now that drm_plane_init() and drm_universal_plane_init() were separated out in a previous patch. Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Reviewed-by: Rob Clark <robdclark@gmail.com>
1 parent dc415ff commit 9922ab5

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

drivers/gpu/drm/drm_crtc.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ static const struct drm_prop_enum_list drm_dpms_enum_list[] =
121121

122122
DRM_ENUM_NAME_FN(drm_get_dpms_name, drm_dpms_enum_list)
123123

124+
static const struct drm_prop_enum_list drm_plane_type_enum_list[] =
125+
{
126+
{ DRM_PLANE_TYPE_OVERLAY, "Overlay" },
127+
{ DRM_PLANE_TYPE_PRIMARY, "Primary" },
128+
{ DRM_PLANE_TYPE_CURSOR, "Cursor" },
129+
};
130+
124131
/*
125132
* Optional properties
126133
*/
@@ -1050,6 +1057,10 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
10501057
if (plane->type == DRM_PLANE_TYPE_OVERLAY)
10511058
dev->mode_config.num_overlay_plane++;
10521059

1060+
drm_object_attach_property(&plane->base,
1061+
dev->mode_config.plane_type_property,
1062+
plane->type);
1063+
10531064
out:
10541065
drm_modeset_unlock_all(dev);
10551066

@@ -1161,6 +1172,21 @@ static int drm_mode_create_standard_connector_properties(struct drm_device *dev)
11611172
return 0;
11621173
}
11631174

1175+
static int drm_mode_create_standard_plane_properties(struct drm_device *dev)
1176+
{
1177+
struct drm_property *type;
1178+
1179+
/*
1180+
* Standard properties (apply to all planes)
1181+
*/
1182+
type = drm_property_create_enum(dev, DRM_MODE_PROP_IMMUTABLE,
1183+
"type", drm_plane_type_enum_list,
1184+
ARRAY_SIZE(drm_plane_type_enum_list));
1185+
dev->mode_config.plane_type_property = type;
1186+
1187+
return 0;
1188+
}
1189+
11641190
/**
11651191
* drm_mode_create_dvi_i_properties - create DVI-I specific connector properties
11661192
* @dev: DRM device
@@ -4564,6 +4590,7 @@ void drm_mode_config_init(struct drm_device *dev)
45644590

45654591
drm_modeset_lock_all(dev);
45664592
drm_mode_create_standard_connector_properties(dev);
4593+
drm_mode_create_standard_plane_properties(dev);
45674594
drm_modeset_unlock_all(dev);
45684595

45694596
/* Just to be sure */

include/drm/drm_crtc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,7 @@ struct drm_mode_config {
771771
struct list_head property_blob_list;
772772
struct drm_property *edid_property;
773773
struct drm_property *dpms_property;
774+
struct drm_property *plane_type_property;
774775

775776
/* DVI-I properties */
776777
struct drm_property *dvi_i_subconnector_property;

0 commit comments

Comments
 (0)