[Intel-gfx] [PATCH 10/15] drm/i915: Use kmap_atomic for shmem pread

Chris Wilson chris at chris-wilson.co.uk
Tue Mar 22 14:51:55 CET 2011


We only hold the mapped pages for the duration of the memcpy, and never
sleep with them, so we can safely use the cheaper atomic variants of
kmap.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 7f9be7a..96d4e64 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -314,13 +314,13 @@ slow_shmem_copy(struct page *dst_page,
 {
 	char *dst_vaddr, *src_vaddr;
 
-	dst_vaddr = kmap(dst_page);
-	src_vaddr = kmap(src_page);
+	dst_vaddr = kmap_atomic(dst_page);
+	src_vaddr = kmap_atomic(src_page);
 
 	memcpy(dst_vaddr + dst_offset, src_vaddr + src_offset, length);
 
-	kunmap(src_page);
-	kunmap(dst_page);
+	kunmap_atomic(src_vaddr);
+	kunmap_atomic(dst_vaddr);
 }
 
 static inline void
@@ -343,8 +343,8 @@ slow_shmem_bit17_copy(struct page *gpu_page,
 					       cpu_page, cpu_offset, length);
 	}
 
-	gpu_vaddr = kmap(gpu_page);
-	cpu_vaddr = kmap(cpu_page);
+	gpu_vaddr = kmap_atomic(gpu_page);
+	cpu_vaddr = kmap_atomic(cpu_page);
 
 	/* Copy the data, XORing A6 with A17 (1). The user already knows he's
 	 * XORing with the other bits (A9 for Y, A9 and A10 for X)
@@ -368,8 +368,8 @@ slow_shmem_bit17_copy(struct page *gpu_page,
 		length -= this_length;
 	}
 
-	kunmap(cpu_page);
-	kunmap(gpu_page);
+	kunmap_atomic(cpu_vaddr);
+	kunmap_atomic(gpu_vaddr);
 }
 
 /**
-- 
1.7.4.1




More information about the Intel-gfx mailing list