[Intel-gfx] [PATCH 3/3] drm/i915: Track & check calls to intel(_logical)_ring_{begin, advance}

Chris Wilson chris at chris-wilson.co.uk
Fri Dec 12 09:12:39 PST 2014


On Fri, Dec 12, 2014 at 04:13:03PM +0000, Dave Gordon wrote:
>  static inline void intel_ring_advance(struct intel_engine_cs *ring)
>  {
>  	struct intel_ringbuffer *ringbuf = ring->buffer;
> -	ringbuf->tail &= ringbuf->size - 1;
> +
> +	__intel_ringbuffer_check(ringbuf);
> +
> +	/*
> +	 * Tail == effecive_size is legitimate (buffer exactly full).
> +	 * Tail > effective_size is not, and should give a warning,
> +	 * but we'll reset tail in both cases to prevent further chaos
> +	 */
> +	if (ringbuf->tail >= ringbuf->effective_size)
> +		ringbuf->tail -= ringbuf->effective_size;

Urm. No. If you never write into the reserved pair of cachelines at the
end of the ringbuffer but the hw reads garbage from it, you lose.
tail &= size - 1; is a nice description of how the hw works that is
suitable for inlining, with all the magic in begin().

The goal is to remove the duplicated logic from intel_lrc.c, use
requests completely, and remove the dri1 hangover. To repeat what I said
last time:
http://cgit.freedesktop.org/~ickle/linux-2.6/tree/drivers/gpu/drm/i915/intel_ringbuffer.c?h=requests#n2447
is where I want us to go, a single piece of logic for ring management.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list