[Intel-gfx] [PATCH 3/3] i965: check scratch page in a locked fashion on each ioctl

Chris Wilson chris at chris-wilson.co.uk
Tue Dec 5 10:07:09 UTC 2017


Quoting kevin.rogovin at intel.com (2017-12-05 07:48:14)
> From: Kevin Rogovin <kevin.rogovin at intel.com>
> 
> ---
>  src/mesa/drivers/dri/i965/intel_batchbuffer.c | 27 ++++++++++++++++++++++++++-
>  1 file changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> index 216073129b..53b3eaf49b 100644
> --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
> @@ -804,7 +804,8 @@ static int
>  submit_batch(struct brw_context *brw, int in_fence_fd, int *out_fence_fd)
>  {
>     const struct gen_device_info *devinfo = &brw->screen->devinfo;
> -   __DRIscreen *dri_screen = brw->screen->driScrnPriv;
> +   struct intel_screen *screen = brw->screen;
> +   __DRIscreen *dri_screen = screen->driScrnPriv;
>     struct intel_batchbuffer *batch = &brw->batch;
>     int ret = 0;
>  
> @@ -875,10 +876,34 @@ submit_batch(struct brw_context *brw, int in_fence_fd, int *out_fence_fd)
>           batch->validation_list[index] = tmp;
>        }
>  
> +      if (unlikely(screen->debug_batchbuffer.enabled)) {
> +         simple_mtx_lock(&screen->debug_batchbuffer.mutex);
> +      }

Per context, then you can remove the locking. It's fitting since the
scratch page is per-context anyway.

> +
>        ret = execbuffer(dri_screen->fd, batch, hw_ctx,
>                         4 * USED_BATCH(*batch),
>                         in_fence_fd, out_fence_fd, flags);
>  
> +      if (unlikely(screen->debug_batchbuffer.enabled)) {
> +         struct drm_i915_scratch_page sc;
> +         int ret;

Tie this into INTEL_DEBUG & SYNC, then you can do all the synchronous
operations in one place.
-Chris


More information about the Intel-gfx mailing list