[Intel-gfx] [PATCH 1/4] drm/i915: Record the position of the start of the request

Chris Wilson chris at chris-wilson.co.uk
Wed Aug 10 13:03:41 UTC 2016


On Wed, Aug 10, 2016 at 03:19:34PM +0300, Mika Kuoppala wrote:
> Chris Wilson <chris at chris-wilson.co.uk> writes:
> 
> > Not only does it make for good documentation and debugging aide, but it is
> > also vital for when we want to unwind requests - such as when throwing away
> > an incomplete request.
> >
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Link: http://patchwork.freedesktop.org/patch/msgid/1470414607-32453-2-git-send-email-arun.siluvery@linux.intel.com
> > ---
> >  drivers/gpu/drm/i915/i915_drv.h         |  1 +
> >  drivers/gpu/drm/i915/i915_gem_request.c | 13 +++++++++----
> >  drivers/gpu/drm/i915/i915_gpu_error.c   |  6 ++++--
> >  3 files changed, 14 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> > index feec00f769e1..040c3b6300ac 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -557,6 +557,7 @@ struct drm_i915_error_state {
> >  		struct drm_i915_error_request {
> >  			long jiffies;
> >  			u32 seqno;
> > +			u32 head;
> >  			u32 tail;
> >  		} *requests;
> >  
> > diff --git a/drivers/gpu/drm/i915/i915_gem_request.c b/drivers/gpu/drm/i915/i915_gem_request.c
> > index 6a1661643d3d..6c2553715263 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_request.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_request.c
> > @@ -391,6 +391,13 @@ i915_gem_request_alloc(struct intel_engine_cs *engine,
> >  	if (ret)
> >  		goto err_ctx;
> >  
> > +	/* Record the position of the start of the request so that
> > +	 * should we detect the updated seqno part-way through the
> > +	 * GPU processing the request, we never over-estimate the
> > +	 * position of the head.
> > +	 */
> > +	req->head = req->ring->tail;
> > +
> >  	return req;
> >  
> >  err_ctx:
> > @@ -467,8 +474,6 @@ void __i915_add_request(struct drm_i915_gem_request *request,
> >  
> >  	trace_i915_gem_request_add(request);
> >  
> > -	request->head = request_start;
> 
> Nuke the local request_start also?

Not quite. It still is used for making sure that the emission during
i915_add_request() fits within the reserved space. There is no other
convenient marker.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list