[Intel-gfx] [PATCH] [drm] Move drm vblank initialization/cleanup to driver load/unload

Stefano Avallone stavallo at unina.it
Fri Nov 21 18:41:21 CET 2008


Hi

I applied this patch on top of kernel 2.6.28-rc5 and I found that VT switch 
works under KDE4 with composite enabled. However, suspend to disk does not 
work. After resuming, I can only see a black screen and the cursor, which I 
can move. At that point, I can only ssh into the machine and kill -9 the X 
server. Resuming from suspend to disk works fine if composite is disabled.

I have a GM965 and I am using libdrm, mesa, xserver, intel driver built from 
git master.

Please let me know if you want me to provide more information.

Regards,
Stefano


On Tuesday 18 November 2008 18:48:44 Keith Packard wrote:
> This should fix the compiz issues across vt switch (works for me).
>
> From 087e40e095de737d948f26bb1c28bba34a274fdb Mon Sep 17 00:00:00 2001
> From: Keith Packard <keithp at keithp.com>
> Date: Tue, 18 Nov 2008 09:30:25 -0800
> Subject: [PATCH] [drm] Move drm vblank initialization/cleanup to driver
> load/unload
>
> drm vblank initialization keeps track of the changes in driver-supplied
> frame counts across vt switch and mode setting, but only if you let it by
> not tearing down the drm vblank structure.
>
> Signed-off-by: Keith Packard <keithp at keithp.com>
> ---
>  drivers/gpu/drm/drm_drv.c       |    2 ++
>  drivers/gpu/drm/drm_irq.c       |    4 +---
>  drivers/gpu/drm/i915/i915_dma.c |    5 +++++
>  drivers/gpu/drm/i915/i915_drv.h |    2 ++
>  drivers/gpu/drm/i915/i915_irq.c |    5 -----
>  include/drm/drmP.h              |    1 +
>  6 files changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 3ab1e9c..996097a 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -305,6 +305,8 @@ static void drm_cleanup(struct drm_device * dev)
>  		return;
>  	}
>
> +	drm_vblank_cleanup(dev);
> +
>  	drm_lastclose(dev);
>
>  	if (drm_core_has_MTRR(dev) && drm_core_has_AGP(dev) &&
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index 15c8dab..1e787f8 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -94,7 +94,7 @@ static void vblank_disable_fn(unsigned long arg)
>  	}
>  }
>
> -static void drm_vblank_cleanup(struct drm_device *dev)
> +void drm_vblank_cleanup(struct drm_device *dev)
>  {
>  	/* Bail if the driver didn't call drm_vblank_init() */
>  	if (dev->num_crtcs == 0)
> @@ -278,8 +278,6 @@ int drm_irq_uninstall(struct drm_device * dev)
>
>  	free_irq(dev->pdev->irq, dev);
>
> -	drm_vblank_cleanup(dev);
> -
>  	return 0;
>  }
>  EXPORT_SYMBOL(drm_irq_uninstall);
> diff --git a/drivers/gpu/drm/i915/i915_dma.c
> b/drivers/gpu/drm/i915/i915_dma.c index 0d215e3..9a1450e 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -856,6 +856,11 @@ int i915_driver_load(struct drm_device *dev, unsigned
> long flags)
>
>  	spin_lock_init(&dev_priv->user_irq_lock);
>
> +	ret = drm_vblank_init(dev, I915_NUM_PIPE);
> +
> +	if (ret)
> +		return ret;
> +
>  	return ret;
>  }
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h
> b/drivers/gpu/drm/i915/i915_drv.h index 3c9248b..9bb6803 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -47,6 +47,8 @@ enum pipe {
>  	PIPE_B,
>  };
>
> +#define I915_NUM_PIPE	2
> +
>  /* Interface history:
>   *
>   * 1.1: Original.
> diff --git a/drivers/gpu/drm/i915/i915_irq.c
> b/drivers/gpu/drm/i915/i915_irq.c index b7e1a04..7965043 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -481,11 +481,6 @@ void i915_driver_irq_preinstall(struct drm_device *
> dev) int i915_driver_irq_postinstall(struct drm_device *dev)
>  {
>  	drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
> -	int ret, num_pipes = 2;
> -
> -	ret = drm_vblank_init(dev, num_pipes);
> -	if (ret)
> -		return ret;
>
>  	dev_priv->vblank_pipe = DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B;
>
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 28c7f16..d5e8e5c 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -1151,6 +1151,7 @@ extern u32 drm_vblank_count(struct drm_device *dev,
> int crtc); extern void drm_handle_vblank(struct drm_device *dev, int crtc);
>  extern int drm_vblank_get(struct drm_device *dev, int crtc);
>  extern void drm_vblank_put(struct drm_device *dev, int crtc);
> +extern void drm_vblank_cleanup(struct drm_device *dev);
>  /* Modesetting support */
>  extern int drm_modeset_ctl(struct drm_device *dev, void *data,
>  			   struct drm_file *file_priv);
> --
> 1.5.6.5




More information about the Intel-gfx mailing list