drm/atomic: atomic connector properties
authorRob Clark <robdclark@gmail.com>
Thu, 18 Dec 2014 21:01:54 +0000 (16:01 -0500)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 5 Jan 2015 12:55:29 +0000 (13:55 +0100)
Expose the core connector state as properties so it can be updated via
atomic ioctl.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Documentation/DocBook/drm.tmpl
drivers/gpu/drm/drm_atomic.c
drivers/gpu/drm/drm_crtc.c

index 8d8dc7124bb57b319b3dc3c9d784cc6e07bf8422..2f4a299064251f88f0465a6e85fe3cbdc63125f6 100644 (file)
@@ -2572,8 +2572,8 @@ void intel_crt_init(struct drm_device *dev)
        <td valign="top" >Description/Restrictions</td>
        </tr>
        <tr>
-       <td rowspan="35" valign="top" >DRM</td>
-       <td rowspan="4" valign="top" >Generic</td>
+       <td rowspan="36" valign="top" >DRM</td>
+       <td rowspan="5" valign="top" >Connector</td>
        <td valign="top" >“EDID”</td>
        <td valign="top" >BLOB | IMMUTABLE</td>
        <td valign="top" >0</td>
@@ -2602,6 +2602,13 @@ void intel_crt_init(struct drm_device *dev)
        <td valign="top" >Contains tiling information for a connector.</td>
        </tr>
        <tr>
+       <td valign="top" >“CRTC_ID”</td>
+       <td valign="top" >OBJECT</td>
+       <td valign="top" >DRM_MODE_OBJECT_CRTC</td>
+       <td valign="top" >Connector</td>
+       <td valign="top" >CRTC that connector is attached to (atomic)</td>
+       </tr>
+       <tr>
        <td rowspan="11" valign="top" >Plane</td>
        <td valign="top" >“type”</td>
        <td valign="top" >ENUM | IMMUTABLE</td>
index 131d47f6f7a2431cea2834d61eb5fc438d875317..57cc68177f098cd6479cfb08d3be5b1000aea111 100644 (file)
@@ -627,7 +627,10 @@ int drm_atomic_connector_set_property(struct drm_connector *connector,
        struct drm_device *dev = connector->dev;
        struct drm_mode_config *config = &dev->mode_config;
 
-       if (property == config->dpms_property) {
+       if (property == config->prop_crtc_id) {
+               struct drm_crtc *crtc = drm_crtc_find(dev, val);
+               return drm_atomic_set_crtc_for_connector(state, crtc);
+       } else if (property == config->dpms_property) {
                /* setting DPMS property requires special handling, which
                 * is done in legacy setprop path for us.  Disallow (for
                 * now?) atomic writes to DPMS property:
@@ -665,7 +668,9 @@ int drm_atomic_connector_get_property(struct drm_connector *connector,
        struct drm_device *dev = connector->dev;
        struct drm_mode_config *config = &dev->mode_config;
 
-       if (property == config->dpms_property) {
+       if (property == config->prop_crtc_id) {
+               *val = (state->crtc) ? state->crtc->base.id : 0;
+       } else if (property == config->dpms_property) {
                *val = connector->dpms;
        } else if (connector->funcs->atomic_get_property) {
                return connector->funcs->atomic_get_property(connector,
index 46fa0945b53ef33cf9e3f12f63f93e36bff8d2a0..3cb1fa09ac9ef965b065abe6bde0b8e2fb3dcc00 100644 (file)
@@ -831,6 +831,7 @@ int drm_connector_init(struct drm_device *dev,
                       const struct drm_connector_funcs *funcs,
                       int connector_type)
 {
+       struct drm_mode_config *config = &dev->mode_config;
        int ret;
        struct ida *connector_ida =
                &drm_connector_enum_list[connector_type].ida;
@@ -869,16 +870,20 @@ int drm_connector_init(struct drm_device *dev,
 
        /* We should add connectors at the end to avoid upsetting the connector
         * index too much. */
-       list_add_tail(&connector->head, &dev->mode_config.connector_list);
-       dev->mode_config.num_connector++;
+       list_add_tail(&connector->head, &config->connector_list);
+       config->num_connector++;
 
        if (connector_type != DRM_MODE_CONNECTOR_VIRTUAL)
                drm_object_attach_property(&connector->base,
-                                             dev->mode_config.edid_property,
+                                             config->edid_property,
                                              0);
 
        drm_object_attach_property(&connector->base,
-                                     dev->mode_config.dpms_property, 0);
+                                     config->dpms_property, 0);
+
+       if (drm_core_check_feature(dev, DRIVER_ATOMIC)) {
+               drm_object_attach_property(&connector->base, config->prop_crtc_id, 0);
+       }
 
        connector->debugfs_entry = NULL;