summaryrefslogtreecommitdiff
path: root/src/i830_memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/i830_memory.c')
-rw-r--r--src/i830_memory.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/i830_memory.c b/src/i830_memory.c
index c3576217..3d6e245f 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -901,6 +901,31 @@ i830_allocate_memory_tiled(ScrnInfoPtr pScrn, const char *name,
mem->pitch = pitch;
mem->fence_nr = -1;
+#ifdef XF86DRI
+ if (mem->gem_handle != 0) {
+ struct drm_i915_gem_set_tiling set_tiling;
+ int ret;
+
+ set_tiling.handle = mem->gem_handle;
+ if (tile_format == TILE_XMAJOR)
+ set_tiling.tiling_mode = I915_TILING_X;
+ else
+ set_tiling.tiling_mode = I915_TILING_Y;
+
+ ret = ioctl(pI830->drmSubFD, DRM_IOCTL_I915_GEM_SET_TILING,
+ &set_tiling);
+ if (ret != 0 || set_tiling.tiling_mode == I915_TILING_NONE) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to set tiling on %s: %s\n",
+ mem->name, strerror(errno));
+ i830_free_memory(pScrn, mem);
+ return i830_allocate_memory(pScrn, name, size, alignment,
+ flags);
+ return FALSE;
+ }
+ }
+#endif
+
return mem;
}