Commit a3a1e533 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Tidy the tail of i915_tiling_ok()

The current tail breaks the pattern of if (check) return false, which
can catch the reader out. If we move the gen2/3 power-of-two test into
the earlier gen2/3 branch, we can eliminate the contrary tail.
Suggested-by: default avatarTvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170203115036.24743-1-chris@chris-wilson.co.ukReviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
parent 52da22e7
...@@ -158,6 +158,9 @@ i915_tiling_ok(struct drm_i915_gem_object *obj, ...@@ -158,6 +158,9 @@ i915_tiling_ok(struct drm_i915_gem_object *obj,
if (stride > 8192) if (stride > 8192)
return false; return false;
if (!is_power_of_2(stride))
return false;
if (IS_GEN3(i915)) { if (IS_GEN3(i915)) {
if (obj->base.size > I830_FENCE_MAX_SIZE_VAL << 20) if (obj->base.size > I830_FENCE_MAX_SIZE_VAL << 20)
return false; return false;
...@@ -176,12 +179,7 @@ i915_tiling_ok(struct drm_i915_gem_object *obj, ...@@ -176,12 +179,7 @@ i915_tiling_ok(struct drm_i915_gem_object *obj,
if (!stride || !IS_ALIGNED(stride, tile_width)) if (!stride || !IS_ALIGNED(stride, tile_width))
return false; return false;
/* 965+ just needs multiples of tile width */
if (INTEL_GEN(i915) >= 4)
return true; return true;
/* Pre-965 needs power of two tile widths */
return is_power_of_2(stride);
} }
static bool i915_vma_fence_prepare(struct i915_vma *vma, static bool i915_vma_fence_prepare(struct i915_vma *vma,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment