[Intel-gfx] [PATCH 2/5] drm/i915: add cpu_map to i915 object

Ben Widawsky ben at bwidawsk.net
Fri Jul 13 08:16:13 CEST 2012


mostly for convenience, this will help us clear up a bit of the code in
intel_ringbuffer.c

Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_drv.h | 1 +
 drivers/gpu/drm/i915/i915_gem.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 627fe35..ff0323c 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -988,6 +988,7 @@ struct drm_i915_gem_object {
 	 * This is the same as gtt_space->start
 	 */
 	uint32_t gtt_offset;
+	void *cpu_map; /* optional kernel mapping */
 
 	struct intel_ring_buffer *ring;
 
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 53c3946..c09df96 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3542,6 +3542,9 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj)
 	if (gem_obj->import_attach)
 		drm_prime_gem_destroy(gem_obj, obj->sg_table);
 
+	if (WARN_ON(obj->cpu_map))
+		kunmap(obj->pages[0]);
+
 	if (obj->phys_obj)
 		i915_gem_detach_phys_object(dev, obj);
 
-- 
1.7.11.1




More information about the Intel-gfx mailing list