[Intel-gfx] [PATCH 46/59] drm/i915: Update ring->sync_to() to take a request structure

Tomas Elf tomas.elf at intel.com
Tue Mar 31 10:03:06 PDT 2015


On 19/03/2015 12:30, John.C.Harrison at Intel.com wrote:
> From: John Harrison <John.C.Harrison at Intel.com>
>
> Updated the ring->sync_to() implementations to take a request instead of a ring.
> Also updated the tracer to include the request id.
>
> For: VIZ-5115
> Signed-off-by: John Harrison <John.C.Harrison at Intel.com>
> ---
>   drivers/gpu/drm/i915/i915_gem.c         |    4 ++--
>   drivers/gpu/drm/i915/i915_trace.h       |   14 ++++++++------
>   drivers/gpu/drm/i915/intel_ringbuffer.c |    6 ++++--
>   drivers/gpu/drm/i915/intel_ringbuffer.h |    4 ++--
>   4 files changed, 16 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 881c6ea..7304290 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -3003,8 +3003,8 @@ i915_gem_object_sync(struct drm_i915_gem_object *obj,
>   	if (ret)
>   		return ret;
>
> -	trace_i915_gem_ring_sync_to(from, to, obj->last_read_req);
> -	ret = to->semaphore.sync_to(to, from, seqno);
> +	trace_i915_gem_ring_sync_to(*to_req, from, obj->last_read_req);
> +	ret = to->semaphore.sync_to(*to_req, from, seqno);
>   	if (!ret)
>   		/* We use last_read_req because sync_to()
>   		 * might have just caused seqno wrap under
> diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
> index f044e29..8ca536c 100644
> --- a/drivers/gpu/drm/i915/i915_trace.h
> +++ b/drivers/gpu/drm/i915/i915_trace.h
> @@ -326,29 +326,31 @@ TRACE_EVENT(i915_gem_evict_vm,
>   );
>
>   TRACE_EVENT(i915_gem_ring_sync_to,
> -	    TP_PROTO(struct intel_engine_cs *from,
> -		     struct intel_engine_cs *to,
> +	    TP_PROTO(struct drm_i915_gem_request *to_req,
> +		     struct intel_engine_cs *from,
>   		     struct drm_i915_gem_request *req),
> -	    TP_ARGS(from, to, req),
> +	    TP_ARGS(to_req, from, req),
>
>   	    TP_STRUCT__entry(
>   			     __field(u32, dev)
>   			     __field(u32, sync_from)
>   			     __field(u32, sync_to)
> +			     __field(u32, uniq_to)
>   			     __field(u32, seqno)
>   			     ),
>
>   	    TP_fast_assign(
>   			   __entry->dev = from->dev->primary->index;
>   			   __entry->sync_from = from->id;
> -			   __entry->sync_to = to->id;
> +			   __entry->sync_to = to_req->ring->id;
> +			   __entry->uniq_to = to_req->uniq;
>   			   __entry->seqno = i915_gem_request_get_seqno(req);
>   			   ),
>
> -	    TP_printk("dev=%u, sync-from=%u, sync-to=%u, seqno=%u",
> +	    TP_printk("dev=%u, sync-from=%u, sync-to=%u, seqno=%u, to_uniq=%u",
>   		      __entry->dev,
>   		      __entry->sync_from, __entry->sync_to,
> -		      __entry->seqno)
> +		      __entry->seqno, __entry->uniq_to)
>   );
>
>   TRACE_EVENT(i915_gem_ring_dispatch,
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index 77d357f..2de43c8 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -1284,10 +1284,11 @@ static inline bool i915_gem_has_seqno_wrapped(struct drm_device *dev,
>    */
>
>   static int
> -gen8_ring_sync(struct intel_engine_cs *waiter,
> +gen8_ring_sync(struct drm_i915_gem_request *waiter_req,
>   	       struct intel_engine_cs *signaller,
>   	       u32 seqno)
>   {
> +	struct intel_engine_cs *waiter = waiter_req->ring;
>   	struct drm_i915_private *dev_priv = waiter->dev->dev_private;
>   	int ret;
>
> @@ -1309,10 +1310,11 @@ gen8_ring_sync(struct intel_engine_cs *waiter,
>   }
>
>   static int
> -gen6_ring_sync(struct intel_engine_cs *waiter,
> +gen6_ring_sync(struct drm_i915_gem_request *waiter_req,
>   	       struct intel_engine_cs *signaller,
>   	       u32 seqno)
>   {
> +	struct intel_engine_cs *waiter = waiter_req->ring;
>   	u32 dw1 = MI_SEMAPHORE_MBOX |
>   		  MI_SEMAPHORE_COMPARE |
>   		  MI_SEMAPHORE_REGISTER;
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
> index 2d1d8a6..1107f82 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.h
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
> @@ -222,8 +222,8 @@ struct  intel_engine_cs {
>   		};
>
>   		/* AKA wait() */
> -		int	(*sync_to)(struct intel_engine_cs *ring,
> -				   struct intel_engine_cs *to,
> +		int	(*sync_to)(struct drm_i915_gem_request *to_req,
> +				   struct intel_engine_cs *from,
>   				   u32 seqno);
>   		int	(*signal)(struct intel_engine_cs *signaller,
>   				  /* num_dwords needed by caller */
>

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

Thanks,
Tomas


More information about the Intel-gfx mailing list