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

Tomas Elf
2015-03-09T22:04:23Z

On 19/02/2015 17:17, John.C.Harrison@Intel.com wrote:
> From: John Harrison <John.C.Harrison@Intel.com>
>
> Updated the various ring->signal() implementations to take a request instead of
> a ring. This removes their reliance on the OLR to obtain the seqno value that
> should be used for the signal.
>
> For: VIZ-5115
> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
> ---
> drivers/gpu/drm/i915/intel_ringbuffer.c | 20 ++++++++++----------
> drivers/gpu/drm/i915/intel_ringbuffer.h | 2 +-
> 2 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index 767bab1..440356d 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -1105,10 +1105,11 @@ static void render_ring_cleanup(struct intel_engine_cs *ring)
> intel_fini_pipe_control(ring);
> }
>
> -static int gen8_rcs_signal(struct intel_engine_cs *signaller,
> +static int gen8_rcs_signal(struct drm_i915_gem_request *signaller_req,
> unsigned int num_dwords)
> {
> #define MBOX_UPDATE_DWORDS 8
> + struct intel_engine_cs *signaller = signaller_req->ring;
> struct drm_device *dev = signaller->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_engine_cs *waiter;
> @@ -1128,8 +1129,7 @@ static int gen8_rcs_signal(struct intel_engine_cs *signaller,
> if (gtt_offset == MI_SEMAPHORE_SYNC_INVALID)
> continue;
>
> - seqno = i915_gem_request_get_seqno(
> - signaller->outstanding_lazy_request);
> + seqno = i915_gem_request_get_seqno(signaller_req);
> intel_ring_emit(signaller, GFX_OP_PIPE_CONTROL(6));
> intel_ring_emit(signaller, PIPE_CONTROL_GLOBAL_GTT_IVB |
> PIPE_CONTROL_QW_WRITE |
> @@ -1146,10 +1146,11 @@ static int gen8_rcs_signal(struct intel_engine_cs *signaller,
> return 0;
> }
>
> -static int gen8_xcs_signal(struct intel_engine_cs *signaller,
> +static int gen8_xcs_signal(struct drm_i915_gem_request *signaller_req,
> unsigned int num_dwords)
> {
> #define MBOX_UPDATE_DWORDS 6
> + struct intel_engine_cs *signaller = signaller_req->ring;
> struct drm_device *dev = signaller->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_engine_cs *waiter;
> @@ -1169,8 +1170,7 @@ static int gen8_xcs_signal(struct intel_engine_cs *signaller,
> if (gtt_offset == MI_SEMAPHORE_SYNC_INVALID)
> continue;
>
> - seqno = i915_gem_request_get_seqno(
> - signaller->outstanding_lazy_request);
> + seqno = i915_gem_request_get_seqno(signaller_req);
> intel_ring_emit(signaller, (MI_FLUSH_DW + 1) |
> MI_FLUSH_DW_OP_STOREDW);
> intel_ring_emit(signaller, lower_32_bits(gtt_offset) |
> @@ -1185,9 +1185,10 @@ static int gen8_xcs_signal(struct intel_engine_cs *signaller,
> return 0;
> }
>
> -static int gen6_signal(struct intel_engine_cs *signaller,
> +static int gen6_signal(struct drm_i915_gem_request *signaller_req,
> unsigned int num_dwords)
> {
> + struct intel_engine_cs *signaller = signaller_req->ring;
> struct drm_device *dev = signaller->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_engine_cs *useless;
> @@ -1205,8 +1206,7 @@ static int gen6_signal(struct intel_engine_cs *signaller,
> for_each_ring(useless, dev_priv, i) {
> u32 mbox_reg = signaller->semaphore.mbox.signal[i];
> if (mbox_reg != GEN6_NOSYNC) {
> - u32 seqno = i915_gem_request_get_seqno(
> - signaller->outstanding_lazy_request);
> + u32 seqno = i915_gem_request_get_seqno(signaller_req);
> intel_ring_emit(signaller, MI_LOAD_REGISTER_IMM(1));
> intel_ring_emit(signaller, mbox_reg);
> intel_ring_emit(signaller, seqno);
> @@ -1235,7 +1235,7 @@ gen6_add_request(struct drm_i915_gem_request *req)
> int ret;
>
> if (ring->semaphore.signal)
> - ret = ring->semaphore.signal(ring, 4);
> + ret = ring->semaphore.signal(req, 4);
> else
> ret = intel_ring_begin(ring, 4);
>
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
> index 65fe151..7c1e0f5 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.h
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
> @@ -222,7 +222,7 @@ struct intel_engine_cs {
> int (*sync_to)(struct drm_i915_gem_request *to_req,
> struct intel_engine_cs *from,
> u32 seqno);
> - int (*signal)(struct intel_engine_cs *signaller,
> + int (*signal)(struct drm_i915_gem_request *signaller_req,
> /* num_dwords needed by caller */
> unsigned int num_dwords);
> } semaphore;
>

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

Thanks,
Tomas