summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2008-05-05 13:32:28 -0700
committerKeith Packard <keithp@keithp.com>2008-05-05 13:32:28 -0700
commit4867780bd6900293880d1db963798d075ec9b01a (patch)
treed6e4f4e4095996e02c8023e77418b66d6eb1aefc
parent4511e6cd80b4c47a142db48727753da8d0898857 (diff)
Emit clflush and chipset flush when mapping objects to gtt
-rw-r--r--linux-core/Makefile1
-rw-r--r--linux-core/i915_gem.c22
2 files changed, 20 insertions, 3 deletions
diff --git a/linux-core/Makefile b/linux-core/Makefile
index 3af6f370..fc32676f 100644
--- a/linux-core/Makefile
+++ b/linux-core/Makefile
@@ -30,6 +30,7 @@
#
# make DRM_MODULES="r128 radeon"
#
+DRM_MODULES=i915
SHELL=/bin/sh
diff --git a/linux-core/i915_gem.c b/linux-core/i915_gem.c
index 7e4e8d5f..b66c7865 100644
--- a/linux-core/i915_gem.c
+++ b/linux-core/i915_gem.c
@@ -131,7 +131,7 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
obj_priv->gtt_space->private = obj;
obj_priv->gtt_offset = obj_priv->gtt_space->start;
- DRM_DEBUG("Binding object of size %d at 0x%08x\n", obj->size, obj_priv->gtt_offset);
+ DRM_INFO ("Binding object of size %d at 0x%08x\n", obj->size, obj_priv->gtt_offset);
/* Get the list of pages out of our struct file. They'll be pinned
* at this point until we release them.
@@ -157,6 +157,10 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
return -ENOMEM;
}
}
+
+ drm_ttm_cache_flush (obj_priv->page_list, page_count);
+ DRM_MEMORYBARRIER();
+ drm_agp_chipset_flush(dev);
/* Create an AGP memory structure pointing at our pages, and bind it
* into the GTT.
@@ -172,6 +176,20 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
return -ENOMEM;
}
+ {
+ uint32_t *mem = kmap_atomic (obj_priv->page_list[0], KM_USER0);
+ volatile uint32_t *gtt = ioremap(dev->agp->base + obj_priv->gtt_offset,
+ PAGE_SIZE);
+ int i;
+
+ DRM_INFO ("object at offset %08x agp base %08x gtt addr %p\n",
+ obj_priv->gtt_offset, (int) dev->agp->base, gtt);
+ for (i = 0; i < 16; i++)
+ DRM_INFO ("%3d: mem %08x gtt %08x\n", i, mem[i], gtt[i]);
+ iounmap (gtt);
+ kunmap_atomic (mem, KM_USER0);
+ }
+
return 0;
}
@@ -434,8 +452,6 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
exec_offset = validate_list[args->buffer_count - 1].buffer_offset;
/* make sure all previous memory operations have passed */
- DRM_MEMORYBARRIER();
- drm_agp_chipset_flush(dev);
/* Exec the batchbuffer */
ret = i915_dispatch_gem_execbuffer (dev, args, exec_offset);