]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
drm/i915: OR in the COMMAND read domain for the batch buffer.
authorChris Wilson <chris@chris-wilson.co.uk>
Sat, 6 Jun 2009 08:45:58 +0000 (09:45 +0100)
committerEric Anholt <eric@anholt.net>
Tue, 9 Jun 2009 20:54:05 +0000 (13:54 -0700)
The batch buffer may be shared with another read buffer, so we should not
ignore any previously set domains, but just or in the command domain (and
check that the buffer is not writable).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
drivers/gpu/drm/i915/i915_gem.c

index ac22668b239a5b46bcedd089029e1668f7fbf876..2d705e8a297ef941c3efea403bce614d22dd69f1 100644 (file)
@@ -3369,8 +3369,12 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
 
        /* Set the pending read domains for the batch buffer to COMMAND */
        batch_obj = object_list[args->buffer_count-1];
-       batch_obj->pending_read_domains = I915_GEM_DOMAIN_COMMAND;
-       batch_obj->pending_write_domain = 0;
+       if (batch_obj->pending_write_domain) {
+               DRM_ERROR("Attempting to use self-modifying batch buffer\n");
+               ret = -EINVAL;
+               goto err;
+       }
+       batch_obj->pending_read_domains |= I915_GEM_DOMAIN_COMMAND;
 
        /* Sanity check the batch buffer, prior to moving objects */
        exec_offset = exec_list[args->buffer_count - 1].offset;