diff mbox

[1/2] drm/i915: add assumed cpu-dirtied flush

Message ID 1313111913-6458-1-git-send-email-ben@bwidawsk.net (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Widawsky Aug. 12, 2011, 1:18 a.m. UTC
Oops. The previous patch was the wrong one.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_drv.h            |    2 ++
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |    7 +++++++
 2 files changed, 9 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index feb4f16..2a61e63 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -879,6 +879,8 @@  struct drm_i915_gem_object {
 	 * reaches 0, dev_priv->pending_flip_queue will be woken up.
 	 */
 	atomic_t pending_flip;
+
+	atomic_t always_cpu_dirty;
 };
 
 #define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base)
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 4934cf8..b88febf 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -179,6 +179,12 @@  i915_gem_object_set_to_gpu_domain(struct drm_i915_gem_object *obj,
 		invalidate_domains |=
 			obj->base.pending_read_domains & ~obj->base.write_domain;
 	}
+
+	if (atomic_read(&obj->always_cpu_dirty)) {
+		flush_domains |= I915_GEM_DOMAIN_CPU;
+		cd->flush_domains |= I915_GEM_DOMAIN_CPU;
+	}
+
 	/*
 	 * Invalidate any read caches which may have
 	 * stale data. That is, any new read domains.
@@ -201,6 +207,7 @@  i915_gem_object_set_to_gpu_domain(struct drm_i915_gem_object *obj,
 
 	cd->invalidate_domains |= invalidate_domains;
 	cd->flush_domains |= flush_domains;
+
 	if (flush_domains & I915_GEM_GPU_DOMAINS)
 		cd->flush_rings |= obj->ring->id;
 	if (invalidate_domains & I915_GEM_GPU_DOMAINS)