[Intel-gfx] [PATCH] i915: add page flipping ioctl
Jesse Barnes
jbarnes at virtuousgeek.org
Fri Feb 20 00:50:03 CET 2009
On Thursday 19 February 2009 06:55:28 Chris Wilson wrote:
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index 3795dbc..93e677a 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -435,6 +435,8 @@ EXPORT_SYMBOL(drm_vblank_get);
> */
> void drm_vblank_put(struct drm_device *dev, int crtc)
> {
> + BUG_ON (atomic_read (&dev->vblank_refcount[crtc]) == 0);
> +
> /* Last user schedules interrupt disable */
> if (atomic_dec_and_test(&dev->vblank_refcount[crtc]))
> mod_timer(&dev->vblank_disable_timer, jiffies + 5*DRM_HZ);
> @@ -460,8 +462,9 @@ void drm_vblank_pre_modeset(struct drm_device *dev,
> int crtc)
> * so that interrupts remain enabled in the interim.
> */
> if (!dev->vblank_inmodeset[crtc]) {
> - dev->vblank_inmodeset[crtc] = 1;
> - drm_vblank_get(dev, crtc);
> + dev->vblank_inmodeset[crtc] = 0x1;
> + if (drm_vblank_get(dev, crtc) == 0)
> + dev->vblank_inmodeset[crtc] |= 0x2;
> }
> }
> EXPORT_SYMBOL(drm_vblank_pre_modeset);
> @@ -473,9 +476,12 @@ void drm_vblank_post_modeset(struct drm_device
> *dev, int crtc)
> if (dev->vblank_inmodeset[crtc]) {
> spin_lock_irqsave(&dev->vbl_lock, irqflags);
> dev->vblank_disable_allowed = 1;
> - dev->vblank_inmodeset[crtc] = 0;
> spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
> - drm_vblank_put(dev, crtc);
> +
> + if (dev->vblank_inmodeset[crtc] & 0x2)
> + drm_vblank_put(dev, crtc);
> +
> + dev->vblank_inmodeset[crtc] = 0;
> }
> }
> EXPORT_SYMBOL(drm_vblank_post_modeset);
Looks fine to me; checking for errors when calling functions is probably a
good idea!
Thanks,
--
Jesse Barnes, Intel Open Source Technology Center
More information about the Intel-gfx
mailing list