As we lie through the get_tiling ioctl about the swizzle mode, the information that provides is unreliable and userspace has no way of knowing the status of bit17 swizzling in the system. This prevents userspace from using manual swizzling through a CPU map, which in some circumstances is the optimal way of transferring data. Fix this oversight, by providing a couple of PARAMs for userspace to query the swizzle modes. Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk> --- drivers/gpu/drm/i915/i915_dma.c | 6 ++++++ include/uapi/drm/i915_drm.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 893c9d1..c83c75d 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -1004,6 +1004,12 @@ static int i915_getparam(struct drm_device *dev, void *data, case I915_PARAM_HAS_EXEC_HANDLE_LUT: value = 1; break; + case I915_PARAM_SWIZZLE_MODE_X: + value = dev_priv->mm.bit_6_swizzle_x; + break; + case I915_PARAM_SWIZZLE_MODE_Y: + value = dev_priv->mm.bit_6_swizzle_y; + break; default: DRM_DEBUG("Unknown parameter %d\n", param->param); return -EINVAL; diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h index b1dcf05..c5ba08b 100644 --- a/include/uapi/drm/i915_drm.h +++ b/include/uapi/drm/i915_drm.h @@ -317,6 +317,8 @@ typedef struct drm_i915_irq_wait { #define I915_PARAM_HAS_EXEC_NO_RELOC 25 #define I915_PARAM_HAS_EXEC_HANDLE_LUT 26 #define I915_PARAM_HAS_GFDT 27 +#define I915_PARAM_SWIZZLE_MODE_X 28 +#define I915_PARAM_SWIZZLE_MODE_Y 29 typedef struct drm_i915_getparam { int param; -- 1.8.3.1