[Intel-gfx] [PATCH 2/4] drm/i915: OR in the COMMAND read domain for the batch buffer.

Chris Wilson chris at chris-wilson.co.uk
Thu May 21 12:55:09 CEST 2009


On Thu, 2009-05-21 at 11:08 +0100, Chris Wilson wrote:
> 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).

At the last minute I decided to move the check and thus broke it. This
is the version that was actually tested...

diff --git a/drivers/gpu/drm/i915/i915_gem.c
b/drivers/gpu/drm/i915/i915_gem.c
index 0c5d8dd..39ed939 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3325,8 +3325,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;





More information about the Intel-gfx mailing list