xf86-video-intel: src/sna/kgem.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Dec 23 09:29:34 PST 2011


 src/sna/kgem.c |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 98f15fc61361b7f1e01969f8d4237c13e93e3fb0
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Dec 23 17:25:42 2011 +0000

    sna: Don't align pwrite to cachelines for doing discontiguous copies
    
    The batch compaction breaks the 1:1 mapping between the cpu buffer and
    the bo, so we can no longer safely align the transfer to whole
    cachelines.
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=44091
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 539c20e..c733da5 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -171,6 +171,23 @@ static void *gem_mmap(int fd, uint32_t handle, int size, int prot)
 	return ptr;
 }
 
+static int __gem_write(int fd, uint32_t handle,
+		     int offset, int length,
+		     const void *src)
+{
+	struct drm_i915_gem_pwrite pwrite;
+
+	DBG(("%s(handle=%d, offset=%d, len=%d)\n", __FUNCTION__,
+	     handle, offset, length));
+
+	VG_CLEAR(pwrite);
+	pwrite.handle = handle;
+	pwrite.offset = offset;
+	pwrite.size = length;
+	pwrite.data_ptr = (uintptr_t)src;
+	return drmIoctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &pwrite);
+}
+
 static int gem_write(int fd, uint32_t handle,
 		     int offset, int length,
 		     const void *src)
@@ -1086,7 +1103,9 @@ static int kgem_batch_write(struct kgem *kgem, uint32_t handle, uint32_t size)
 	if (ret)
 		return ret;
 
-	return gem_write(kgem->fd, handle,
+	assert(kgem->nbatch*sizeof(uint32_t) <=
+	       sizeof(uint32_t)*kgem->surface - (sizeof(kgem->batch)-size));
+	return __gem_write(kgem->fd, handle,
 			sizeof(uint32_t)*kgem->surface - (sizeof(kgem->batch)-size),
 			sizeof(kgem->batch) - sizeof(uint32_t)*kgem->surface,
 			kgem->batch + kgem->surface);


More information about the xorg-commit mailing list