summaryrefslogtreecommitdiff
path: root/intel
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-06-22 11:07:26 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-06-22 11:09:12 +0100
commitcd34cbeb9f5c65b25d241700f27c16b36e1ecce6 (patch)
tree4c4bc0904dd26a6794693713486e2aa0e2c480b4 /intel
parent13e8270504cffa96bd067dc5c792a79555e8b2d4 (diff)
intel: Sanitise strides for linear buffers and SET_TILING
Ensure that the user doesn't attempt to specify a stride to use with a linear buffer by forcing such to be zero. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'intel')
-rw-r--r--intel/intel_bufmgr_gem.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 37b74677..14b6d7bb 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1735,6 +1735,12 @@ drm_intel_gem_bo_set_tiling(drm_intel_bo *bo, uint32_t * tiling_mode,
if (bo_gem->global_name == 0)
return 0;
+ /* Linear buffers have no stride. By ensuring that we only ever use
+ * stride 0 with linear buffers, we simplify our code.
+ */
+ if (*tiling_mode === I915_TILING_NONE)
+ stride = 0;
+
ret = drm_intel_gem_bo_set_tiling_internal(bo, *tiling_mode, stride);
if (ret == 0)
drm_intel_bo_gem_set_in_aperture_size(bufmgr_gem, bo_gem);