Re: [PATCH 14/18] drm/i915: Reuse legacy breadcrumbs + tail emission

Joonas Lahtinen
2016-07-22T08:34:23Z

On ke, 2016-07-20 at 14:12 +0100, Chris Wilson wrote:
> As GEN6+ is now a simple variant on the basic breadcrumbs + tail write,
> reuse the common code.
>

Code motion could always be separate patch for easier review of what
functions were changed.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/intel_ringbuffer.c | 71 ++++++++++++++-------------------
>  1 file changed, 29 insertions(+), 42 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index 9c66745fc8d7..a74b42fc8f48 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -1414,25 +1414,18 @@ static int gen6_signal(struct drm_i915_gem_request *signaller_req)
>   return 0;
>  }
>
> -/**
> - * gen6_emit_request - Update the semaphore mailbox registers
> - *
> - * @request - request to write to the ring
> - *
> - * Update the mailbox registers in the *other* rings with the current seqno.
> - * This acts like a signal in the canonical semaphore.
> - */
> -static int gen6_emit_request(struct drm_i915_gem_request *req)
> +static void i9xx_submit_request(struct drm_i915_gem_request *request)
> +{
> + struct drm_i915_private *dev_priv = request->i915;
> +
> + I915_WRITE_TAIL(request->engine, request->tail);
> +}
> +
> +static int i9xx_emit_request(struct drm_i915_gem_request *req)
>  {
>   struct intel_ring *ring = req->ring;
>   int ret;
>
> - if (req->engine->semaphore.signal) {
> - ret = req->engine->semaphore.signal(req);
> - if (ret)
> - return ret;
> - }
> -
>   ret = intel_ring_begin(req, 4);
>   if (ret)
>   return ret;
> @@ -1448,6 +1441,27 @@ static int gen6_emit_request(struct drm_i915_gem_request *req)
>   return 0;
>  }
>
> +/**
> + * gen6_emit_request - Update the semaphore mailbox registers
> + *
> + * @request - request to write to the ring
> + *
> + * Update the mailbox registers in the *other* rings with the current seqno.
> + * This acts like a signal in the canonical semaphore.
> + */
> +static int gen6_emit_request(struct drm_i915_gem_request *req)
> +{
> + if (req->engine->semaphore.signal) {
> + int ret;
> +
> + ret = req->engine->semaphore.signal(req);
> + if (ret)
> + return ret;
> + }
> +
> + return i9xx_emit_request(req);
> +}
> +
>  static int gen8_render_emit_request(struct drm_i915_gem_request *req)
>  {
>   struct intel_engine_cs *engine = req->engine;
> @@ -1682,33 +1696,6 @@ bsd_ring_flush(struct drm_i915_gem_request *req,
>   return 0;
>  }
>
> -static int i9xx_emit_request(struct drm_i915_gem_request *req)
> -{
> - struct intel_ring *ring = req->ring;
> - int ret;
> -
> - ret = intel_ring_begin(req, 4);
> - if (ret)
> - return ret;
> -
> - intel_ring_emit(ring, MI_STORE_DWORD_INDEX);
> - intel_ring_emit(ring, I915_GEM_HWS_INDEX << MI_STORE_DWORD_INDEX_SHIFT);
> - intel_ring_emit(ring, req->fence.seqno);
> - intel_ring_emit(ring, MI_USER_INTERRUPT);
> - intel_ring_advance(ring);
> -
> - req->tail = intel_ring_get_tail(ring);
> -
> - return 0;
> -}
> -
> -static void i9xx_submit_request(struct drm_i915_gem_request *request)
> -{
> - struct drm_i915_private *dev_priv = request->i915;
> -
> - I915_WRITE_TAIL(request->engine, request->tail);
> -}
> -
>  static void
>  gen6_irq_enable(struct intel_engine_cs *engine)
>  {
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation