]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
drm/i915: add crtc->enable/disable vfuncs insted of dpms
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 29 Jun 2012 20:39:33 +0000 (22:39 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 6 Sep 2012 05:52:00 +0000 (07:52 +0200)
Because that's what we're essentially calling. This is the first step
in untangling the crtc_helper induced dpms handling mess we have - at
the crtc level we only have 2 states and the magic is just in
selecting which one (and atm there isn't even much magic, but on
recent platforms where not even the crt output has more than 2 states
we could do better).

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_display.c

index ed3ba70923ac1e40a4df1bab8674363024d9766f..fb46c6f356e4c27d46090ed62a38f048793b6ce3 100644 (file)
@@ -240,7 +240,6 @@ struct drm_i915_error_state {
 };
 
 struct drm_i915_display_funcs {
-       void (*dpms)(struct drm_crtc *crtc, int mode);
        bool (*fbc_enabled)(struct drm_device *dev);
        void (*enable_fbc)(struct drm_crtc *crtc, unsigned long interval);
        void (*disable_fbc)(struct drm_device *dev);
@@ -256,6 +255,8 @@ struct drm_i915_display_funcs {
                             struct drm_display_mode *adjusted_mode,
                             int x, int y,
                             struct drm_framebuffer *old_fb);
+       void (*crtc_enable)(struct drm_crtc *crtc);
+       void (*crtc_disable)(struct drm_crtc *crtc);
        void (*off)(struct drm_crtc *crtc);
        void (*write_eld)(struct drm_connector *connector,
                          struct drm_crtc *crtc);
index 42c57581c53f5385d73337c497ae7f64cb381b89..adc98680b693ac079b963feae06988900bfbaac1 100644 (file)
@@ -3342,30 +3342,6 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
        mutex_unlock(&dev->struct_mutex);
 }
 
-static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode)
-{
-       struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-       int pipe = intel_crtc->pipe;
-       int plane = intel_crtc->plane;
-
-       /* XXX: When our outputs are all unaware of DPMS modes other than off
-        * and on, we should map those modes to DRM_MODE_DPMS_OFF in the CRTC.
-        */
-       switch (mode) {
-       case DRM_MODE_DPMS_ON:
-       case DRM_MODE_DPMS_STANDBY:
-       case DRM_MODE_DPMS_SUSPEND:
-               DRM_DEBUG_KMS("crtc %d/%d dpms on\n", pipe, plane);
-               ironlake_crtc_enable(crtc);
-               break;
-
-       case DRM_MODE_DPMS_OFF:
-               DRM_DEBUG_KMS("crtc %d/%d dpms off\n", pipe, plane);
-               ironlake_crtc_disable(crtc);
-               break;
-       }
-}
-
 static void ironlake_crtc_off(struct drm_crtc *crtc)
 {
        struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
@@ -3445,23 +3421,6 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
        intel_update_watermarks(dev);
 }
 
-static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode)
-{
-       /* XXX: When our outputs are all unaware of DPMS modes other than off
-        * and on, we should map those modes to DRM_MODE_DPMS_OFF in the CRTC.
-        */
-       switch (mode) {
-       case DRM_MODE_DPMS_ON:
-       case DRM_MODE_DPMS_STANDBY:
-       case DRM_MODE_DPMS_SUSPEND:
-               i9xx_crtc_enable(crtc);
-               break;
-       case DRM_MODE_DPMS_OFF:
-               i9xx_crtc_disable(crtc);
-               break;
-       }
-}
-
 static void i9xx_crtc_off(struct drm_crtc *crtc)
 {
 }
@@ -3483,7 +3442,20 @@ static void intel_crtc_dpms(struct drm_crtc *crtc, int mode)
 
        intel_crtc->dpms_mode = mode;
 
-       dev_priv->display.dpms(crtc, mode);
+       /* XXX: When our outputs are all unaware of DPMS modes other than off
+        * and on, we should map those modes to DRM_MODE_DPMS_OFF in the CRTC.
+        */
+       switch (mode) {
+       case DRM_MODE_DPMS_ON:
+       case DRM_MODE_DPMS_STANDBY:
+       case DRM_MODE_DPMS_SUSPEND:
+               dev_priv->display.crtc_enable(crtc);
+               break;
+
+       case DRM_MODE_DPMS_OFF:
+               dev_priv->display.crtc_disable(crtc);
+               break;
+       }
 
        if (!dev->primary->master)
                return;
@@ -6971,13 +6943,15 @@ static void intel_init_display(struct drm_device *dev)
 
        /* We always want a DPMS function */
        if (HAS_PCH_SPLIT(dev)) {
-               dev_priv->display.dpms = ironlake_crtc_dpms;
                dev_priv->display.crtc_mode_set = ironlake_crtc_mode_set;
+               dev_priv->display.crtc_enable = ironlake_crtc_enable;
+               dev_priv->display.crtc_disable = ironlake_crtc_disable;
                dev_priv->display.off = ironlake_crtc_off;
                dev_priv->display.update_plane = ironlake_update_plane;
        } else {
-               dev_priv->display.dpms = i9xx_crtc_dpms;
                dev_priv->display.crtc_mode_set = i9xx_crtc_mode_set;
+               dev_priv->display.crtc_enable = i9xx_crtc_enable;
+               dev_priv->display.crtc_disable = i9xx_crtc_disable;
                dev_priv->display.off = i9xx_crtc_off;
                dev_priv->display.update_plane = i9xx_update_plane;
        }