xf86-video-intel: Branch 'drm-gem' - src/i830_memory.c

Eric Anholt anholt at kemper.freedesktop.org
Fri Jul 11 19:00:11 PDT 2008


 src/i830_memory.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

New commits:
commit e9916b9d496fd0b4df717892dda33f81a2e2990a
Author: Eric Anholt <eric at anholt.net>
Date:   Fri Jul 11 18:59:05 2008 -0700

    Set tiling state for buffers allocated using GEM.

diff --git a/src/i830_memory.c b/src/i830_memory.c
index c357621..3d6e245 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;
 }
 


More information about the xorg-commit mailing list