drm/i915: Pass dev_priv to .get_fifo_size()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 31 Oct 2016 20:37:17 +0000 (22:37 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 1 Nov 2016 14:40:38 +0000 (16:40 +0200)
Unify our approach to things by passing around dev_priv instead of dev.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1477946245-14134-19-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_pm.c

index 8b35cfa6bb8699d32d1416946bd452549d43d79f..fd08559f94d4994fd428bace9e20f1bf40480853 100644 (file)
@@ -495,7 +495,7 @@ struct dpll;
 
 struct drm_i915_display_funcs {
        int (*get_display_clock_speed)(struct drm_i915_private *dev_priv);
-       int (*get_fifo_size)(struct drm_device *dev, int plane);
+       int (*get_fifo_size)(struct drm_i915_private *dev_priv, int plane);
        int (*compute_pipe_wm)(struct intel_crtc_state *cstate);
        int (*compute_intermediate_wm)(struct drm_device *dev,
                                       struct intel_crtc *intel_crtc,
index d423fc8661a9082b69092a81bf8649b85fbd25de..83391c28a72751bd068338d92a7f4aa211dddd62 100644 (file)
@@ -375,10 +375,9 @@ static const int pessimal_latency_ns = 5000;
 #define VLV_FIFO_START(dsparb, dsparb2, lo_shift, hi_shift) \
        ((((dsparb) >> (lo_shift)) & 0xff) | ((((dsparb2) >> (hi_shift)) & 0x1) << 8))
 
-static int vlv_get_fifo_size(struct drm_device *dev,
+static int vlv_get_fifo_size(struct drm_i915_private *dev_priv,
                              enum pipe pipe, int plane)
 {
-       struct drm_i915_private *dev_priv = to_i915(dev);
        int sprite0_start, sprite1_start, size;
 
        switch (pipe) {
@@ -427,9 +426,8 @@ static int vlv_get_fifo_size(struct drm_device *dev,
        return size;
 }
 
-static int i9xx_get_fifo_size(struct drm_device *dev, int plane)
+static int i9xx_get_fifo_size(struct drm_i915_private *dev_priv, int plane)
 {
-       struct drm_i915_private *dev_priv = to_i915(dev);
        uint32_t dsparb = I915_READ(DSPARB);
        int size;
 
@@ -443,9 +441,8 @@ static int i9xx_get_fifo_size(struct drm_device *dev, int plane)
        return size;
 }
 
-static int i830_get_fifo_size(struct drm_device *dev, int plane)
+static int i830_get_fifo_size(struct drm_i915_private *dev_priv, int plane)
 {
-       struct drm_i915_private *dev_priv = to_i915(dev);
        uint32_t dsparb = I915_READ(DSPARB);
        int size;
 
@@ -460,9 +457,8 @@ static int i830_get_fifo_size(struct drm_device *dev, int plane)
        return size;
 }
 
-static int i845_get_fifo_size(struct drm_device *dev, int plane)
+static int i845_get_fifo_size(struct drm_i915_private *dev_priv, int plane)
 {
-       struct drm_i915_private *dev_priv = to_i915(dev);
        uint32_t dsparb = I915_READ(DSPARB);
        int size;
 
@@ -1541,7 +1537,7 @@ static void i9xx_update_wm(struct intel_crtc *unused_crtc)
        else
                wm_info = &i830_a_wm_info;
 
-       fifo_size = dev_priv->display.get_fifo_size(dev, 0);
+       fifo_size = dev_priv->display.get_fifo_size(dev_priv, 0);
        crtc = intel_get_crtc_for_plane(dev_priv, 0);
        if (intel_crtc_active(crtc)) {
                const struct drm_display_mode *adjusted_mode =
@@ -1568,7 +1564,7 @@ static void i9xx_update_wm(struct intel_crtc *unused_crtc)
        if (IS_GEN2(dev_priv))
                wm_info = &i830_bc_wm_info;
 
-       fifo_size = dev_priv->display.get_fifo_size(dev, 1);
+       fifo_size = dev_priv->display.get_fifo_size(dev_priv, 1);
        crtc = intel_get_crtc_for_plane(dev_priv, 1);
        if (intel_crtc_active(crtc)) {
                const struct drm_display_mode *adjusted_mode =
@@ -1686,7 +1682,7 @@ static void i845_update_wm(struct intel_crtc *unused_crtc)
        adjusted_mode = &crtc->config->base.adjusted_mode;
        planea_wm = intel_calculate_wm(adjusted_mode->crtc_clock,
                                       &i845_wm_info,
-                                      dev_priv->display.get_fifo_size(dev, 0),
+                                      dev_priv->display.get_fifo_size(dev_priv, 0),
                                       4, pessimal_latency_ns);
        fwater_lo = I915_READ(FW_BLC) & ~0xfff;
        fwater_lo |= (3<<8) | planea_wm;
@@ -4556,11 +4552,11 @@ void vlv_wm_get_hw_state(struct drm_device *dev)
                        plane->wm.fifo_size = 63;
                        break;
                case DRM_PLANE_TYPE_PRIMARY:
-                       plane->wm.fifo_size = vlv_get_fifo_size(dev, plane->pipe, 0);
+                       plane->wm.fifo_size = vlv_get_fifo_size(dev_priv, plane->pipe, 0);
                        break;
                case DRM_PLANE_TYPE_OVERLAY:
                        sprite = plane->plane;
-                       plane->wm.fifo_size = vlv_get_fifo_size(dev, plane->pipe, sprite + 1);
+                       plane->wm.fifo_size = vlv_get_fifo_size(dev_priv, plane->pipe, sprite + 1);
                        break;
                }
        }