Re: [PATCH] lib: Implement gem_sync() using WAIT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 13, 2015 at 12:01:34PM +0100, Chris Wilson wrote:
> When synchronising to rendering, we only want to wait for it to complete
> and avoid the cache-domain side-effects of SET_DOMAIN if possible. This
> has the advantage of speeding up a few tests (and thereby making the
> actual test more explicit in terms of kernel operations). Of course some
> tests may be reliant on the side-effects...
> 
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>

Yeah makes tons of sense. I looked a bit through existing tests and didn't
spot any existing bad usage of gem_sync.

Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
> ---
>  lib/ioctl_wrappers.c | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> index dec45f1..000d394 100644
> --- a/lib/ioctl_wrappers.c
> +++ b/lib/ioctl_wrappers.c
> @@ -371,12 +371,22 @@ void gem_set_domain(int fd, uint32_t handle,
>   * @fd: open i915 drm file descriptor
>   * @handle: gem buffer object handle
>   *
> - * This is a wrapper around gem_set_domain() which simply blocks for any
> - * outstanding rendering to complete.
> + * This functions waits for outstanding rendering to complete.
>   */
>  void gem_sync(int fd, uint32_t handle)
>  {
> -	gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
> +	struct drm_i915_gem_wait wait;
> +
> +	memset(&wait, 0, sizeof(wait));
> +	wait.bo_handle = handle;
> +	wait.timeout_ns =-1;
> +	if (drmIoctl(fd, DRM_IOCTL_I915_GEM_WAIT, &wait) == 0) {
> +		errno = 0;
> +		return;
> +	}
> +
> +	gem_set_domain(fd, handle,
> +		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
>  }
>  
>  uint32_t __gem_create(int fd, int size)
> -- 
> 2.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux