diff mbox

[3/4] drm/i915: Remove the no FBC reason enum

Message ID 1425000660-1487-4-git-send-email-damien.lespiau@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lespiau, Damien Feb. 27, 2015, 1:30 a.m. UTC
Now that we store the reason string in the fbc structure, we are
duplicating the no FBC reason info. We can just reuse the string pointer
instead.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h  | 13 -------------
 drivers/gpu/drm/i915/intel_fbc.c | 31 +++++++++++--------------------
 2 files changed, 11 insertions(+), 33 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e262397..7f44ce2 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -813,19 +813,6 @@  struct i915_fbc {
 		struct drm_framebuffer *fb;
 	} *fbc_work;
 
-	enum no_fbc_reason {
-		FBC_OK, /* FBC is enabled */
-		FBC_UNSUPPORTED, /* FBC is not supported by this chipset */
-		FBC_NO_OUTPUT, /* no outputs enabled to compress */
-		FBC_STOLEN_TOO_SMALL, /* not enough space for buffers */
-		FBC_UNSUPPORTED_MODE, /* interlace or doublescanned mode */
-		FBC_MODE_TOO_LARGE, /* mode too large for compression */
-		FBC_BAD_PLANE, /* fbc not supported on plane */
-		FBC_NOT_TILED, /* buffer not tiled */
-		FBC_MULTIPLE_PIPES, /* more than one pipe active */
-		FBC_MODULE_PARAM,
-		FBC_CHIP_DEFAULT, /* disabled by default on this chip */
-	} no_fbc_reason;
 	const char *no_fbc_str;
 };
 
diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
index 6cdf6e2..0098cdd 100644
--- a/drivers/gpu/drm/i915/intel_fbc.c
+++ b/drivers/gpu/drm/i915/intel_fbc.c
@@ -464,13 +464,11 @@  void intel_fbc_disable(struct drm_device *dev)
 }
 
 static void set_no_fbc_reason(struct drm_i915_private *dev_priv,
-			      enum no_fbc_reason reason,
 			      const char *reason_str /* a static string */)
 {
-	if (dev_priv->fbc.no_fbc_reason == reason)
+	if (dev_priv->fbc.no_fbc_str == reason_str)
 		return;
 
-	dev_priv->fbc.no_fbc_reason = reason;
 	dev_priv->fbc.no_fbc_str = reason_str;
 	DRM_DEBUG_KMS("Disabling FBC: %s\n", reason_str);
 }
@@ -492,7 +490,7 @@  static struct drm_crtc *intel_fbc_find_crtc(struct drm_i915_private *dev_priv)
 		if (intel_crtc_active(tmp_crtc) &&
 		    to_intel_crtc(tmp_crtc)->primary_enabled) {
 			if (one_pipe_only && crtc) {
-				set_no_fbc_reason(dev_priv, FBC_MULTIPLE_PIPES,
+				set_no_fbc_reason(dev_priv,
 						  "more than one pipe active");
 				return NULL;
 			}
@@ -504,7 +502,7 @@  static struct drm_crtc *intel_fbc_find_crtc(struct drm_i915_private *dev_priv)
 	}
 
 	if (!crtc || crtc->primary->fb == NULL) {
-		set_no_fbc_reason(dev_priv, FBC_NO_OUTPUT, "no output");
+		set_no_fbc_reason(dev_priv, "no output");
 		return NULL;
 	}
 
@@ -548,12 +546,12 @@  void intel_fbc_update(struct drm_device *dev)
 		i915.enable_fbc = 0;
 
 	if (i915.enable_fbc < 0) {
-		set_no_fbc_reason(dev_priv, FBC_CHIP_DEFAULT, "chip default");
+		set_no_fbc_reason(dev_priv, "chip default");
 		goto out_disable;
 	}
 
 	if (!i915.enable_fbc || !i915.powersave) {
-		set_no_fbc_reason(dev_priv, FBC_MODULE_PARAM, "module param");
+		set_no_fbc_reason(dev_priv, "module param");
 		goto out_disable;
 	}
 
@@ -577,8 +575,7 @@  void intel_fbc_update(struct drm_device *dev)
 
 	if ((adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) ||
 	    (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)) {
-		set_no_fbc_reason(dev_priv, FBC_UNSUPPORTED_MODE,
-				  "incompatible mode");
+		set_no_fbc_reason(dev_priv, "incompatible mode");
 		goto out_disable;
 	}
 
@@ -594,14 +591,13 @@  void intel_fbc_update(struct drm_device *dev)
 	}
 	if (intel_crtc->config->pipe_src_w > max_width ||
 	    intel_crtc->config->pipe_src_h > max_height) {
-		set_no_fbc_reason(dev_priv, FBC_MODE_TOO_LARGE,
-				  "mode too large");
+		set_no_fbc_reason(dev_priv, "mode too large");
 		goto out_disable;
 	}
 
 	if ((INTEL_INFO(dev)->gen < 4 || HAS_DDI(dev)) &&
 	    intel_crtc->plane != PLANE_A) {
-		set_no_fbc_reason(dev_priv, FBC_BAD_PLANE, "plane not A");
+		set_no_fbc_reason(dev_priv, "plane not A");
 		goto out_disable;
 	}
 
@@ -610,14 +606,12 @@  void intel_fbc_update(struct drm_device *dev)
 	 */
 	if (obj->tiling_mode != I915_TILING_X ||
 	    obj->fence_reg == I915_FENCE_REG_NONE) {
-		set_no_fbc_reason(dev_priv, FBC_NOT_TILED,
-				  "framebuffer not tiled or fenced");
+		set_no_fbc_reason(dev_priv, "framebuffer not tiled or fenced");
 		goto out_disable;
 	}
 	if (INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev) &&
 	    crtc->primary->state->rotation != BIT(DRM_ROTATE_0)) {
-		set_no_fbc_reason(dev_priv, FBC_UNSUPPORTED_MODE,
-				  "rotation unsupported");
+		set_no_fbc_reason(dev_priv, "rotation unsupported");
 		goto out_disable;
 	}
 
@@ -627,8 +621,7 @@  void intel_fbc_update(struct drm_device *dev)
 
 	if (i915_gem_stolen_setup_compression(dev, obj->base.size,
 					      drm_format_plane_cpp(fb->pixel_format, 0))) {
-		set_no_fbc_reason(dev_priv, FBC_STOLEN_TOO_SMALL,
-				  "no space in stolen memory");
+		set_no_fbc_reason(dev_priv, "no space in stolen memory");
 		goto out_disable;
 	}
 
@@ -671,7 +664,6 @@  void intel_fbc_update(struct drm_device *dev)
 	}
 
 	intel_fbc_enable(crtc);
-	dev_priv->fbc.no_fbc_reason = FBC_OK;
 	dev_priv->fbc.no_fbc_str = NULL;
 	return;
 
@@ -694,7 +686,6 @@  void intel_fbc_init(struct drm_i915_private *dev_priv)
 {
 	if (!HAS_FBC(dev_priv)) {
 		dev_priv->fbc.enabled = false;
-		dev_priv->fbc.no_fbc_reason = FBC_UNSUPPORTED;
 		dev_priv->fbc.no_fbc_str = "unsupported";
 		return;
 	}