Re: [PATCH 39/53] drm/i915: Update ring->emit_flush() to take a request structure

Tomas Elf
2015-03-09T20:52:01Z

On 19/02/2015 17:17, John.C.Harrison@Intel.com wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
>
> Updated the various ring->emit_flush() implementations to take a request instead
> of a ringbuf/context pair.
>
> For: VIZ-5115
> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
> ---
> drivers/gpu/drm/i915/intel_lrc.c | 17 ++++++++---------
> drivers/gpu/drm/i915/intel_ringbuffer.h | 3 +--
> 2 files changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index d8084a1..f3bf2cc 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -568,8 +568,7 @@ static int logical_ring_invalidate_all_caches(struct drm_i915_gem_request *req)
> if (ring->gpu_caches_dirty)
> flush_domains = I915_GEM_GPU_DOMAINS;
>
> - ret = ring->emit_flush(req->ringbuf, req->ctx,
> - I915_GEM_GPU_DOMAINS, flush_domains);
> + ret = ring->emit_flush(req, I915_GEM_GPU_DOMAINS, flush_domains);
> if (ret)
> return ret;
>
> @@ -776,7 +775,7 @@ int logical_ring_flush_all_caches(struct drm_i915_gem_request *req)
> if (!ring->gpu_caches_dirty)
> return 0;
>
> - ret = ring->emit_flush(req->ringbuf, req->ctx, 0, I915_GEM_GPU_DOMAINS);
> + ret = ring->emit_flush(req, 0, I915_GEM_GPU_DOMAINS);
> if (ret)
> return ret;
>
> @@ -1221,18 +1220,18 @@ static void gen8_logical_ring_put_irq(struct intel_engine_cs *ring)
> spin_unlock_irqrestore(&dev_priv->irq_lock, flags);
> }
>
> -static int gen8_emit_flush(struct intel_ringbuffer *ringbuf,
> - struct intel_context *ctx,
> +static int gen8_emit_flush(struct drm_i915_gem_request *request,
> u32 invalidate_domains,
> u32 unused)
> {
> + struct intel_ringbuffer *ringbuf = request->ringbuf;
> struct intel_engine_cs *ring = ringbuf->ring;
> struct drm_device *dev = ring->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> uint32_t cmd;
> int ret;
>
> - ret = intel_logical_ring_begin(ringbuf, ctx, 4);
> + ret = intel_logical_ring_begin(ringbuf, request->ctx, 4);
> if (ret)
> return ret;
>
> @@ -1262,11 +1261,11 @@ static int gen8_emit_flush(struct intel_ringbuffer *ringbuf,
> return 0;
> }
>
> -static int gen8_emit_flush_render(struct intel_ringbuffer *ringbuf,
> - struct intel_context *ctx,
> +static int gen8_emit_flush_render(struct drm_i915_gem_request *request,
> u32 invalidate_domains,
> u32 flush_domains)
> {
> + struct intel_ringbuffer *ringbuf = request->ringbuf;
> struct intel_engine_cs *ring = ringbuf->ring;
> u32 scratch_addr = ring->scratch.gtt_offset + 2 * CACHELINE_BYTES;
> u32 flags = 0;
> @@ -1290,7 +1289,7 @@ static int gen8_emit_flush_render(struct intel_ringbuffer *ringbuf,
> flags |= PIPE_CONTROL_GLOBAL_GTT_IVB;
> }
>
> - ret = intel_logical_ring_begin(ringbuf, ctx, 6);
> + ret = intel_logical_ring_begin(ringbuf, request->ctx, 6);
> if (ret)
> return ret;
>
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
> index c08e2dc..6f7c79c 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.h
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
> @@ -235,8 +235,7 @@ struct intel_engine_cs {
> u32 irq_keep_mask; /* bitmask for interrupts that should not be masked */
> int (*emit_request)(struct intel_ringbuffer *ringbuf,
> struct drm_i915_gem_request *request);
> - int (*emit_flush)(struct intel_ringbuffer *ringbuf,
> - struct intel_context *ctx,
> + int (*emit_flush)(struct drm_i915_gem_request *request,
> u32 invalidate_domains,
> u32 flush_domains);
> int (*emit_bb_start)(struct intel_ringbuffer *ringbuf,
>

Reviewed-by: Tomas Elf <tomas.elf@intel.com>

Thanks,
Tomas