summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMika Kuoppala <mika.kuoppala@intel.com>2015-04-15 19:01:35 +0300
committerMika Kuoppala <mika.kuoppala@intel.com>2015-04-15 19:44:55 +0300
commitd7ae9a6fe8b7ebadd7c6b688280915cd09d1474c (patch)
tree2f6944fb2959a982dd4daf6ebb815c261747a3dc
parent95750ed42261a97314f26739fac9935452be7afa (diff)
drm/i915: Check scratch page for stray writesscratch_page
Check scratch page contents before freeing it and report errors if any stray writes are detected. Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index a65c2c4a9785..45254faa5854 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2345,6 +2345,23 @@ static int alloc_scratch_page(struct i915_address_space *vm)
return 0;
}
+static void check_scratch_page(struct i915_address_space *vm)
+{
+ u32 i, *vaddr;
+
+ vaddr = kmap_atomic(vm->scratch_page->page);
+
+ for (i = 0; i < PAGE_SIZE / sizeof(u32); i++) {
+ if (vaddr[i] == 0xffffffff)
+ continue;
+
+ DRM_ERROR("%p scratch[%u] = 0x%08x\n", vm, i, vaddr[i]);
+ break;
+ }
+
+ kunmap_atomic(vaddr);
+}
+
static void free_scratch_page(struct i915_address_space *vm)
{
struct i915_page_scratch *sp = vm->scratch_page;
@@ -2352,6 +2369,8 @@ static void free_scratch_page(struct i915_address_space *vm)
set_pages_wb(sp->page, 1);
i915_dma_unmap_px(vm->dev, sp);
+ check_scratch_page(vm);
+
__free_page(sp->page);
kfree(sp);