[Intel-gfx] [PATCH] drm/i915: Eliminate dead code in intel_sanitize_enable_ppgtt()

Imre Deak imre.deak at intel.com
Tue Jul 25 21:12:36 UTC 2017


From: Damien Lespiau <damien.lespiau at intel.com>

We exit early if has_aliasing_ppgtt is 0, so towards the end of the
function has_aliasing_ppgtt can only be 1.

Also:

	if (foo)
		return 1;
	else
		return 0;

when foo is already a bool is really just:

	return foo;

v2:
- Simplify more using the fact that i915.enable_execlists requires that
  GEN >= 8. (Chris)

Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
[Imre: updated to v2]
Signed-off-by: Imre Deak <imre.deak at intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 10aa7762d9a6..f401318430ed 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -133,7 +133,7 @@ static inline void i915_ggtt_invalidate(struct drm_i915_private *i915)
 }
 
 int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
-			       	int enable_ppgtt)
+				int enable_ppgtt)
 {
 	bool has_aliasing_ppgtt;
 	bool has_full_ppgtt;
@@ -180,10 +180,14 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
 		return 0;
 	}
 
-	if (INTEL_GEN(dev_priv) >= 8 && i915.enable_execlists && has_full_ppgtt)
-		return has_full_48bit_ppgtt ? 3 : 2;
-	else
-		return has_aliasing_ppgtt ? 1 : 0;
+	if (!has_full_ppgtt)
+		return 1;
+
+	/* full-ppgtt doesn't yet work reliably in legacy ringbuffer mode */
+	if (!i915.enable_execlists)
+		return 1;
+
+	return has_full_48bit_ppgtt ? 3 : 2;
 }
 
 static int ppgtt_bind_vma(struct i915_vma *vma,
-- 
2.13.2



More information about the Intel-gfx mailing list