diff options
author | Eric Anholt <eric@anholt.net> | 2008-07-11 18:59:05 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2008-07-11 18:59:27 -0700 |
commit | e9916b9d496fd0b4df717892dda33f81a2e2990a (patch) | |
tree | 15ecb7f5f40c07c700e22c874c122e083c1ca406 | |
parent | 9d7929436488969ca4fd1fef4d2e92be5e1a93aa (diff) |
Set tiling state for buffers allocated using GEM.
-rw-r--r-- | src/i830_memory.c | 25 |
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; } |