summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-10-24 12:16:11 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-11-04 10:37:48 +0000
commita972c9886edc1141ad3f8a0a33d2f7f18d0008bc (patch)
treed16dedbe434a767ad46f43d4dec863baceff98f5
parent7ecc778691c452285f754743a93a46fa1d3da52f (diff)
sna: Use v2 of get_tiling ioctl to check for bit17 swizzling
With the new version of the get_tiling ioctl we can reliably detect if we can use manual detiling (i.e. CPU mmaps) on older gen. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index eb2a3d9a..7c572cc4 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1232,10 +1232,13 @@ err:
static void kgem_init_swizzling(struct kgem *kgem)
{
- struct drm_i915_gem_get_tiling tiling;
-
- if (kgem->gen < 050) /* bit17 swizzling :( */
- return;
+ struct local_i915_gem_get_tiling_v2 {
+ uint32_t handle;
+ uint32_t tiling_mode;
+ uint32_t swizzle_mode;
+ uint32_t phys_swizzle_mode;
+ } tiling;
+#define LOCAL_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct local_i915_gem_get_tiling_v2)
VG_CLEAR(tiling);
tiling.handle = gem_create(kgem->fd, 1);
@@ -1245,7 +1248,10 @@ static void kgem_init_swizzling(struct kgem *kgem)
if (!gem_set_tiling(kgem->fd, tiling.handle, I915_TILING_X, 512))
goto out;
- if (do_ioctl(kgem->fd, DRM_IOCTL_I915_GEM_GET_TILING, &tiling))
+ if (do_ioctl(kgem->fd, LOCAL_IOCTL_I915_GEM_GET_TILING, &tiling))
+ goto out;
+
+ if (kgem->gen < 50 && tiling.phys_swizzle_mode != tiling.swizzle_mode)
goto out;
choose_memcpy_tiled_x(kgem, tiling.swizzle_mode);