summaryrefslogtreecommitdiff
path: root/shared-core
diff options
context:
space:
mode:
authorRobert Noland <rnoland@2hip.net>2009-02-25 17:59:26 -0600
committerRobert Noland <rnoland@2hip.net>2009-02-27 18:16:17 -0600
commit957b10695b619d6ed2f1098b00502395d9a3c149 (patch)
tree73ece8ec6f01018ea9fc920ee04992ec5e0fee2b /shared-core
parent7ce8d4c1fec618ac2578ea0ddb8915b1b41ab9cb (diff)
Move vblank_init to driver load time.
Diffstat (limited to 'shared-core')
-rw-r--r--shared-core/i915_dma.c7
-rw-r--r--shared-core/i915_drv.h2
-rw-r--r--shared-core/i915_irq.c5
-rw-r--r--shared-core/mach64_drv.h1
-rw-r--r--shared-core/mach64_irq.c2
-rw-r--r--shared-core/mga_dma.c8
-rw-r--r--shared-core/mga_irq.c5
-rw-r--r--shared-core/r128_drv.h1
-rw-r--r--shared-core/r128_irq.c2
-rw-r--r--shared-core/radeon_cp.c6
-rw-r--r--shared-core/radeon_irq.c5
-rw-r--r--shared-core/via_irq.c1
-rw-r--r--shared-core/via_map.c12
13 files changed, 38 insertions, 19 deletions
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)