[Intel-gfx] [PATCH 2/3] drm/i915: add the FBC mutex

Chris Wilson chris at chris-wilson.co.uk
Wed Jun 17 00:52:27 PDT 2015


On Tue, Jan 02, 2001 at 04:58:58AM -0200, Paulo Zanoni wrote:
>  void intel_fbc_invalidate(struct drm_i915_private *dev_priv,
>  			  unsigned int frontbuffer_bits,
>  			  enum fb_op_origin origin)
> @@ -691,6 +725,8 @@ void intel_fbc_invalidate(struct drm_i915_private *dev_priv,
>  	if (origin == ORIGIN_GTT)
>  		return;
>  
> +	mutex_lock(&dev_priv->fbc.lock);
> +
>  	if (dev_priv->fbc.enabled)
>  		fbc_bits = INTEL_FRONTBUFFER_PRIMARY(dev_priv->fbc.crtc->pipe);
>  	else if (dev_priv->fbc.fbc_work)
> @@ -702,7 +738,9 @@ void intel_fbc_invalidate(struct drm_i915_private *dev_priv,
>  	dev_priv->fbc.busy_bits |= (fbc_bits & frontbuffer_bits);
>  
>  	if (dev_priv->fbc.busy_bits)
> -		intel_fbc_disable(dev);
> +		__intel_fbc_disable(dev);
> +
> +	mutex_unlock(&dev_priv->fbc.lock);
>  }
>  
>  void intel_fbc_flush(struct drm_i915_private *dev_priv,
> @@ -710,13 +748,18 @@ void intel_fbc_flush(struct drm_i915_private *dev_priv,
>  {
>  	struct drm_device *dev = dev_priv->dev;
>  
> +	mutex_lock(&dev_priv->fbc.lock);
> +
>  	if (!dev_priv->fbc.busy_bits)
> -		return;
> +		goto out;
>  
>  	dev_priv->fbc.busy_bits &= ~frontbuffer_bits;
>  
>  	if (!dev_priv->fbc.busy_bits)
> -		intel_fbc_update(dev);
> +		__intel_fbc_update(dev);
> +
> +out:
> +	mutex_unlock(&dev_priv->fbc.lock);
>  }

These busy bits are locked higher up. In fact I want to migrate that
lock to a spinlock, which has implications here. I didn't see anything
that mandated using a mutex for fbc, right?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list