[Intel-gfx] [PATCH v4 1/3] drm/i915: Get active pending request for given context

Chris Wilson chris at chris-wilson.co.uk
Thu Mar 14 08:55:01 UTC 2019


Quoting Ankit Navik (2019-03-14 08:36:53)
>  static inline bool i915_gem_context_is_closed(const struct i915_gem_context *ctx)
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index 02adcaf..a38963b 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -2475,6 +2475,8 @@ i915_gem_do_execbuffer(struct drm_device *dev,
>          */
>         eb.request->batch = eb.batch;
>  
> +       atomic_inc(&eb.ctx->req_cnt);
> +
>         trace_i915_request_queue(eb.request, eb.batch_flags);
>         err = eb_submit(&eb);
>  err_request:
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index 34a0866..d0af37d 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -780,6 +780,9 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
>  
>                         last = rq;
>                         submit = true;
> +
> +                       if (atomic_read(&rq->gem_context->req_cnt) > 0)
> +                               atomic_dec(&rq->gem_context->req_cnt);

Not atomic. But is this not a clue that you've got the model wrong?

If only we were already tracking requests within contexts.
-Chris


More information about the Intel-gfx mailing list