[Intel-gfx] [PATCH 1/2 v2] drm/i915: Dumb down the semaphore logic

Keith Packard keithp at keithp.com
Wed Sep 14 05:01:40 CEST 2011


On Tue, 13 Sep 2011 19:17:56 -0700, Ben Widawsky <ben at bwidawsk.net> wrote:

> -static int
> +/**
> + * gen6_add_request - Update the semaphore mailbox registers
> + * 
> + * @ring - ring that is adding a request
> + * @mbox1_reg - mailbox address for RCS or VCS ring
> + * @mbox2_reg - mailbox address for VCS or BCS ring
> + *
> + * Update the mailbox registers in the *other* rings with the current seqno.
> + * This acts like a signal in the canonical semaphore.
> + */
> +static u32
>  gen6_add_request(struct intel_ring_buffer *ring,
> -		 u32 *result)
> +		 u32 mbox1_reg,
> +		 u32 mbox2_reg)
>  {
>  	u32 seqno;
>  	int ret;
> @@ -351,43 +350,119 @@ gen6_add_request(struct intel_ring_buffer *ring,
>  		return ret;
>  
>  	seqno = i915_gem_get_seqno(ring->dev);
> -	update_semaphore(ring, 0, seqno);
> -	update_semaphore(ring, 1, seqno);
>  
> +	update_mboxes(ring, seqno, mbox1_reg);
> +	update_mboxes(ring, seqno, mbox2_reg);
>  	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, seqno);
>  	intel_ring_emit(ring, MI_USER_INTERRUPT);
>  	intel_ring_advance(ring);
>  
> -	*result = seqno;
> +	return seqno;
> +}

This still looks like it's returning an error sometimes and a seqno
other times; I don't think you can mix those two.

> +static int
> +gen6_blt_add_request(struct intel_ring_buffer *ring,
> +		     u32 *result)
> +{
> +	struct drm_device *dev = ring->dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	*result = gen6_add_request(ring,
> +				   RBSYNC, /* render->blitter sync */
> +				   VBSYNC); /* video->blitter sync */
>  	return 0;
>  }
>  
> -int
> -intel_ring_sync(struct intel_ring_buffer *ring,
> -		struct intel_ring_buffer *to,
> +static int
> +gen6_bsd_add_request(struct intel_ring_buffer *ring,
> +		     u32 *result)
> +{
> +	struct drm_device *dev = ring->dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	*result = gen6_add_request(ring,
> +				   RVSYNC, /* video->render sync */
> +				   BVSYNC); /* video->blitter sync */
> +	return 0;
> +}
> +
> +static int
> +gen6_render_add_request(struct intel_ring_buffer *ring,
> +		        u32 *result)
> +{
> +	struct drm_device *dev = ring->dev;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	*result = gen6_add_request(ring,
> +				   VRSYNC, /* render->video sync */
> +				   BRSYNC); /* render->blitter sync */
> +	return 0;
> +}

These need to check the error return from gen6_add_request.

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20110913/fc6ea120/attachment.sig>


More information about the Intel-gfx mailing list