[Intel-gfx] [PATCH] drm/i915: Emit to ringbuffer directly
Chris Wilson
chris at chris-wilson.co.uk
Wed Feb 8 13:36:53 UTC 2017
On Wed, Feb 08, 2017 at 01:10:56PM +0000, Tvrtko Ursulin wrote:
> @@ -2288,32 +2264,33 @@ int intel_ring_begin(struct drm_i915_gem_request *req, int num_dwords)
> ring->space -= remain_actual;
> }
>
> + out = (u32 *)(ring->vaddr + ring->tail);
Checkpatch will complain about unaligned brackets, but I'll whine that
this cast is unnecessary.
> -static inline void intel_ring_advance(struct intel_ring *ring)
> +static inline void
> +intel_ring_advance(struct drm_i915_gem_request *req, u32 *out)
> {
> + struct intel_ring *ring = req->ring;
> /* Dummy function.
> *
> * This serves as a placeholder in the code so that the reader
> @@ -519,7 +510,7 @@ static inline void intel_ring_advance(struct intel_ring *ring)
> * reserved for the command packet (i.e. the value passed to
> * intel_ring_begin()).
> */
> - GEM_BUG_ONLY_ON(ring->tail != ring->advance);
> + GEM_BUG_ON((ring->vaddr + ring->tail) != out);
This will generate a warning for an unused var if !GEM_DEBUG, just use
GEM_BUG_ON(req->ring->vaddr + req->ring->tail != out);
it'll fit, the compiler will do CSE and it's only for debug...
The transformation looked good. I'd suggest we do a trybot with
i915.mmio_flip=0 to force the MI_DISPLAY_FLIP paths to be exercised and
aside from gen2/3 that should be all intel_ring_begin() covered.
In anticipation of those extra checks performed,
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
A couple of future steps, we can eliminate some dwords by inserting the
MI_NOOP to align the tail in add_request. I
s/intel_ring_begin/i915_gem_request_emit/ for the thin veneer of oop.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list