diff options
-rw-r--r-- | bsd-core/drmP.h | 1 | ||||
-rw-r--r-- | bsd-core/drm_drv.c | 2 | ||||
-rw-r--r-- | bsd-core/drm_irq.c | 4 | ||||
-rw-r--r-- | bsd-core/mach64_drv.c | 7 | ||||
-rw-r--r-- | bsd-core/r128_drv.c | 6 | ||||
-rw-r--r-- | linux-core/drm_drv.c | 2 | ||||
-rw-r--r-- | linux-core/drm_irq.c | 4 | ||||
-rw-r--r-- | shared-core/i915_dma.c | 7 | ||||
-rw-r--r-- | shared-core/i915_drv.h | 2 | ||||
-rw-r--r-- | shared-core/i915_irq.c | 5 | ||||
-rw-r--r-- | shared-core/mach64_drv.h | 1 | ||||
-rw-r--r-- | shared-core/mach64_irq.c | 2 | ||||
-rw-r--r-- | shared-core/mga_dma.c | 8 | ||||
-rw-r--r-- | shared-core/mga_irq.c | 5 | ||||
-rw-r--r-- | shared-core/r128_drv.h | 1 | ||||
-rw-r--r-- | shared-core/r128_irq.c | 2 | ||||
-rw-r--r-- | shared-core/radeon_cp.c | 6 | ||||
-rw-r--r-- | shared-core/radeon_irq.c | 5 | ||||
-rw-r--r-- | shared-core/via_irq.c | 1 | ||||
-rw-r--r-- | shared-core/via_map.c | 12 |
20 files changed, 58 insertions, 25 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h index 573c2b19..69147b33 100644 --- a/bsd-core/drmP.h +++ b/bsd-core/drmP.h @@ -797,6 +797,7 @@ void drm_handle_vblank(struct drm_device *dev, int crtc); u32 drm_vblank_count(struct drm_device *dev, int crtc); int drm_vblank_get(struct drm_device *dev, int crtc); void drm_vblank_put(struct drm_device *dev, int crtc); +void drm_vblank_cleanup(struct drm_device *dev); int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); int drm_vblank_init(struct drm_device *dev, int num_crtcs); void drm_vbl_send_signals(struct drm_device *dev, int crtc); diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c index c45a4427..794f32ea 100644 --- a/bsd-core/drm_drv.c +++ b/bsd-core/drm_drv.c @@ -512,6 +512,8 @@ static void drm_unload(struct drm_device *dev) DRM_DEBUG("mtrr_del = %d", retcode); } + drm_vblank_cleanup(dev); + DRM_LOCK(); drm_lastclose(dev); DRM_UNLOCK(); diff --git a/bsd-core/drm_irq.c b/bsd-core/drm_irq.c index 8a9d3449..2ca4275e 100644 --- a/bsd-core/drm_irq.c +++ b/bsd-core/drm_irq.c @@ -93,7 +93,7 @@ static void vblank_disable_fn(void *arg) } } -static void drm_vblank_cleanup(struct drm_device *dev) +void drm_vblank_cleanup(struct drm_device *dev) { unsigned long irqflags; @@ -210,8 +210,6 @@ int drm_irq_uninstall(struct drm_device *dev) bus_teardown_intr(dev->device, dev->irqr, dev->irqh); DRM_LOCK(); - drm_vblank_cleanup(dev); - return 0; } diff --git a/bsd-core/mach64_drv.c b/bsd-core/mach64_drv.c index 1cbe5f39..f73e7730 100644 --- a/bsd-core/mach64_drv.c +++ b/bsd-core/mach64_drv.c @@ -51,6 +51,7 @@ static void mach64_configure(struct drm_device *dev) DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ; dev->driver->buf_priv_size = 1; /* No dev_priv */ + dev->driver->load = mach64_driver_load; dev->driver->lastclose = mach64_driver_lastclose; dev->driver->get_vblank_counter = mach64_get_vblank_counter; dev->driver->enable_vblank = mach64_enable_vblank; @@ -91,6 +92,12 @@ mach64_attach(device_t nbdev) return drm_attach(nbdev, mach64_pciidlist); } +int +mach64_driver_load(struct drm_device * dev, unsigned long flags) +{ + return drm_vblank_init(dev, 1); +} + static int mach64_detach(device_t nbdev) { diff --git a/bsd-core/r128_drv.c b/bsd-core/r128_drv.c index 3dbf66eb..f28bcf2c 100644 --- a/bsd-core/r128_drv.c +++ b/bsd-core/r128_drv.c @@ -49,6 +49,7 @@ static void r128_configure(struct drm_device *dev) DRIVER_SG | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ; dev->driver->buf_priv_size = sizeof(drm_r128_buf_priv_t); + dev->driver->load = r128_driver_load; dev->driver->preclose = r128_driver_preclose; dev->driver->lastclose = r128_driver_lastclose; dev->driver->get_vblank_counter = r128_get_vblank_counter; @@ -90,6 +91,11 @@ r128_attach(device_t nbdev) return drm_attach(nbdev, r128_pciidlist); } +int r128_driver_load(struct drm_device * dev, unsigned long flags) +{ + return drm_vblank_init(dev, 1); +} + static int r128_detach(device_t nbdev) { diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index 31a98fe8..a32bfa3c 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -397,6 +397,8 @@ static void drm_cleanup(struct drm_device * dev) return; } + drm_vblank_cleanup(dev); + drm_lastclose(dev); drm_fence_manager_takedown(dev); diff --git a/linux-core/drm_irq.c b/linux-core/drm_irq.c index 57419ca1..64fffd9c 100644 --- a/linux-core/drm_irq.c +++ b/linux-core/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) @@ -282,8 +282,6 @@ int drm_irq_uninstall(struct drm_device * dev) free_irq(dev->pdev->irq, dev); - drm_vblank_cleanup(dev); - dev->locked_tasklet_func = NULL; return 0; diff --git a/shared-core/i915_dma.c b/shared-core/i915_dma.c index b97b576f..9afb2e84 100644 --- a/shared-core/i915_dma.c +++ b/shared-core/i915_dma.c @@ -898,6 +898,13 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) #endif DRM_SPININIT(&dev_priv->user_irq_lock, "userirq"); + ret = drm_vblank_init(dev, I915_NUM_PIPE); + + if (ret) { + (void) i915_driver_unload(dev); + return ret; + } + return ret; } diff --git a/shared-core/i915_drv.h b/shared-core/i915_drv.h index aa97aabb..6185bcbf 100644 --- a/shared-core/i915_drv.h +++ b/shared-core/i915_drv.h @@ -46,6 +46,8 @@ enum pipe { PIPE_B, }; +#define I915_NUM_PIPE 2 + /* Interface history: * * 1.1: Original. diff --git a/shared-core/i915_irq.c b/shared-core/i915_irq.c index 50ff93a4..51c1a973 100644 --- a/shared-core/i915_irq.c +++ b/shared-core/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/shared-core/mach64_drv.h b/shared-core/mach64_drv.h index fb8a7724..6b0020ef 100644 --- a/shared-core/mach64_drv.h +++ b/shared-core/mach64_drv.h @@ -163,6 +163,7 @@ extern int mach64_dma_blit(struct drm_device *dev, void *data, extern int mach64_get_param(struct drm_device *dev, void *data, struct drm_file *file_priv); +extern int mach64_driver_load(struct drm_device * dev, unsigned long flags); extern u32 mach64_get_vblank_counter(struct drm_device *dev, int crtc); extern int mach64_enable_vblank(struct drm_device *dev, int crtc); extern void mach64_disable_vblank(struct drm_device *dev, int crtc); diff --git a/shared-core/mach64_irq.c b/shared-core/mach64_irq.c index 57879e8d..149d970a 100644 --- a/shared-core/mach64_irq.c +++ b/shared-core/mach64_irq.c @@ -143,7 +143,7 @@ void mach64_driver_irq_preinstall(struct drm_device * dev) int mach64_driver_irq_postinstall(struct drm_device * dev) { - return drm_vblank_init(dev, 1); + return 0; } void mach64_driver_irq_uninstall(struct drm_device * dev) diff --git a/shared-core/mga_dma.c b/shared-core/mga_dma.c index d56f4d7a..dab94034 100644 --- a/shared-core/mga_dma.c +++ b/shared-core/mga_dma.c @@ -396,6 +396,7 @@ int mga_freelist_put(struct drm_device * dev, struct drm_buf * buf) int mga_driver_load(struct drm_device *dev, unsigned long flags) { drm_mga_private_t *dev_priv; + int ret; dev_priv = drm_alloc(sizeof(drm_mga_private_t), DRM_MEM_DRIVER); if (!dev_priv) @@ -415,6 +416,13 @@ int mga_driver_load(struct drm_device *dev, unsigned long flags) dev->types[7] = _DRM_STAT_PRIMARY; dev->types[8] = _DRM_STAT_SECONDARY; + ret = drm_vblank_init(dev, 1); + + if (ret) { + (void) mga_driver_unload(dev); + return ret; + } + return 0; } diff --git a/shared-core/mga_irq.c b/shared-core/mga_irq.c index 4fe86322..6986ac85 100644 --- a/shared-core/mga_irq.c +++ b/shared-core/mga_irq.c @@ -154,11 +154,6 @@ void mga_driver_irq_preinstall(struct drm_device * dev) int mga_driver_irq_postinstall(struct drm_device * dev) { drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; - int ret; - - ret = drm_vblank_init(dev, 1); - if (ret) - return ret; DRM_INIT_WAITQUEUE(&dev_priv->fence_queue); diff --git a/shared-core/r128_drv.h b/shared-core/r128_drv.h index ab8b6297..9e7a6467 100644 --- a/shared-core/r128_drv.h +++ b/shared-core/r128_drv.h @@ -159,6 +159,7 @@ extern void r128_driver_irq_preinstall(struct drm_device * dev); extern int r128_driver_irq_postinstall(struct drm_device * dev); extern void r128_driver_irq_uninstall(struct drm_device * dev); extern void r128_driver_lastclose(struct drm_device * dev); +extern int r128_driver_load(struct drm_device * dev, unsigned long flags); extern void r128_driver_preclose(struct drm_device * dev, struct drm_file *file_priv); diff --git a/shared-core/r128_irq.c b/shared-core/r128_irq.c index 5b95bd89..86e5daa9 100644 --- a/shared-core/r128_irq.c +++ b/shared-core/r128_irq.c @@ -102,7 +102,7 @@ void r128_driver_irq_preinstall(struct drm_device * dev) int r128_driver_irq_postinstall(struct drm_device * dev) { - return drm_vblank_init(dev, 1); + return 0; } void r128_driver_irq_uninstall(struct drm_device * dev) diff --git a/shared-core/radeon_cp.c b/shared-core/radeon_cp.c index c4035b89..872f5891 100644 --- a/shared-core/radeon_cp.c +++ b/shared-core/radeon_cp.c @@ -1748,6 +1748,12 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags) else dev_priv->flags |= RADEON_IS_PCI; + ret = drm_vblank_init(dev, 2); + if (ret) { + radeon_driver_unload(dev); + return ret; + } + DRM_DEBUG("%s card detected\n", ((dev_priv->flags & RADEON_IS_AGP) ? "AGP" : (((dev_priv->flags & RADEON_IS_PCIE) ? "PCIE" : "PCI")))); return ret; diff --git a/shared-core/radeon_irq.c b/shared-core/radeon_irq.c index 165e7bd2..60654b2c 100644 --- a/shared-core/radeon_irq.c +++ b/shared-core/radeon_irq.c @@ -369,15 +369,10 @@ int radeon_driver_irq_postinstall(struct drm_device * dev) { drm_radeon_private_t *dev_priv = (drm_radeon_private_t *) dev->dev_private; - int ret; atomic_set(&dev_priv->swi_emitted, 0); DRM_INIT_WAITQUEUE(&dev_priv->swi_queue); - ret = drm_vblank_init(dev, 2); - if (ret) - return ret; - dev->max_vblank_count = 0x001fffff; radeon_irq_set_state(dev, RADEON_SW_INT_ENABLE, 1); diff --git a/shared-core/via_irq.c b/shared-core/via_irq.c index c3279f8b..34e3076c 100644 --- a/shared-core/via_irq.c +++ b/shared-core/via_irq.c @@ -320,7 +320,6 @@ int via_driver_irq_postinstall(struct drm_device * dev) if (!dev_priv) return -EINVAL; - drm_vblank_init(dev, 1); status = VIA_READ(VIA_REG_INTERRUPT); VIA_WRITE(VIA_REG_INTERRUPT, status | VIA_IRQ_GLOBAL | dev_priv->irq_enable_mask); diff --git a/shared-core/via_map.c b/shared-core/via_map.c index 54934367..5dee6a70 100644 --- a/shared-core/via_map.c +++ b/shared-core/via_map.c @@ -121,9 +121,19 @@ int via_driver_load(struct drm_device *dev, unsigned long chipset) ret = drm_sman_init(&dev_priv->sman, 2, 12, 8); if (ret) { drm_free(dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER); + return ret; } #endif - return ret; + + ret = drm_vblank_init(dev, 1); + if (ret) { + drm_sman_takedown(&dev_priv->sman); + drm_free(dev_priv, sizeof(drm_via_private_t), DRM_MEM_DRIVER); + return ret; + } + + return 0; + } int via_driver_unload(struct drm_device *dev) |