diff options
author | Keith Packard <keithp@keithp.com> | 2006-06-21 00:15:10 +0000 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2006-06-21 00:15:10 +0000 |
commit | f8891ef802e3417c4ecda08d597e081485d75060 (patch) | |
tree | 7ccad4c8211500c1156efe72945f26bb8af71164 | |
parent | 83f256e60e44d83304df44cead6617212fe437b4 (diff) |
i915: Save vblank pipe configuration to restore on resume
-rw-r--r-- | shared-core/i915_drv.h | 1 | ||||
-rw-r--r-- | shared-core/i915_irq.c | 41 |
2 files changed, 28 insertions, 14 deletions
diff --git a/shared-core/i915_drv.h b/shared-core/i915_drv.h index 655303ef..0c3281d4 100644 --- a/shared-core/i915_drv.h +++ b/shared-core/i915_drv.h @@ -97,6 +97,7 @@ typedef struct drm_i915_private { int allow_batchbuffer; struct mem_block *agp_heap; unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds; + int vblank_pipe; } drm_i915_private_t; extern drm_ioctl_desc_t i915_ioctls[]; diff --git a/shared-core/i915_irq.c b/shared-core/i915_irq.c index 9721f49a..64b03d95 100644 --- a/shared-core/i915_irq.c +++ b/shared-core/i915_irq.c @@ -182,6 +182,28 @@ int i915_irq_wait(DRM_IOCTL_ARGS) return i915_wait_irq(dev, irqwait.irq_seq); } +static int i915_enable_interrupt (drm_device_t *dev) +{ + drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; + u16 flag; + + DRM_INFO ("Setting vblank pipe to %s %s\n", + (dev_priv->vblank_pipe & DRM_I915_VBLANK_PIPE_A) ? "A" : "", + (dev_priv->vblank_pipe & DRM_I915_VBLANK_PIPE_B) ? "B" : ""); + flag = 0; + if (dev_priv->vblank_pipe & DRM_I915_VBLANK_PIPE_A) + flag |= VSYNC_PIPEA_FLAG; + if (dev_priv->vblank_pipe & DRM_I915_VBLANK_PIPE_B) + flag |= VSYNC_PIPEB_FLAG; + if (dev_priv->vblank_pipe & ~(DRM_I915_VBLANK_PIPE_A|DRM_I915_VBLANK_PIPE_B)) { + DRM_ERROR("%s called with invalid pipe 0x%x\n", + __FUNCTION__, dev_priv->vblank_pipe); + return DRM_ERR(EINVAL); + } + I915_WRITE16(I915REG_INT_ENABLE_R, USER_INT_FLAG | flag); + return 0; +} + /* Set the vblank monitor pipe */ int i915_vblank_pipe_set(DRM_IOCTL_ARGS) @@ -189,8 +211,8 @@ int i915_vblank_pipe_set(DRM_IOCTL_ARGS) DRM_DEVICE; drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_vblank_pipe_t pipe; - u16 flag; + DRM_INFO ("%s\n", __FUNCTION__); if (!dev_priv) { DRM_ERROR("%s called with no initialization\n", __FUNCTION__); return DRM_ERR(EINVAL); @@ -199,18 +221,8 @@ int i915_vblank_pipe_set(DRM_IOCTL_ARGS) DRM_COPY_FROM_USER_IOCTL(pipe, (drm_i915_vblank_pipe_t __user *) data, sizeof(pipe)); - flag = 0; - if (pipe.pipe & DRM_I915_VBLANK_PIPE_A) - flag |= VSYNC_PIPEA_FLAG; - if (pipe.pipe & DRM_I915_VBLANK_PIPE_B) - flag |= VSYNC_PIPEB_FLAG; - if (pipe.pipe & ~(DRM_I915_VBLANK_PIPE_A|DRM_I915_VBLANK_PIPE_B)) { - DRM_ERROR("%s called with invalid pipe 0x%lx\n", - __FUNCTION__, pipe.pipe); - return DRM_ERR(EINVAL); - } - I915_WRITE16(I915REG_INT_ENABLE_R, USER_INT_FLAG | flag); - return 0; + dev_priv->vblank_pipe = pipe.pipe; + return i915_enable_interrupt (dev); } int i915_vblank_pipe_get(DRM_IOCTL_ARGS) @@ -251,7 +263,8 @@ void i915_driver_irq_postinstall(drm_device_t * dev) { drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; - I915_WRITE16(I915REG_INT_ENABLE_R, USER_INT_FLAG | VSYNC_PIPEA_FLAG); + DRM_INFO ("%s\n", __FUNCTION__); + i915_enable_interrupt(dev); DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); } |