Re: [PATCH 09/10] drm/i915: wait render timeout ioctl

Chris Wilson
2012-04-22T09:48:37Z

On Fri, 20 Apr 2012 18:23:31 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:
> +int
> +i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
> +{
> + struct drm_i915_gem_wait *args = data;
> + struct drm_i915_gem_object *obj;
> + struct intel_ring_buffer *ring;
> + long timeout;
> + u32 seqno = 0;
> + int ret = 0;
> +
> + ret = i915_mutex_lock_interruptible(dev);
> + if (ret)
> + return ret;
> +
> + obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->bo_handle));
> + if (&obj->base == NULL) {
> + mutex_unlock(&dev->struct_mutex);
> + return -ENOENT;
> + }
> +
> + timeout = args->timeout_ns;

We discussed on IRC whether or not we needed to flush here. For the
drm_intel_gem_bo_wait_rendering() use-case, we do need to be able to first
queue a flush.

if (args->flags & I915_WAIT_FINISH)
i915_gem_object_flush_gpu_write_domain(obj);

Borrowing the terminology from glFlush/glFinish. This becomes moot if
the flushing list is ever vanquished, but still a useful distinction and
required today.
-Chris

--
Chris Wilson, Intel Open Source Technology Centre