]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
drm/i915: Don't let a device flush to prepare buffers clear new write_domains.
authorEric Anholt <eric@anholt.net>
Thu, 19 Feb 2009 22:54:51 +0000 (14:54 -0800)
committerDave Airlie <airlied@redhat.com>
Mon, 23 Feb 2009 00:06:19 +0000 (10:06 +1000)
The problem was that object_set_to_gpu_domain would set the new write_domains
that are getting set by this batchbuffer, then the accumulated flushes required
for all the objects in preparation for this batchbuffer were posted, and the
brand new write domain would get cleared by the flush being posted.  Instead,
hang on to the new (or old if we're not changing it) value and set it after
the flush is queued.

Results from this noticably included conformance test failures from reads
shortly after writes (where the new write domain had been lost and thus not
flushed and waited on), but is a suspected cause of hangs in some apps when
a write domain is lost on a buffer that gets reused for instruction or
commmand state.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/i915/i915_gem.c

index 02ef50d512d6fa9ee0d470754b833a6c37da614b..0f50574076b195b68188796d41e8f3e643553dc5 100644 (file)
@@ -2067,8 +2067,14 @@ i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj)
                i915_gem_clflush_object(obj);
        }
 
-       if ((obj->pending_write_domain | flush_domains) != 0)
-               obj->write_domain = obj->pending_write_domain;
+       /* The actual obj->write_domain will be updated with
+        * pending_write_domain after we emit the accumulated flush for all
+        * of our domain changes in execbuffers (which clears objects'
+        * write_domains).  So if we have a current write domain that we
+        * aren't changing, set pending_write_domain to that.
+        */
+       if (flush_domains == 0 && obj->pending_write_domain == 0)
+               obj->pending_write_domain = obj->write_domain;
        obj->read_domains = obj->pending_read_domains;
 
        dev->invalidate_domains |= invalidate_domains;
@@ -2598,6 +2604,12 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
                        (void)i915_add_request(dev, dev->flush_domains);
        }
 
+       for (i = 0; i < args->buffer_count; i++) {
+               struct drm_gem_object *obj = object_list[i];
+
+               obj->write_domain = obj->pending_write_domain;
+       }
+
        i915_verify_inactive(dev, __FILE__, __LINE__);
 
 #if WATCH_COHERENCY