drm/nouveau/kms: prepare to support legacy connector dpms with atomic
authorBen Skeggs <bskeggs@redhat.com>
Fri, 4 Nov 2016 07:20:35 +0000 (17:20 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 7 Nov 2016 04:04:47 +0000 (14:04 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_connector.c

index c08d5e6c3a05a66ad7a9880bae248038052c45f0..705c700fdeefb2ecce6396e9c28c283cb9861b72 100644 (file)
@@ -1074,9 +1074,17 @@ nouveau_connector_helper_funcs = {
        .best_encoder = nouveau_connector_best_encoder,
 };
 
+static int
+nouveau_connector_dpms(struct drm_connector *connector, int mode)
+{
+       if (connector->dev->mode_config.funcs->atomic_commit)
+               return drm_atomic_helper_connector_dpms(connector, mode);
+       return drm_helper_connector_dpms(connector, mode);
+}
+
 static const struct drm_connector_funcs
 nouveau_connector_funcs = {
-       .dpms = drm_helper_connector_dpms,
+       .dpms = nouveau_connector_dpms,
        .reset = nouveau_conn_reset,
        .detect = nouveau_connector_detect,
        .force = nouveau_connector_force,
@@ -1091,7 +1099,7 @@ nouveau_connector_funcs = {
 
 static const struct drm_connector_funcs
 nouveau_connector_funcs_lvds = {
-       .dpms = drm_helper_connector_dpms,
+       .dpms = nouveau_connector_dpms,
        .reset = nouveau_conn_reset,
        .detect = nouveau_connector_detect_lvds,
        .force = nouveau_connector_force,
@@ -1335,7 +1343,10 @@ nouveau_connector_create(struct drm_device *dev, int index)
                        return ERR_PTR(ret);
                }
 
-               funcs = &nouveau_connector_funcs_dp;
+               if (dev->mode_config.funcs->atomic_commit)
+                       funcs = &nouveau_connector_funcs;
+               else
+                       funcs = &nouveau_connector_funcs_dp;
                break;
        default:
                funcs = &nouveau_connector_funcs;