diff options
author | Dave Airlie <airlied@linux.ie> | 2004-08-24 11:15:53 +0000 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2004-08-24 11:15:53 +0000 |
commit | d4dbf457813e97531ded3bf24f3b6ad421189c69 (patch) | |
tree | 8e47c1dd5d7cf9c8c4bce4a7e34531fc9a8eae75 /shared | |
parent | eac498baeaf9b57b448065b0fb9f4eeadbb9aa6b (diff) |
Merged drmfntbl-0-0-2
Diffstat (limited to 'shared')
-rw-r--r-- | shared/i915.h | 8 | ||||
-rw-r--r-- | shared/i915_dma.c | 5 | ||||
-rw-r--r-- | shared/i915_drv.h | 4 | ||||
-rw-r--r-- | shared/i915_irq.c | 8 | ||||
-rw-r--r-- | shared/mach64.h | 13 | ||||
-rw-r--r-- | shared/mach64_dma.c | 8 | ||||
-rw-r--r-- | shared/mach64_drv.h | 6 | ||||
-rw-r--r-- | shared/mach64_irq.c | 10 | ||||
-rw-r--r-- | shared/mga.h | 11 | ||||
-rw-r--r-- | shared/mga_dma.c | 8 | ||||
-rw-r--r-- | shared/mga_drv.h | 6 | ||||
-rw-r--r-- | shared/mga_irq.c | 4 | ||||
-rw-r--r-- | shared/r128.h | 13 | ||||
-rw-r--r-- | shared/r128_cce.c | 14 | ||||
-rw-r--r-- | shared/r128_drv.h | 6 | ||||
-rw-r--r-- | shared/r128_irq.c | 4 | ||||
-rw-r--r-- | shared/r128_state.c | 8 | ||||
-rw-r--r-- | shared/radeon.h | 16 | ||||
-rw-r--r-- | shared/radeon_cp.c | 16 | ||||
-rw-r--r-- | shared/radeon_drv.h | 8 | ||||
-rw-r--r-- | shared/radeon_irq.c | 4 | ||||
-rw-r--r-- | shared/radeon_state.c | 41 | ||||
-rw-r--r-- | shared/sis.h | 4 | ||||
-rw-r--r-- | shared/sis_mm.c | 1 | ||||
-rw-r--r-- | shared/tdfx.h | 2 | ||||
-rw-r--r-- | shared/via.h | 10 | ||||
-rw-r--r-- | shared/via_drv.c | 1 | ||||
-rw-r--r-- | shared/via_drv.h | 8 | ||||
-rw-r--r-- | shared/via_irq.c | 11 | ||||
-rw-r--r-- | shared/via_mm.c | 10 |
30 files changed, 140 insertions, 128 deletions
diff --git a/shared/i915.h b/shared/i915.h index a5844e4c..5a234a18 100644 --- a/shared/i915.h +++ b/shared/i915.h @@ -16,10 +16,6 @@ /* General customization: */ -#define __HAVE_AGP 1 -#define __MUST_HAVE_AGP 1 -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 #define DRIVER_AUTHOR "Tungsten Graphics, Inc." @@ -60,10 +56,6 @@ /* We use our own dma mechanisms, not the drm template code. However, * the shared IRQ code is useful to us: */ -#define __HAVE_DMA 0 -#define __HAVE_IRQ 1 -#define __HAVE_SHARED_IRQ 1 - #define __HAVE_PM 1 diff --git a/shared/i915_dma.c b/shared/i915_dma.c index 72573cbb..91de65a7 100644 --- a/shared/i915_dma.c +++ b/shared/i915_dma.c @@ -790,6 +790,11 @@ static void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp) void i915_driver_register_fns(drm_device_t *dev) { + dev->driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED; dev->fn_tbl.pretakedown = i915_driver_pretakedown; dev->fn_tbl.prerelease = i915_driver_prerelease; + dev->fn_tbl.irq_preinstall = i915_driver_irq_preinstall; + dev->fn_tbl.irq_postinstall = i915_driver_irq_postinstall; + dev->fn_tbl.irq_uninstall = i915_driver_irq_uninstall; + dev->fn_tbl.irq_handler = i915_driver_irq_handler; } diff --git a/shared/i915_drv.h b/shared/i915_drv.h index 40530eb0..4773d056 100644 --- a/shared/i915_drv.h +++ b/shared/i915_drv.h @@ -76,6 +76,10 @@ extern int i915_irq_wait( DRM_IOCTL_ARGS ); extern int i915_wait_irq(drm_device_t *dev, int irq_nr); extern int i915_emit_irq(drm_device_t *dev); +extern irqreturn_t i915_driver_irq_handler( DRM_IRQ_ARGS ); +extern void i915_driver_irq_preinstall( drm_device_t *dev ); +extern void i915_driver_irq_postinstall( drm_device_t *dev ); +extern void i915_driver_irq_uninstall( drm_device_t *dev ); /* i915_mem.c */ extern int i915_mem_alloc( DRM_IOCTL_ARGS ); diff --git a/shared/i915_irq.c b/shared/i915_irq.c index e37da827..96c7e0f5 100644 --- a/shared/i915_irq.c +++ b/shared/i915_irq.c @@ -19,7 +19,7 @@ #define READ_BREADCRUMB(dev_priv) (((u32*)(dev_priv->hw_status_page))[5]) -irqreturn_t DRM(irq_handler)( DRM_IRQ_ARGS ) +irqreturn_t i915_driver_irq_handler( DRM_IRQ_ARGS ) { drm_device_t *dev = (drm_device_t *)arg; drm_i915_private_t *dev_priv = (drm_i915_private_t *)dev->dev_private; @@ -144,7 +144,7 @@ int i915_irq_wait( DRM_IOCTL_ARGS ) /* drm_dma.h hooks */ -void DRM(driver_irq_preinstall)( drm_device_t *dev ) { +void i915_driver_irq_preinstall( drm_device_t *dev ) { drm_i915_private_t *dev_priv = (drm_i915_private_t *)dev->dev_private; @@ -153,7 +153,7 @@ void DRM(driver_irq_preinstall)( drm_device_t *dev ) { I915_WRITE16( I915REG_INT_ENABLE_R, 0x0 ); } -void DRM(driver_irq_postinstall)( drm_device_t *dev ) { +void i915_driver_irq_postinstall( drm_device_t *dev ) { drm_i915_private_t *dev_priv = (drm_i915_private_t *)dev->dev_private; @@ -161,7 +161,7 @@ void DRM(driver_irq_postinstall)( drm_device_t *dev ) { DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); } -void DRM(driver_irq_uninstall)( drm_device_t *dev ) { +void i915_driver_irq_uninstall( drm_device_t *dev ) { drm_i915_private_t *dev_priv = (drm_i915_private_t *)dev->dev_private; if (!dev_priv) diff --git a/shared/mach64.h b/shared/mach64.h index 6cfb786e..9fae3433 100644 --- a/shared/mach64.h +++ b/shared/mach64.h @@ -38,11 +38,6 @@ /* General customization: */ -#define __HAVE_AGP 1 -#define __MUST_HAVE_AGP 0 -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 -#define __HAVE_PCI_DMA 1 #define DRIVER_AUTHOR "Gareth Hughes, Leif Delgass, José Fonseca" @@ -71,12 +66,4 @@ [DRM_IOCTL_NR(DRM_IOCTL_MACH64_FLUSH)] = { mach64_dma_flush, 1, 0 }, \ [DRM_IOCTL_NR(DRM_IOCTL_MACH64_GETPARAM)] = { mach64_get_param, 1, 0 } -/* DMA customization: - */ -#define __HAVE_DMA 1 -#define __HAVE_DMA_IRQ 1 -#define __HAVE_VBL_IRQ 1 -#define __HAVE_SHARED_IRQ 1 -#define __HAVE_IRQ 1 - #endif diff --git a/shared/mach64_dma.c b/shared/mach64_dma.c index 4f90916d..210a6103 100644 --- a/shared/mach64_dma.c +++ b/shared/mach64_dma.c @@ -972,13 +972,11 @@ int mach64_do_cleanup_dma( drm_device_t *dev ) { DRM_DEBUG( "%s\n", __FUNCTION__ ); -#if _HAVE_DMA_IRQ /* Make sure interrupts are disabled here because the uninstall ioctl * may not have been called from userspace and after dev_private * is freed, it's too late. */ if ( dev->irq ) DRM(irq_uninstall)(dev); -#endif if ( dev->dev_private ) { drm_mach64_private_t *dev_priv = dev->dev_private; @@ -1335,5 +1333,11 @@ static void mach64_driver_pretakedown(drm_device_t *dev) void mach64_driver_register_fns(drm_device_t *dev) { + dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL; dev->fn_tbl.pretakedown = mach64_driver_pretakedown; + dev->fn_tbl.vblank_wait = mach64_driver_vblank_wait; + dev->fn_tbl.irq_preinstall = mach64_driver_irq_preinstall; + dev->fn_tbl.irq_postinstall = mach64_driver_irq_postinstall; + dev->fn_tbl.irq_uninstall = mach64_driver_irq_uninstall; + dev->fn_tbl.irq_handler = mach64_driver_irq_handler; } diff --git a/shared/mach64_drv.h b/shared/mach64_drv.h index d009d29e..b49e6f65 100644 --- a/shared/mach64_drv.h +++ b/shared/mach64_drv.h @@ -127,6 +127,12 @@ extern int mach64_dma_swap( DRM_IOCTL_ARGS ); extern int mach64_dma_vertex( DRM_IOCTL_ARGS ); extern int mach64_dma_blit( DRM_IOCTL_ARGS ); extern int mach64_get_param( DRM_IOCTL_ARGS ); +extern int mach64_driver_vblank_wait(drm_device_t *dev, unsigned int *sequence); + +extern irqreturn_t mach64_driver_irq_handler( DRM_IRQ_ARGS ); +extern void mach64_driver_irq_preinstall( drm_device_t *dev ); +extern void mach64_driver_irq_postinstall( drm_device_t *dev ); +extern void mach64_driver_irq_uninstall( drm_device_t *dev ); /* ================================================================ * Registers diff --git a/shared/mach64_irq.c b/shared/mach64_irq.c index 9acd6269..efa0641f 100644 --- a/shared/mach64_irq.c +++ b/shared/mach64_irq.c @@ -40,7 +40,7 @@ #include "mach64_drm.h" #include "mach64_drv.h" -irqreturn_t DRM(irq_handler)( DRM_IRQ_ARGS ) +irqreturn_t mach64_driver_irq_handler( DRM_IRQ_ARGS ) { drm_device_t *dev = (drm_device_t *) arg; drm_mach64_private_t *dev_priv = @@ -69,7 +69,7 @@ irqreturn_t DRM(irq_handler)( DRM_IRQ_ARGS ) return IRQ_NONE; } -int DRM(vblank_wait)(drm_device_t *dev, unsigned int *sequence) +int mach64_driver_vblank_wait(drm_device_t *dev, unsigned int *sequence) { unsigned int cur_vblank; int ret = 0; @@ -89,7 +89,7 @@ int DRM(vblank_wait)(drm_device_t *dev, unsigned int *sequence) /* drm_dma.h hooks */ -void DRM(driver_irq_preinstall)( drm_device_t *dev ) { +void mach64_driver_irq_preinstall( drm_device_t *dev ) { drm_mach64_private_t *dev_priv = (drm_mach64_private_t *)dev->dev_private; @@ -102,7 +102,7 @@ void DRM(driver_irq_preinstall)( drm_device_t *dev ) { | MACH64_CRTC_VBLANK_INT ); } -void DRM(driver_irq_postinstall)( drm_device_t *dev ) { +void mach64_driver_irq_postinstall( drm_device_t *dev ) { drm_mach64_private_t *dev_priv = (drm_mach64_private_t *)dev->dev_private; @@ -114,7 +114,7 @@ void DRM(driver_irq_postinstall)( drm_device_t *dev ) { } -void DRM(driver_irq_uninstall)( drm_device_t *dev ) { +void mach64_driver_irq_uninstall( drm_device_t *dev ) { drm_mach64_private_t *dev_priv = (drm_mach64_private_t *)dev->dev_private; if ( !dev_priv ) diff --git a/shared/mga.h b/shared/mga.h index f2813846..ec63e7f4 100644 --- a/shared/mga.h +++ b/shared/mga.h @@ -36,10 +36,6 @@ /* General customization: */ -#define __HAVE_AGP 1 -#define __MUST_HAVE_AGP 1 -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 #define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." @@ -69,11 +65,4 @@ #define __HAVE_COUNTER7 _DRM_STAT_PRIMARY #define __HAVE_COUNTER8 _DRM_STAT_SECONDARY -/* DMA customization: - */ -#define __HAVE_DMA 1 -#define __HAVE_IRQ 1 -#define __HAVE_VBL_IRQ 1 -#define __HAVE_SHARED_IRQ 1 - #endif diff --git a/shared/mga_dma.c b/shared/mga_dma.c index 2a095014..409f0ab7 100644 --- a/shared/mga_dma.c +++ b/shared/mga_dma.c @@ -630,13 +630,11 @@ int mga_do_cleanup_dma( drm_device_t *dev ) { DRM_DEBUG( "\n" ); -#if __HAVE_IRQ /* Make sure interrupts are disabled here because the uninstall ioctl * may not have been called from userspace and after dev_private * is freed, it's too late. */ if ( dev->irq_enabled ) DRM(irq_uninstall)(dev); -#endif if ( dev->dev_private ) { drm_mga_private_t *dev_priv = dev->dev_private; @@ -815,6 +813,12 @@ static int mga_driver_dma_quiescent(drm_device_t *dev) void mga_driver_register_fns(drm_device_t *dev) { + dev->driver_features = DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL; dev->fn_tbl.pretakedown = mga_driver_pretakedown; dev->fn_tbl.dma_quiescent = mga_driver_dma_quiescent; + dev->fn_tbl.vblank_wait = mga_driver_vblank_wait; + dev->fn_tbl.irq_preinstall = mga_driver_irq_preinstall; + dev->fn_tbl.irq_postinstall = mga_driver_irq_postinstall; + dev->fn_tbl.irq_uninstall = mga_driver_irq_uninstall; + dev->fn_tbl.irq_handler = mga_driver_irq_handler; } diff --git a/shared/mga_drv.h b/shared/mga_drv.h index 65847165..75dcb0e9 100644 --- a/shared/mga_drv.h +++ b/shared/mga_drv.h @@ -130,6 +130,12 @@ extern int mga_getparam( DRM_IOCTL_ARGS ); extern int mga_warp_install_microcode( drm_mga_private_t *dev_priv ); extern int mga_warp_init( drm_mga_private_t *dev_priv ); +extern int mga_driver_vblank_wait(drm_device_t *dev, unsigned int *sequence); +extern irqreturn_t mga_driver_irq_handler( DRM_IRQ_ARGS ); +extern void mga_driver_irq_preinstall( drm_device_t *dev ); +extern void mga_driver_irq_postinstall( drm_device_t *dev ); +extern void mga_driver_irq_uninstall( drm_device_t *dev ); + #define mga_flush_write_combine() DRM_WRITEMEMORYBARRIER() #if defined(__linux__) && defined(__alpha__) diff --git a/shared/mga_irq.c b/shared/mga_irq.c index e486618b..c3185b0b 100644 --- a/shared/mga_irq.c +++ b/shared/mga_irq.c @@ -36,7 +36,7 @@ #include "mga_drm.h" #include "mga_drv.h" -irqreturn_t mga_irq_handler( DRM_IRQ_ARGS ) +irqreturn_t mga_driver_irq_handler( DRM_IRQ_ARGS ) { drm_device_t *dev = (drm_device_t *) arg; drm_mga_private_t *dev_priv = @@ -56,7 +56,7 @@ irqreturn_t mga_irq_handler( DRM_IRQ_ARGS ) return IRQ_NONE; } -int mga_vblank_wait(drm_device_t *dev, unsigned int *sequence) +int mga_driver_vblank_wait(drm_device_t *dev, unsigned int *sequence) { unsigned int cur_vblank; int ret = 0; diff --git a/shared/r128.h b/shared/r128.h index b9d2f87e..bcee91b5 100644 --- a/shared/r128.h +++ b/shared/r128.h @@ -36,12 +36,6 @@ /* General customization: */ -#define __HAVE_AGP 1 -#define __MUST_HAVE_AGP 0 -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 -#define __HAVE_SG 1 -#define __HAVE_PCI_DMA 1 #define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." @@ -80,11 +74,4 @@ [DRM_IOCTL_NR(DRM_IOCTL_R128_GETPARAM)] = { r128_getparam, 1, 0 }, -/* DMA customization: - */ -#define __HAVE_DMA 1 -#define __HAVE_IRQ 1 -#define __HAVE_VBL_IRQ 1 -#define __HAVE_SHARED_IRQ 1 - #endif diff --git a/shared/r128_cce.c b/shared/r128_cce.c index c6c7f6d3..64c9b8be 100644 --- a/shared/r128_cce.c +++ b/shared/r128_cce.c @@ -322,7 +322,7 @@ static void r128_cce_init_ring_buffer( drm_device_t *dev, /* The manual (p. 2) says this address is in "VM space". This * means it's an offset from the start of AGP space. */ -#if __REALLY_HAVE_AGP +#if __OS_HAS_AGP if ( !dev_priv->is_pci ) ring_start = dev_priv->cce_ring->offset - dev->agp->base; else @@ -510,7 +510,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) (drm_r128_sarea_t *)((u8 *)dev_priv->sarea->handle + init->sarea_priv_offset); -#if __REALLY_HAVE_AGP +#if __OS_HAS_AGP if ( !dev_priv->is_pci ) { drm_core_ioremap( dev_priv->cce_ring, dev ); drm_core_ioremap( dev_priv->ring_rptr, dev ); @@ -533,7 +533,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) dev->agp_buffer_map->handle = (void *)dev->agp_buffer_map->offset; } -#if __REALLY_HAVE_AGP +#if __OS_HAS_AGP if ( !dev_priv->is_pci ) dev_priv->cce_buffers_offset = dev->agp->base; else @@ -558,7 +558,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) R128_WRITE( R128_LAST_DISPATCH_REG, dev_priv->sarea_priv->last_dispatch ); -#if __REALLY_HAVE_AGP +#if __OS_HAS_AGP if ( dev_priv->is_pci ) { #endif if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart, @@ -569,7 +569,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) return DRM_ERR(ENOMEM); } R128_WRITE( R128_PCI_GART_PAGE, dev_priv->bus_pci_gart ); -#if __REALLY_HAVE_AGP +#if __OS_HAS_AGP } #endif @@ -586,18 +586,16 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) int r128_do_cleanup_cce( drm_device_t *dev ) { -#if __HAVE_IRQ /* Make sure interrupts are disabled here because the uninstall ioctl * may not have been called from userspace and after dev_private * is freed, it's too late. */ if ( dev->irq_enabled ) DRM(irq_uninstall)(dev); -#endif if ( dev->dev_private ) { drm_r128_private_t *dev_priv = dev->dev_private; -#if __REALLY_HAVE_AGP +#if __OS_HAS_AGP if ( !dev_priv->is_pci ) { if ( dev_priv->cce_ring != NULL ) drm_core_ioremapfree( dev_priv->cce_ring, dev ); diff --git a/shared/r128_drv.h b/shared/r128_drv.h index 12ca9b4f..5b91256c 100644 --- a/shared/r128_drv.h +++ b/shared/r128_drv.h @@ -142,6 +142,12 @@ extern int r128_cce_depth( DRM_IOCTL_ARGS ); extern int r128_cce_stipple( DRM_IOCTL_ARGS ); extern int r128_cce_indirect( DRM_IOCTL_ARGS ); +extern int r128_driver_vblank_wait(drm_device_t *dev, unsigned int *sequence); + +extern irqreturn_t r128_driver_irq_handler( DRM_IRQ_ARGS ); +extern void r128_driver_irq_preinstall( drm_device_t *dev ); +extern void r128_driver_irq_postinstall( drm_device_t *dev ); +extern void r128_driver_irq_uninstall( drm_device_t *dev ); /* Register definitions, register access macros and drmAddMap constants * for Rage 128 kernel driver. diff --git a/shared/r128_irq.c b/shared/r128_irq.c index e77a5538..be1b9dac 100644 --- a/shared/r128_irq.c +++ b/shared/r128_irq.c @@ -36,7 +36,7 @@ #include "r128_drm.h" #include "r128_drv.h" -irqreturn_t r128_irq_handler( DRM_IRQ_ARGS ) +irqreturn_t r128_driver_irq_handler( DRM_IRQ_ARGS ) { drm_device_t *dev = (drm_device_t *) arg; drm_r128_private_t *dev_priv = @@ -56,7 +56,7 @@ irqreturn_t r128_irq_handler( DRM_IRQ_ARGS ) return IRQ_NONE; } -int DRM(vblank_wait)(drm_device_t *dev, unsigned int *sequence) +int r128_driver_vblank_wait(drm_device_t *dev, unsigned int *sequence) { unsigned int cur_vblank; int ret = 0; diff --git a/shared/r128_state.c b/shared/r128_state.c index 88d7715a..d772f173 100644 --- a/shared/r128_state.c +++ b/shared/r128_state.c @@ -1712,7 +1712,13 @@ static void r128_driver_pretakedown(drm_device_t *dev) void r128_driver_register_fns(drm_device_t *dev) { - dev->dev_priv_size = sizeof(drm_r128_buf_priv_t); + dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL; + dev->dev_priv_size = sizeof(drm_r128_buf_priv_t); dev->fn_tbl.prerelease = r128_driver_prerelease; dev->fn_tbl.pretakedown = r128_driver_pretakedown; + dev->fn_tbl.vblank_wait = r128_driver_vblank_wait; + dev->fn_tbl.irq_preinstall = r128_driver_irq_preinstall; + dev->fn_tbl.irq_postinstall = r128_driver_irq_postinstall; + dev->fn_tbl.irq_uninstall = r128_driver_irq_uninstall; + dev->fn_tbl.irq_handler = r128_driver_irq_handler; } diff --git a/shared/radeon.h b/shared/radeon.h index 39fb0be9..43723d53 100644 --- a/shared/radeon.h +++ b/shared/radeon.h @@ -37,12 +37,6 @@ /* General customization: */ -#define __HAVE_AGP 1 -#define __MUST_HAVE_AGP 0 -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 -#define __HAVE_SG 1 -#define __HAVE_PCI_DMA 1 #define DRIVER_AUTHOR "Gareth Hughes, Keith Whitwell, others." @@ -115,14 +109,4 @@ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_IRQ_WAIT)] = { radeon_irq_wait, 1, 0 }, \ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_SETPARAM)] = { radeon_cp_setparam, 1, 0 }, \ -#define DRIVER_FILE_FIELDS \ - int64_t radeon_fb_delta; \ - -/* DMA customization: - */ -#define __HAVE_DMA 1 -#define __HAVE_IRQ 1 -#define __HAVE_VBL_IRQ 1 -#define __HAVE_SHARED_IRQ 1 - #endif diff --git a/shared/radeon_cp.c b/shared/radeon_cp.c index 6987a84c..1e87ff37 100644 --- a/shared/radeon_cp.c +++ b/shared/radeon_cp.c @@ -858,7 +858,7 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev, ( ( dev_priv->gart_vm_start - 1 ) & 0xffff0000 ) | ( dev_priv->fb_location >> 16 ) ); -#if __REALLY_HAVE_AGP +#if __OS_HAS_AGP if (dev_priv->flags & CHIP_IS_AGP) { RADEON_WRITE( RADEON_MC_AGP_LOCATION, (((dev_priv->gart_vm_start - 1 + @@ -885,7 +885,7 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev, SET_RING_HEAD( dev_priv, cur_read_ptr ); dev_priv->ring.tail = cur_read_ptr; -#if __REALLY_HAVE_AGP +#if __OS_HAS_AGP if (dev_priv->flags & CHIP_IS_AGP) { /* set RADEON_AGP_BASE here instead of relying on X from user space */ RADEON_WRITE( RADEON_AGP_BASE, (unsigned int)dev->agp->base ); @@ -1146,7 +1146,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) (drm_radeon_sarea_t *)((u8 *)dev_priv->sarea->handle + init->sarea_priv_offset); -#if __REALLY_HAVE_AGP +#if __OS_HAS_AGP if ( dev_priv->flags & CHIP_IS_AGP ) { drm_core_ioremap( dev_priv->cp_ring, dev ); drm_core_ioremap( dev_priv->ring_rptr, dev ); @@ -1195,7 +1195,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) dev_priv->gart_vm_start = dev_priv->fb_location + RADEON_READ( RADEON_CONFIG_APER_SIZE ); -#if __REALLY_HAVE_AGP +#if __OS_HAS_AGP if (dev_priv->flags & CHIP_IS_AGP) dev_priv->gart_buffers_offset = (dev->agp_buffer_map->offset - dev->agp->base @@ -1224,7 +1224,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init ) dev_priv->ring.high_mark = RADEON_RING_HIGH_MARK; -#if __REALLY_HAVE_AGP +#if __OS_HAS_AGP if (dev_priv->flags & CHIP_IS_AGP) { /* Turn off PCI GART */ radeon_set_pcigart( dev_priv, 0 ); @@ -1257,15 +1257,13 @@ int radeon_do_cleanup_cp( drm_device_t *dev ) drm_radeon_private_t *dev_priv = dev->dev_private; DRM_DEBUG( "\n" ); -#if __HAVE_IRQ /* Make sure interrupts are disabled here because the uninstall ioctl * may not have been called from userspace and after dev_private * is freed, it's too late. */ if ( dev->irq_enabled ) DRM(irq_uninstall)(dev); -#endif -#if __REALLY_HAVE_AGP +#if __OS_HAS_AGP if (dev_priv->flags & CHIP_IS_AGP) { if ( dev_priv->cp_ring != NULL ) { drm_core_ioremapfree( dev_priv->cp_ring, dev ); @@ -1315,7 +1313,7 @@ static int radeon_do_resume_cp( drm_device_t *dev ) DRM_DEBUG("Starting radeon_do_resume_cp()\n"); -#if __REALLY_HAVE_AGP +#if __OS_HAS_AGP if (dev_priv->flags & CHIP_IS_AGP) { /* Turn off PCI GART */ radeon_set_pcigart( dev_priv, 0 ); diff --git a/shared/radeon_drv.h b/shared/radeon_drv.h index 4b66e5be..8c584864 100644 --- a/shared/radeon_drv.h +++ b/shared/radeon_drv.h @@ -72,6 +72,9 @@ typedef struct drm_radeon_depth_clear_t { u32 se_cntl; } drm_radeon_depth_clear_t; +struct drm_radeon_driver_file_fields { + int64_t radeon_fb_delta; +}; struct mem_block { struct mem_block *next; @@ -216,6 +219,11 @@ extern int radeon_wait_irq(drm_device_t *dev, int swi_nr); extern int radeon_emit_irq(drm_device_t *dev); extern void radeon_do_release(drm_device_t *dev); +extern int radeon_driver_vblank_wait(drm_device_t *dev, unsigned int *sequence); +extern irqreturn_t radeon_driver_irq_handler( DRM_IRQ_ARGS ); +extern void radeon_driver_irq_preinstall( drm_device_t *dev ); +extern void radeon_driver_irq_postinstall( drm_device_t *dev ); +extern void radeon_driver_irq_uninstall( drm_device_t *dev ); /* Flags for stats.boxes */ diff --git a/shared/radeon_irq.c b/shared/radeon_irq.c index 51d19493..bdb3cc16 100644 --- a/shared/radeon_irq.c +++ b/shared/radeon_irq.c @@ -54,7 +54,7 @@ * tied to dma at all, this is just a hangover from dri prehistory. */ -irqreturn_t DRM(irq_handler)( DRM_IRQ_ARGS ) +irqreturn_t radeon_driver_irq_handler( DRM_IRQ_ARGS ) { drm_device_t *dev = (drm_device_t *) arg; drm_radeon_private_t *dev_priv = @@ -141,7 +141,7 @@ int radeon_emit_and_wait_irq(drm_device_t *dev) } -int DRM(vblank_wait)(drm_device_t *dev, unsigned int *sequence) +int radeon_driver_vblank_wait(drm_device_t *dev, unsigned int *sequence) { drm_radeon_private_t *dev_priv = (drm_radeon_private_t *)dev->dev_private; diff --git a/shared/radeon_state.c b/shared/radeon_state.c index 4a7bfd2d..cdbd7a8e 100644 --- a/shared/radeon_state.c +++ b/shared/radeon_state.c @@ -43,12 +43,15 @@ static __inline__ int radeon_check_and_fixup_offset( drm_radeon_private_t *dev_p drm_file_t *filp_priv, u32 *offset ) { u32 off = *offset; + struct drm_radeon_driver_file_fields *radeon_priv; if ( off >= dev_priv->fb_location && off < ( dev_priv->gart_vm_start + dev_priv->gart_size ) ) return 0; - off += filp_priv->radeon_fb_delta; + radeon_priv = filp_priv->driver_priv; + + off += radeon_priv->radeon_fb_delta; DRM_DEBUG( "offset fixed up to 0x%x\n", off ); @@ -2525,7 +2528,8 @@ int radeon_cp_setparam( DRM_IOCTL_ARGS ) { drm_radeon_private_t *dev_priv = dev->dev_private; drm_file_t *filp_priv; drm_radeon_setparam_t sp; - + struct drm_radeon_driver_file_fields *radeon_priv; + if ( !dev_priv ) { DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); return DRM_ERR( EINVAL ); @@ -2538,7 +2542,8 @@ int radeon_cp_setparam( DRM_IOCTL_ARGS ) { switch( sp.param ) { case RADEON_SETPARAM_FB_LOCATION: - filp_priv->radeon_fb_delta = dev_priv->fb_location - sp.value; + radeon_priv = filp_priv->driver_priv; + radeon_priv->radeon_fb_delta = dev_priv->fb_location - sp.value; break; default: DRM_DEBUG( "Invalid parameter %d\n", sp.param ); @@ -2571,17 +2576,35 @@ static void radeon_driver_pretakedown(drm_device_t *dev) radeon_do_release(dev); } -static void radeon_driver_open_helper(drm_device_t *dev, drm_file_t *filp_priv) +static int radeon_driver_open_helper(drm_device_t *dev, drm_file_t *filp_priv) { drm_radeon_private_t *dev_priv = dev->dev_private; + struct drm_radeon_driver_file_fields *radeon_priv; + + radeon_priv = (struct drm_radeon_driver_file_fields *)DRM(alloc)(sizeof(*radeon_priv), DRM_MEM_FILES); + + if (!radeon_priv) + return -ENOMEM; + + filp_priv->driver_priv = radeon_priv; + if ( dev_priv ) - filp_priv->radeon_fb_delta = dev_priv->fb_location; + radeon_priv->radeon_fb_delta = dev_priv->fb_location; else - filp_priv->radeon_fb_delta = 0; + radeon_priv->radeon_fb_delta = 0; + return 0; +} + +static void radeon_driver_free_filp_private(drm_device_t *dev, drm_file_t *filp_priv) +{ + struct drm_radeon_driver_file_fields *radeon_priv = filp_priv->driver_priv; + + DRM(free)(radeon_priv, sizeof(*radeon_priv), DRM_MEM_FILES); } void radeon_driver_register_fns(struct drm_device *dev) { + dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL; dev->dev_priv_size = sizeof(drm_radeon_buf_priv_t); dev->fn_tbl.preinit = radeon_preinit; dev->fn_tbl.postinit = radeon_postinit; @@ -2589,4 +2612,10 @@ void radeon_driver_register_fns(struct drm_device *dev) dev->fn_tbl.prerelease = radeon_driver_prerelease; dev->fn_tbl.pretakedown = radeon_driver_pretakedown; dev->fn_tbl.open_helper = radeon_driver_open_helper; + dev->fn_tbl.vblank_wait = radeon_driver_vblank_wait; + dev->fn_tbl.irq_preinstall = radeon_driver_irq_preinstall; + dev->fn_tbl.irq_postinstall = radeon_driver_irq_postinstall; + dev->fn_tbl.irq_uninstall = radeon_driver_irq_uninstall; + dev->fn_tbl.irq_handler = radeon_driver_irq_handler; + dev->fn_tbl.free_filp_private = radeon_driver_free_filp_private; } diff --git a/shared/sis.h b/shared/sis.h index 8afba1a9..1b149ebc 100644 --- a/shared/sis.h +++ b/shared/sis.h @@ -37,10 +37,6 @@ /* General customization: */ -#define __HAVE_AGP 1 -#define __MUST_HAVE_AGP 0 -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 #define DRIVER_AUTHOR "SIS" #define DRIVER_NAME "sis" diff --git a/shared/sis_mm.c b/shared/sis_mm.c index 233843d5..27b904fc 100644 --- a/shared/sis_mm.c +++ b/shared/sis_mm.c @@ -411,6 +411,7 @@ int sis_final_context(struct drm_device *dev, int context) void DRM(driver_register_fns)(drm_device_t *dev) { + dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR; dev->fn_tbl.context_ctor = sis_init_context; dev->fn_tbl.context_dtor = sis_final_context; } diff --git a/shared/tdfx.h b/shared/tdfx.h index 6b067db7..a582a3db 100644 --- a/shared/tdfx.h +++ b/shared/tdfx.h @@ -36,8 +36,6 @@ /* General customization: */ -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 #define DRIVER_AUTHOR "VA Linux Systems Inc." diff --git a/shared/via.h b/shared/via.h index bf8526fd..1c09448e 100644 --- a/shared/via.h +++ b/shared/via.h @@ -27,18 +27,8 @@ #define DRM(x) viadrv_##x - -#define __HAVE_AGP 1 -#define __MUST_HAVE_AGP 0 -#define __HAVE_MTRR 1 -#define __HAVE_CTX_BITMAP 1 - /* BEAM: Have enabled DMA,DMA_IRQ and VBL_IRQ needed to do this to get standard * support for VBL_IRQ. */ -#define __HAVE_IRQ 1 -#define __HAVE_SHARED_IRQ 1 -#define __HAVE_VBL_IRQ 1 - #endif diff --git a/shared/via_drv.c b/shared/via_drv.c index 77423764..b3119f66 100644 --- a/shared/via_drv.c +++ b/shared/via_drv.c @@ -68,4 +68,5 @@ #include "drm_proc.h" #include "drm_vm.h" #include "drm_stub.h" +#include "drm_scatter.h" diff --git a/shared/via_drv.h b/shared/via_drv.h index 582eb6de..dd4a370f 100644 --- a/shared/via_drv.h +++ b/shared/via_drv.h @@ -64,6 +64,14 @@ extern int via_do_init_map(drm_device_t *dev, drm_via_init_t *init); extern int via_do_cleanup_map(drm_device_t *dev); extern int via_map_init(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); +extern int via_driver_vblank_wait(drm_device_t* dev, unsigned int* sequence); + +extern irqreturn_t via_driver_irq_handler( DRM_IRQ_ARGS ); +extern void via_driver_irq_preinstall( drm_device_t *dev ); +extern void via_driver_irq_postinstall( drm_device_t *dev ); +extern void via_driver_irq_uninstall( drm_device_t *dev ); + +extern int via_dma_cleanup(drm_device_t *dev); extern int via_dma_cleanup(drm_device_t *dev); diff --git a/shared/via_irq.c b/shared/via_irq.c index 7e540cc1..eafb1d7d 100644 --- a/shared/via_irq.c +++ b/shared/via_irq.c @@ -46,8 +46,7 @@ #define VIA_IRQ_VBI_ENABLE (1 << 19) #define VIA_IRQ_VBI_PENDING (1 << 3) -irqreturn_t DRM(irq_handler)( DRM_IRQ_ARGS ) - +irqreturn_t via_driver_irq_handler( DRM_IRQ_ARGS ) { drm_device_t* dev = (drm_device_t*)arg; drm_via_private_t* dev_priv = (drm_via_private_t*)dev->dev_private; @@ -83,7 +82,7 @@ static __inline__ void viadrv_acknowledge_irqs(drm_via_private_t* dev_priv) } } -int DRM(vblank_wait)(drm_device_t* dev, unsigned int* sequence) +int via_driver_vblank_wait(drm_device_t* dev, unsigned int* sequence) { drm_via_private_t* dev_priv = (drm_via_private_t*)dev->dev_private; unsigned int cur_vblank; @@ -112,7 +111,7 @@ int DRM(vblank_wait)(drm_device_t* dev, unsigned int* sequence) /* * drm_dma.h hooks */ -void DRM(driver_irq_preinstall)(drm_device_t* dev){ +void via_driver_irq_preinstall(drm_device_t* dev){ drm_via_private_t* dev_priv = (drm_via_private_t *)dev->dev_private; u32 status; @@ -130,7 +129,7 @@ void DRM(driver_irq_preinstall)(drm_device_t* dev){ } } -void DRM(driver_irq_postinstall)(drm_device_t* dev){ +void via_driver_irq_postinstall(drm_device_t* dev){ drm_via_private_t* dev_priv = (drm_via_private_t *)dev->dev_private; u32 status; @@ -147,7 +146,7 @@ void DRM(driver_irq_postinstall)(drm_device_t* dev){ } } -void DRM(driver_irq_uninstall)(drm_device_t* dev){ +void via_driver_irq_uninstall(drm_device_t* dev){ drm_via_private_t* dev_priv = (drm_via_private_t *)dev->dev_private; u32 status; diff --git a/shared/via_mm.c b/shared/via_mm.c index fa37e782..117cca70 100644 --- a/shared/via_mm.c +++ b/shared/via_mm.c @@ -358,6 +358,12 @@ EXPORT_SYMBOL(via_fb_free); void DRM(driver_register_fns)(drm_device_t *dev) { - dev->fn_tbl.context_ctor = via_init_context; - dev->fn_tbl.context_dtor = via_final_context; + dev->driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL; + dev->fn_tbl.context_ctor = via_init_context; + dev->fn_tbl.context_dtor = via_final_context; + dev->fn_tbl.vblank_wait = via_driver_vblank_wait; + dev->fn_tbl.irq_preinstall = via_driver_irq_preinstall; + dev->fn_tbl.irq_postinstall = via_driver_irq_postinstall; + dev->fn_tbl.irq_uninstall = via_driver_irq_uninstall; + dev->fn_tbl.irq_handler = via_driver_irq_handler; } |