[Intel-gfx] [PATCH] drm: Remove two leaks of vblank reference count in error paths.

Keith Packard keithp at keithp.com
Fri Oct 17 23:53:07 CEST 2008


On Fri, 2008-10-17 at 11:47 -0700, Eric Anholt wrote:
> If the failing paths were hit, the vblank IRQ would never get turned off
> again.

> 
> Signed-off-by: Eric Anholt <eric at anholt.net>
> ---
>  drivers/gpu/drm/drm_irq.c       |    5 ++++-
>  drivers/gpu/drm/i915/i915_irq.c |    1 +
>  2 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index d0c13d9..81739c7 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -597,11 +597,14 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
>  			goto done;
>  		}
>  
> +		/* Get a refcount on the vblank, which will be released by
> +		 * drm_vbl_send_signals().
> +		 */
>  		ret = drm_vblank_get(dev, crtc);
>  		if (ret) {
>  			drm_free(vbl_sig, sizeof(struct drm_vbl_sig),
>  				 DRM_MEM_DRIVER);
> -			return ret;
> +			goto done;
>  		}

This is a failure in drm_vblank_get, which should not be matched with
drm_vblank_put

>  
>  		atomic_inc(&dev->vbl_signal_pending);
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 6d0ae92..3658a04 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -768,6 +768,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data,
>  		    vbl_swap->plane == plane &&
>  		    vbl_swap->sequence == swap->sequence) {
>  			spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags);
> +			drm_vblank_put(dev, pipe);
>  			DRM_DEBUG("Already scheduled\n");
>  			return 0;
>  		}

This is in the vblank rework patch I sent out last night, but it's nice
to have it split out.

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20081017/c2456bca/attachment.sig>


More information about the Intel-gfx mailing list