aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2014-10-20 02:30:50 -0400
committerDave Airlie <airlied@redhat.com>2014-12-08 18:56:48 -0500
commit6f134d7bb4347ab4c66ef123efb838fedb54186f (patch)
tree4e7d66d7668fef9e6d1a5714b2bba2280613418c
parent40d9b043a89e2301e1f97ade055a73ecc28e9afe (diff)
drm/tile: expose the tile property to userspace (v3)
This takes the tiling info from the connector and exposes it to userspace, as a blob object in a connector property. The contents of the blob is ABI. v2: add property + function documentation. v3: move property setup from previous patch. add boilerplate + fix long line (Daniel) Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--Documentation/DocBook/drm.tmpl9
-rw-r--r--drivers/gpu/drm/drm_crtc.c51
-rw-r--r--drivers/gpu/drm/drm_dp_mst_topology.c1
-rw-r--r--drivers/gpu/drm/i915/intel_dp_mst.c2
-rw-r--r--include/drm/drm_crtc.h4
5 files changed, 66 insertions, 1 deletions
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index bc4b5ab5848e..60c1063d4178 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -2551,7 +2551,7 @@ void intel_crt_init(struct drm_device *dev)
2551 </tr> 2551 </tr>
2552 <tr> 2552 <tr>
2553 <td rowspan="23" valign="top" >DRM</td> 2553 <td rowspan="23" valign="top" >DRM</td>
2554 <td rowspan="3" valign="top" >Generic</td> 2554 <td rowspan="4" valign="top" >Generic</td>
2555 <td valign="top" >“EDID”</td> 2555 <td valign="top" >“EDID”</td>
2556 <td valign="top" >BLOB | IMMUTABLE</td> 2556 <td valign="top" >BLOB | IMMUTABLE</td>
2557 <td valign="top" >0</td> 2557 <td valign="top" >0</td>
@@ -2573,6 +2573,13 @@ void intel_crt_init(struct drm_device *dev)
2573 <td valign="top" >Contains topology path to a connector.</td> 2573 <td valign="top" >Contains topology path to a connector.</td>
2574 </tr> 2574 </tr>
2575 <tr> 2575 <tr>
2576 <td valign="top" >“TILE”</td>
2577 <td valign="top" >BLOB | IMMUTABLE</td>
2578 <td valign="top" >0</td>
2579 <td valign="top" >Connector</td>
2580 <td valign="top" >Contains tiling information for a connector.</td>
2581 </tr>
2582 <tr>
2576 <td rowspan="1" valign="top" >Plane</td> 2583 <td rowspan="1" valign="top" >Plane</td>
2577 <td valign="top" >“type”</td> 2584 <td valign="top" >“type”</td>
2578 <td valign="top" >ENUM | IMMUTABLE</td> 2585 <td valign="top" >ENUM | IMMUTABLE</td>
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index eb89327fb737..4a44f894f631 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1344,6 +1344,11 @@ static int drm_mode_create_standard_connector_properties(struct drm_device *dev)
1344 "PATH", 0); 1344 "PATH", 0);
1345 dev->mode_config.path_property = dev_path; 1345 dev->mode_config.path_property = dev_path;
1346 1346
1347 dev->mode_config.tile_property = drm_property_create(dev,
1348 DRM_MODE_PROP_BLOB |
1349 DRM_MODE_PROP_IMMUTABLE,
1350 "TILE", 0);
1351
1347 return 0; 1352 return 0;
1348} 1353}
1349 1354
@@ -4088,6 +4093,52 @@ int drm_mode_connector_set_path_property(struct drm_connector *connector,
4088EXPORT_SYMBOL(drm_mode_connector_set_path_property); 4093EXPORT_SYMBOL(drm_mode_connector_set_path_property);
4089 4094
4090/** 4095/**
4096 * drm_mode_connector_set_tile_property - set tile property on connector
4097 * @connector: connector to set property on.
4098 *
4099 * This looks up the tile information for a connector, and creates a
4100 * property for userspace to parse if it exists. The property is of
4101 * the form of 8 integers using ':' as a separator.
4102 *
4103 * Returns:
4104 * Zero on success, errno on failure.
4105 */
4106int drm_mode_connector_set_tile_property(struct drm_connector *connector)
4107{
4108 struct drm_device *dev = connector->dev;
4109 int ret, size;
4110 char tile[256];
4111
4112 if (connector->tile_blob_ptr)
4113 drm_property_destroy_blob(dev, connector->tile_blob_ptr);
4114
4115 if (!connector->has_tile) {
4116 connector->tile_blob_ptr = NULL;
4117 ret = drm_object_property_set_value(&connector->base,
4118 dev->mode_config.tile_property, 0);
4119 return ret;
4120 }
4121
4122 snprintf(tile, 256, "%d:%d:%d:%d:%d:%d:%d:%d",
4123 connector->tile_group->id, connector->tile_is_single_monitor,
4124 connector->num_h_tile, connector->num_v_tile,
4125 connector->tile_h_loc, connector->tile_v_loc,
4126 connector->tile_h_size, connector->tile_v_size);
4127 size = strlen(tile) + 1;
4128
4129 connector->tile_blob_ptr = drm_property_create_blob(connector->dev,
4130 size, tile);
4131 if (!connector->tile_blob_ptr)
4132 return -EINVAL;
4133
4134 ret = drm_object_property_set_value(&connector->base,
4135 dev->mode_config.tile_property,
4136 connector->tile_blob_ptr->base.id);
4137 return ret;
4138}
4139EXPORT_SYMBOL(drm_mode_connector_set_tile_property);
4140
4141/**
4091 * drm_mode_connector_update_edid_property - update the edid property of a connector 4142 * drm_mode_connector_update_edid_property - update the edid property of a connector
4092 * @connector: drm connector 4143 * @connector: drm connector
4093 * @edid: new value of the edid property 4144 * @edid: new value of the edid property
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 0a9d3aad3cba..9a5b68717ec8 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -2236,6 +2236,7 @@ struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_
2236 else 2236 else
2237 edid = drm_get_edid(connector, &port->aux.ddc); 2237 edid = drm_get_edid(connector, &port->aux.ddc);
2238 2238
2239 drm_mode_connector_set_tile_property(connector);
2239 drm_dp_put_port(port); 2240 drm_dp_put_port(port);
2240 return edid; 2241 return edid;
2241} 2242}
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
index 428bb3041621..7f8c6a66680a 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -414,6 +414,8 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo
414 intel_dp_add_properties(intel_dp, connector); 414 intel_dp_add_properties(intel_dp, connector);
415 415
416 drm_object_attach_property(&connector->base, dev->mode_config.path_property, 0); 416 drm_object_attach_property(&connector->base, dev->mode_config.path_property, 0);
417 drm_object_attach_property(&connector->base, dev->mode_config.tile_property, 0);
418
417 drm_mode_connector_set_path_property(connector, pathprop); 419 drm_mode_connector_set_path_property(connector, pathprop);
418 drm_reinit_primary_mode_group(dev); 420 drm_reinit_primary_mode_group(dev);
419 mutex_lock(&dev->mode_config.mutex); 421 mutex_lock(&dev->mode_config.mutex);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 01744ed79250..b86329813ad3 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -651,6 +651,8 @@ struct drm_connector {
651 651
652 struct drm_property_blob *path_blob_ptr; 652 struct drm_property_blob *path_blob_ptr;
653 653
654 struct drm_property_blob *tile_blob_ptr;
655
654 uint8_t polled; /* DRM_CONNECTOR_POLL_* */ 656 uint8_t polled; /* DRM_CONNECTOR_POLL_* */
655 657
656 /* requested DPMS state */ 658 /* requested DPMS state */
@@ -1048,6 +1050,7 @@ struct drm_mode_config {
1048 struct drm_property *edid_property; 1050 struct drm_property *edid_property;
1049 struct drm_property *dpms_property; 1051 struct drm_property *dpms_property;
1050 struct drm_property *path_property; 1052 struct drm_property *path_property;
1053 struct drm_property *tile_property;
1051 struct drm_property *plane_type_property; 1054 struct drm_property *plane_type_property;
1052 struct drm_property *rotation_property; 1055 struct drm_property *rotation_property;
1053 1056
@@ -1217,6 +1220,7 @@ extern void drm_mode_config_cleanup(struct drm_device *dev);
1217 1220
1218extern int drm_mode_connector_set_path_property(struct drm_connector *connector, 1221extern int drm_mode_connector_set_path_property(struct drm_connector *connector,
1219 const char *path); 1222 const char *path);
1223int drm_mode_connector_set_tile_property(struct drm_connector *connector);
1220extern int drm_mode_connector_update_edid_property(struct drm_connector *connector, 1224extern int drm_mode_connector_update_edid_property(struct drm_connector *connector,
1221 const struct edid *edid); 1225 const struct edid *edid);
1222 1226