Commit 3e6242b5 authored by Dave Airlie's avatar Dave Airlie

Initial DRM function table removes some if the DRIVER_ macros.

Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent b94b0c54
......@@ -610,6 +610,24 @@ typedef struct drm_vbl_sig {
#endif
/**
* DRM device functions structure
*/
struct drm_device;
struct drm_driver_fn {
int (*preinit)(struct drm_device *);
int (*postinit)(struct drm_device *);
void (*prerelease)(struct drm_device *, struct file *filp);
void (*pretakedown)(struct drm_device *);
int (*postcleanup)(struct drm_device *);
int (*presetup)(struct drm_device *);
int (*postsetup)(struct drm_device *);
void (*open_helper)(struct drm_device *, drm_file_t *);
void (*release)(struct drm_device *, struct file *filp);
void (*dma_ready)(struct drm_device *);
int (*dma_quiescent)(struct drm_device *);
};
/**
* DRM device structure.
*/
......@@ -738,8 +756,12 @@ typedef struct drm_device {
void *dev_private; /**< device private data */
drm_sigdata_t sigdata; /**< For block_all_signals */
sigset_t sigmask;
struct drm_driver_fn fn_tbl;
} drm_device_t;
extern void DRM(driver_register_fns)(struct drm_device *dev);
/******************************************************************/
/** \name Internal function definitions */
......
......@@ -70,18 +70,6 @@
#ifndef __HAVE_DMA_SCHEDULE
#define __HAVE_DMA_SCHEDULE 0
#endif
#ifndef __HAVE_DMA_FLUSH
#define __HAVE_DMA_FLUSH 0
#endif
#ifndef __HAVE_DMA_READY
#define __HAVE_DMA_READY 0
#endif
#ifndef __HAVE_DMA_QUIESCENT
#define __HAVE_DMA_QUIESCENT 0
#endif
#ifndef __HAVE_RELEASE
#define __HAVE_RELEASE 0
#endif
#ifndef __HAVE_COUNTERS
#define __HAVE_COUNTERS 0
#endif
......@@ -102,33 +90,9 @@
#define __HAVE_DRIVER_FOPS_POLL 0
#endif
#ifndef DRIVER_PREINIT
#define DRIVER_PREINIT()
#endif
#ifndef DRIVER_POSTINIT
#define DRIVER_POSTINIT()
#endif
#ifndef DRIVER_PRERELEASE
#define DRIVER_PRERELEASE()
#endif
#ifndef DRIVER_PRETAKEDOWN
#define DRIVER_PRETAKEDOWN()
#endif
#ifndef DRIVER_POSTCLEANUP
#define DRIVER_POSTCLEANUP()
#endif
#ifndef DRIVER_PRESETUP
#define DRIVER_PRESETUP()
#endif
#ifndef DRIVER_POSTSETUP
#define DRIVER_POSTSETUP()
#endif
#ifndef DRIVER_IOCTLS
#define DRIVER_IOCTLS
#endif
#ifndef DRIVER_OPEN_HELPER
#define DRIVER_OPEN_HELPER( priv, dev )
#endif
#ifndef DRIVER_FOPS
#define DRIVER_FOPS \
static struct file_operations DRM(fops) = { \
......@@ -169,7 +133,7 @@ static int DRM(numdevs) = 0;
DRIVER_FOPS;
/** Ioctl table */
static drm_ioctl_desc_t DRM(ioctls)[] = {
drm_ioctl_desc_t DRM(ioctls)[] = {
[DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { DRM(version), 0, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { DRM(getunique), 0, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { DRM(getmagic), 0, 0 },
......@@ -208,12 +172,7 @@ static drm_ioctl_desc_t DRM(ioctls)[] = {
[DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { DRM(lock), 1, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { DRM(unlock), 1, 0 },
#if __HAVE_DMA_FLUSH
/* Gamma only, really */
[DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { DRM(finish), 1, 0 },
#else
[DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { DRM(noop), 1, 0 },
#endif
#if __HAVE_DMA
[DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = { DRM(addbufs), 1, 1 },
......@@ -265,7 +224,9 @@ static int DRM(setup)( drm_device_t *dev )
{
int i;
DRIVER_PRESETUP();
if (dev->fn_tbl.presetup)
dev->fn_tbl.presetup(dev);
atomic_set( &dev->ioctl_count, 0 );
atomic_set( &dev->vma_count, 0 );
dev->buf_use = 0;
......@@ -371,7 +332,9 @@ static int DRM(setup)( drm_device_t *dev )
* drm_select_queue fails between the time the interrupt is
* initialized and the time the queues are initialized.
*/
DRIVER_POSTSETUP();
if (dev->fn_tbl.postsetup)
dev->fn_tbl.postsetup(dev);
return 0;
}
......@@ -396,7 +359,9 @@ static int DRM(takedown)( drm_device_t *dev )
DRM_DEBUG( "\n" );
DRIVER_PRETAKEDOWN();
if (dev->fn_tbl.pretakedown)
dev->fn_tbl.pretakedown(dev);
#if __HAVE_IRQ
if ( dev->irq_enabled ) DRM(irq_uninstall)( dev );
#endif
......@@ -594,7 +559,10 @@ static int DRM(probe)(struct pci_dev *pdev)
dev->pci_func = PCI_FUNC(pdev->devfn);
dev->irq = pdev->irq;
DRIVER_PREINIT();
DRM(driver_register_fns)(dev);
if (dev->fn_tbl.preinit)
dev->fn_tbl.preinit(dev);
#if __REALLY_HAVE_AGP
dev->agp = DRM(agp_init)();
......@@ -635,7 +603,8 @@ static int DRM(probe)(struct pci_dev *pdev)
dev->minor,
pci_pretty_name(pdev));
DRIVER_POSTINIT();
if (dev->fn_tbl.postinit)
dev->fn_tbl.postinit(dev);
return 0;
}
......@@ -718,8 +687,10 @@ static void __exit drm_cleanup( void )
dev->agp = NULL;
}
#endif
if (dev->fn_tbl.postcleanup)
dev->fn_tbl.postcleanup(dev);
}
DRIVER_POSTCLEANUP();
DRM(numdevs) = 0;
}
......@@ -834,7 +805,8 @@ int DRM(release)( struct inode *inode, struct file *filp )
DRM_DEBUG( "open_count = %d\n", dev->open_count );
DRIVER_PRERELEASE();
if (dev->fn_tbl.prerelease)
dev->fn_tbl.prerelease(dev, filp);
/* ========================================================
* Begin inline drm_release
......@@ -849,9 +821,10 @@ int DRM(release)( struct inode *inode, struct file *filp )
DRM_DEBUG( "File %p released, freeing lock for context %d\n",
filp,
_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) );
#if __HAVE_RELEASE
DRIVER_RELEASE();
#endif
if (dev->fn_tbl.release)
dev->fn_tbl.release(dev, filp);
DRM(lock_free)( dev, &dev->lock.hw_lock->lock,
_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) );
......@@ -860,8 +833,7 @@ int DRM(release)( struct inode *inode, struct file *filp )
processed via a callback to the X
server. */
}
#if __HAVE_RELEASE
else if ( priv->lock_count && dev->lock.hw_lock ) {
else if ( dev->fn_tbl.release && priv->lock_count && dev->lock.hw_lock ) {
/* The lock is required to reclaim buffers */
DECLARE_WAITQUEUE( entry, current );
......@@ -890,12 +862,14 @@ int DRM(release)( struct inode *inode, struct file *filp )
current->state = TASK_RUNNING;
remove_wait_queue( &dev->lock.lock_queue, &entry );
if( !retcode ) {
DRIVER_RELEASE();
if (dev->fn_tbl.release)
dev->fn_tbl.release(dev, filp);
DRM(lock_free)( dev, &dev->lock.hw_lock->lock,
DRM_KERNEL_CONTEXT );
}
}
#elif __HAVE_DMA
#if __HAVE_DMA
DRM(reclaim_buffers)( filp );
#endif
......@@ -1067,74 +1041,59 @@ int DRM(lock)( struct inode *inode, struct file *filp,
q = dev->queuelist[lock.context];
#endif
#if __HAVE_DMA_FLUSH
ret = DRM(flush_block_and_flush)( dev, lock.context, lock.flags );
#endif
if ( !ret ) {
add_wait_queue( &dev->lock.lock_queue, &entry );
for (;;) {
current->state = TASK_INTERRUPTIBLE;
if ( !dev->lock.hw_lock ) {
/* Device has been unregistered */
ret = -EINTR;
break;
}
if ( DRM(lock_take)( &dev->lock.hw_lock->lock,
lock.context ) ) {
dev->lock.filp = filp;
dev->lock.lock_time = jiffies;
atomic_inc( &dev->counts[_DRM_STAT_LOCKS] );
break; /* Got lock */
}
/* Contention */
schedule();
if ( signal_pending( current ) ) {
ret = -ERESTARTSYS;
break;
}
}
current->state = TASK_RUNNING;
remove_wait_queue( &dev->lock.lock_queue, &entry );
}
#if __HAVE_DMA_FLUSH
DRM(flush_unblock)( dev, lock.context, lock.flags ); /* cleanup phase */
#endif
if ( !ret ) {
sigemptyset( &dev->sigmask );
sigaddset( &dev->sigmask, SIGSTOP );
sigaddset( &dev->sigmask, SIGTSTP );
sigaddset( &dev->sigmask, SIGTTIN );
sigaddset( &dev->sigmask, SIGTTOU );
dev->sigdata.context = lock.context;
dev->sigdata.lock = dev->lock.hw_lock;
block_all_signals( DRM(notifier),
&dev->sigdata, &dev->sigmask );
#if __HAVE_DMA_READY
if ( lock.flags & _DRM_LOCK_READY ) {
DRIVER_DMA_READY();
add_wait_queue( &dev->lock.lock_queue, &entry );
for (;;) {
current->state = TASK_INTERRUPTIBLE;
if ( !dev->lock.hw_lock ) {
/* Device has been unregistered */
ret = -EINTR;
break;
}
#endif
#if __HAVE_DMA_QUIESCENT
if ( lock.flags & _DRM_LOCK_QUIESCENT ) {
DRIVER_DMA_QUIESCENT();
if ( DRM(lock_take)( &dev->lock.hw_lock->lock,
lock.context ) ) {
dev->lock.filp = filp;
dev->lock.lock_time = jiffies;
atomic_inc( &dev->counts[_DRM_STAT_LOCKS] );
break; /* Got lock */
}
#endif
/* __HAVE_KERNEL_CTX_SWITCH isn't used by any of the
* drm modules in the DRI cvs tree, but it is required
* by the Sparc driver.
*/
#if __HAVE_KERNEL_CTX_SWITCH
if ( dev->last_context != lock.context ) {
DRM(context_switch)(dev, dev->last_context,
lock.context);
/* Contention */
schedule();
if ( signal_pending( current ) ) {
ret = -ERESTARTSYS;
break;
}
}
current->state = TASK_RUNNING;
remove_wait_queue( &dev->lock.lock_queue, &entry );
sigemptyset( &dev->sigmask );
sigaddset( &dev->sigmask, SIGSTOP );
sigaddset( &dev->sigmask, SIGTSTP );
sigaddset( &dev->sigmask, SIGTTIN );
sigaddset( &dev->sigmask, SIGTTOU );
dev->sigdata.context = lock.context;
dev->sigdata.lock = dev->lock.hw_lock;
block_all_signals( DRM(notifier),
&dev->sigdata, &dev->sigmask );
if (dev->fn_tbl.dma_ready && (lock.flags & _DRM_LOCK_READY))
dev->fn_tbl.dma_ready(dev);
if ( dev->fn_tbl.dma_quiescent && (lock.flags & _DRM_LOCK_QUIESCENT ))
return dev->fn_tbl.dma_quiescent(dev);
/* __HAVE_KERNEL_CTX_SWITCH isn't used by any of the
* drm modules in the DRI cvs tree, but it is required
* by the Sparc driver.
*/
#if __HAVE_KERNEL_CTX_SWITCH
if ( dev->last_context != lock.context ) {
DRM(context_switch)(dev, dev->last_context,
lock.context);
}
#endif
}
DRM_DEBUG( "%d %s\n", lock.context, ret ? "interrupted" : "has lock" );
return ret;
......
......@@ -72,7 +72,8 @@ int DRM(open_helper)(struct inode *inode, struct file *filp, drm_device_t *dev)
priv->authenticated = capable(CAP_SYS_ADMIN);
priv->lock_count = 0;
DRIVER_OPEN_HELPER( priv, dev );
if (dev->fn_tbl.open_helper)
dev->fn_tbl.open_helper(dev, priv);
down(&dev->struct_sem);
if (!dev->file_last) {
......
......@@ -11,6 +11,6 @@
/* General customization:
*/
#define __HAVE_KERNEL_CTX_SWITCH 1
#define __HAVE_RELEASE 1
#endif
......@@ -537,3 +537,43 @@ int DRM(rmctx)(struct inode *inode, struct file *filp, unsigned int cmd,
}
return 0;
}
static void ffb_driver_release(drm_device_t *dev)
{
ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
int context = _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock);
int idx;
idx = context - 1;
if (fpriv &&
context != DRM_KERNEL_CONTEXT &&
fpriv->hw_state[idx] != NULL) {
kfree(fpriv->hw_state[idx]);
fpriv->hw_state[idx] = NULL;
}
}
static int ffb_driver_presetup(drm_device_t *dev)
{
int ret;
ret = ffb_presetup(dev);
if (_ret != 0) return ret;
}
static void ffb_driver_pretakedown(drm_device_t *dev)
{
if (dev->dev_private) kfree(dev->dev_private);
}
static void ffb_driver_postcleanup(drm_device_t *dev)
{
if (ffb_position != NULL) kfree(ffb_position);
}
static void ffb_driver_register_fns(drm_device_t *dev)
{
dev->fn_tbl.release = ffb_driver_release;
dev->fn_tbl.presetup = ffb_driver_presetup;
dev->fn_tbl.pretakedown = ffb_driver_pretakedown;
dev->fn_tbl.postcleanup = ffb_driver_postcleanup;
}
......@@ -41,38 +41,6 @@ static struct file_operations DRM(fops) = { \
}
#define DRIVER_COUNT_CARDS() ffb_count_card_instances()
/* Allocate private structure and fill it */
#define DRIVER_PRESETUP() do { \
int _ret; \
_ret = ffb_presetup(dev); \
if (_ret != 0) return _ret; \
} while(0)
/* Free private structure */
#define DRIVER_PRETAKEDOWN() do { \
if (dev->dev_private) kfree(dev->dev_private); \
} while(0)
#define DRIVER_POSTCLEANUP() do { \
if (ffb_position != NULL) kfree(ffb_position); \
} while(0)
/* We have to free up the rogue hw context state holding error or
* else we will leak it.
*/
#define DRIVER_RELEASE() do { \
ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private; \
int context = _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock); \
int idx; \
\
idx = context - 1; \
if (fpriv && \
context != DRM_KERNEL_CONTEXT && \
fpriv->hw_state[idx] != NULL) { \
kfree(fpriv->hw_state[idx]); \
fpriv->hw_state[idx] = NULL; \
} \
} while(0)
/* For mmap customization */
#define DRIVER_GET_MAP_OFS() (map->offset & 0xffffffff)
......
......@@ -86,24 +86,8 @@
#define __HAVE_DMA_WAITLIST 1
#define __HAVE_DMA_FREELIST 1
#define __HAVE_DMA_FLUSH 1
#define __HAVE_DMA_SCHEDULE 1
#define __HAVE_DMA_READY 1
#define DRIVER_DMA_READY() do { \
gamma_dma_ready(dev); \
} while (0)
#define __HAVE_DMA_QUIESCENT 1
#define DRIVER_DMA_QUIESCENT() do { \
drm_gamma_private_t *dev_priv = \
(drm_gamma_private_t *)dev->dev_private; \
if (dev_priv->num_rast == 2) \
gamma_dma_quiescent_dual(dev); \
else gamma_dma_quiescent_single(dev); \
return 0; \
} while (0)
#define __HAVE_IRQ 1
#define __HAVE_IRQ_BH 1
......
......@@ -904,3 +904,42 @@ void DRM(driver_irq_uninstall)( drm_device_t *dev ) {
GAMMA_WRITE( GAMMA_COMMANDINTENABLE, 0x00000000 );
GAMMA_WRITE( GAMMA_GINTENABLE, 0x00000000 );
}
extern drm_ioctl_desc_t DRM(ioctls)[];
static int gamma_driver_preinit(drm_device_t *dev)
{
/* reset the finish ioctl */
DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_FINISH)].func = DRM(finish);
return 0;
}
static void gamma_driver_pretakedown(drm_device_t *dev)
{
gamma_do_cleanup_dma(dev);
}
static void gamma_driver_dma_ready(drm_device_t *dev)
{
gamma_dma_ready(dev);
}
static int gamma_driver_dma_quiescent(drm_device_t *dev)
{
drm_gamma_private_t *dev_priv = (
drm_gamma_private_t *)dev->dev_private;
if (dev_priv->num_rast == 2)
gamma_dma_quiescent_dual(dev);
else gamma_dma_quiescent_single(dev);
return 0;
}
void gamma_driver_register_fns(drm_device_t *dev)
{
dev->fn_tbl.preinit = gamma_driver_preinit;
dev->fn_tbl.pretakedown = gamma_driver_pretakedown;
dev->fn_tbl.dma_ready = gamma_driver_dma_ready;
dev->fn_tbl.dma_quiescent = gamma_driver_dma_quiescent;
dev->fn_tbl.dma_flush_block_and_flush = gamma_flush_block_and_flush;
dev->fn_tbl.dma_flush_unblock = gamma_flush_unblock;
}
......@@ -84,17 +84,6 @@
#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY
#define __HAVE_COUNTER9 _DRM_STAT_DMA
/* Driver customization:
*/
#define __HAVE_RELEASE 1
#define DRIVER_RELEASE() do { \
i810_reclaim_buffers( filp ); \
} while (0)
#define DRIVER_PRETAKEDOWN() do { \
i810_dma_cleanup( dev ); \
} while (0)
/* DMA customization:
*/
#define __HAVE_DMA 1
......@@ -102,11 +91,6 @@
#define __HAVE_DMA_WAITLIST 0
#define __HAVE_DMA_RECLAIM 1
#define __HAVE_DMA_QUIESCENT 1
#define DRIVER_DMA_QUIESCENT() do { \
i810_dma_quiescent( dev ); \
} while (0)
/* Don't need an irq any more. The template code will make sure that
* a noop stub is generated for compatibility.
*/
......
......@@ -1388,3 +1388,27 @@ int i810_flip_bufs(struct inode *inode, struct file *filp,
i810_dma_dispatch_flip( dev );
return 0;
}
static void i810_driver_pretakedown(drm_device_t *dev)
{
i810_dma_cleanup( dev );
}
static void i810_driver_release(drm_device_t *dev, struct file *filp)
{
i810_reclaim_buffers(filp);
}
static int i810_driver_dma_quiescent(drm_device_t *dev)
{
i810_dma_quiescent( dev );
return 0;
}
void i810_driver_register_fns(drm_device_t *dev)
{
dev->fn_tbl.pretakedown = i810_driver_pretakedown;
dev->fn_tbl.release = i810_driver_release;
dev->fn_tbl.dma_quiescent = i810_driver_dma_quiescent;
}
......@@ -83,17 +83,6 @@
#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY
#define __HAVE_COUNTER9 _DRM_STAT_DMA
/* Driver customization:
*/
#define __HAVE_RELEASE 1
#define DRIVER_RELEASE() do { \
i830_reclaim_buffers( filp ); \
} while (0)
#define DRIVER_PRETAKEDOWN() do { \
i830_dma_cleanup( dev ); \
} while (0)
/* DMA customization:
*/
#define __HAVE_DMA 1
......@@ -101,12 +90,6 @@
#define __HAVE_DMA_WAITLIST 0
#define __HAVE_DMA_RECLAIM 1
#define __HAVE_DMA_QUIESCENT 1
#define DRIVER_DMA_QUIESCENT() do { \
i830_dma_quiescent( dev ); \
} while (0)
/* Driver will work either way: IRQ's save cpu time when waiting for
* the card, but are subject to subtle interactions between bios,
* hardware and the driver.
......
......@@ -1582,3 +1582,28 @@ int i830_setparam( struct inode *inode, struct file *filp, unsigned int cmd,
return 0;
}
static void i830_driver_pretakedown(drm_device_t *dev)
{
i830_dma_cleanup( dev );
}
static void i830_driver_release(drm_device_t *dev, struct file *filp)
{
i830_reclaim_buffers(filp);
}
static int i830_driver_dma_quiescent(drm_device_t *dev)
{
i830_dma_quiescent( dev );
return 0;
}
void i830_driver_register_fns(drm_device_t *dev)
{
dev->fn_tbl.pretakedown = i830_driver_pretakedown;
dev->fn_tbl.release = i830_driver_release;
dev->fn_tbl.dma_quiescent = i830_driver_dma_quiescent;
}
......@@ -55,27 +55,6 @@
#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY
#define __HAVE_COUNTER9 _DRM_STAT_DMA
/* Driver customization:
*/
#define DRIVER_PRETAKEDOWN() do { \
if ( dev->dev_private ) { \
drm_i915_private_t *dev_priv = dev->dev_private; \
i915_mem_takedown( &(dev_priv->agp_heap) ); \
} \
i915_dma_cleanup( dev ); \
} while (0)
/* When a client dies:
* - Free any alloced agp memory.
*/
#define DRIVER_PRERELEASE() \
do { \
if ( dev->dev_private ) { \
drm_i915_private_t *dev_priv = dev->dev_private; \
i915_mem_release( dev, filp, dev_priv->agp_heap ); \
} \
} while (0)
/* We use our own dma mechanisms, not the drm template code. However,
* the shared IRQ code is useful to us:
*/
......
......@@ -712,3 +712,26 @@ int i915_setparam(DRM_IOCTL_ARGS)
return 0;
}
static void i915_driver_pretakedown(drm_device_t *dev)
{
if ( dev->dev_private ) {
drm_i915_private_t *dev_priv = dev->dev_private;
i915_mem_takedown( &(dev_priv->agp_heap) );
}
i915_dma_cleanup( dev );
}
static void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp)
{
if ( dev->dev_private ) {
drm_i915_private_t *dev_priv = dev->dev_private;
i915_mem_release( dev, filp, dev_priv->agp_heap );
}
}
void i915_driver_register_fns(drm_device_t *dev)
{
dev->fn_tbl.pretakedown = i915_driver_pretakedown;
dev->fn_tbl.prerelease = i915_driver_prerelease;
}
......@@ -69,12 +69,6 @@
#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY
#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY
/* Driver customization:
*/
#define DRIVER_PRETAKEDOWN() do { \
mga_do_cleanup_dma( dev ); \
} while (0)
/* DMA customization:
*/
#define __HAVE_DMA 1
......@@ -82,12 +76,6 @@
#define __HAVE_VBL_IRQ 1
#define __HAVE_SHARED_IRQ 1
#define __HAVE_DMA_QUIESCENT 1
#define DRIVER_DMA_QUIESCENT() do { \
drm_mga_private_t *dev_priv = dev->dev_private; \
return mga_do_wait_for_idle( dev_priv ); \
} while (0)
/* Buffer customization:
*/
#define DRIVER_BUF_PRIV_T drm_mga_buf_priv_t
......
......@@ -800,3 +800,20 @@ int mga_dma_buffers( DRM_IOCTL_ARGS )
return ret;
}
static void mga_driver_pretakedown(drm_device_t *dev)
{
mga_do_cleanup_dma( dev );
}
static int mga_driver_dma_quiescent(drm_device_t *dev)
{
drm_mga_private_t *dev_priv = dev->dev_private;
return mga_do_wait_for_idle( dev_priv );
}
void mga_driver_register_fns(drm_device_t *dev)
{
dev->fn_tbl.pretakedown = mga_driver_pretakedown;
dev->fn_tbl.dma_quiescent = mga_driver_dma_quiescent;
}
......@@ -79,21 +79,6 @@
[DRM_IOCTL_NR(DRM_IOCTL_R128_INDIRECT)] = { r128_cce_indirect, 1, 1 }, \
[DRM_IOCTL_NR(DRM_IOCTL_R128_GETPARAM)] = { r128_getparam, 1, 0 },
/* Driver customization:
*/
#define DRIVER_PRERELEASE() do { \
if ( dev->dev_private ) { \
drm_r128_private_t *dev_priv = dev->dev_private; \
if ( dev_priv->page_flipping ) { \
r128_do_cleanup_pageflip( dev ); \
} \
} \
} while (0)
#define DRIVER_PRETAKEDOWN() do { \
r128_do_cleanup_cce( dev ); \
} while (0)
/* DMA customization:
*/
#define __HAVE_DMA 1
......@@ -101,15 +86,6 @@
#define __HAVE_VBL_IRQ 1
#define __HAVE_SHARED_IRQ 1
#if 0
/* GH: Remove this for now... */
#define __HAVE_DMA_QUIESCENT 1
#define DRIVER_DMA_QUIESCENT() do { \
drm_r128_private_t *dev_priv = dev->dev_private; \
return r128_do_cce_idle( dev_priv ); \
} while (0)
#endif
/* Buffer customization:
*/
#define DRIVER_BUF_PRIV_T drm_r128_buf_priv_t
......
......@@ -1694,3 +1694,24 @@ int r128_getparam( DRM_IOCTL_ARGS )
return 0;
}
static void r128_driver_prerelease(drm_device_t *dev, DRMFILE filp)
{
if ( dev->dev_private ) {
drm_r128_private_t *dev_priv = dev->dev_private;
if ( dev_priv->page_flipping ) {
r128_do_cleanup_pageflip( dev );
}
}
}
static void r128_driver_pretakedown(drm_device_t *dev)
{
r128_do_cleanup_cce( dev );
}
void r128_driver_register_fns(drm_device_t *dev)
{
dev->fn_tbl.prerelease = r128_driver_prerelease;
dev->fn_tbl.pretakedown = r128_driver_pretakedown;
}
......@@ -118,43 +118,6 @@
#define DRIVER_FILE_FIELDS \
int64_t radeon_fb_delta; \
#define DRIVER_OPEN_HELPER( filp_priv, dev ) \
do { \
drm_radeon_private_t *dev_priv = dev->dev_private; \
if ( dev_priv ) \
filp_priv->radeon_fb_delta = dev_priv->fb_location; \
else \
filp_priv->radeon_fb_delta = 0; \
} while( 0 )
/* When a client dies:
* - Check for and clean up flipped page state
* - Free any alloced GART memory.
*
* DRM infrastructure takes care of reclaiming dma buffers.
*/
#define DRIVER_PRERELEASE() \
do { \
if ( dev->dev_private ) { \
drm_radeon_private_t *dev_priv = dev->dev_private; \
if ( dev_priv->page_flipping ) { \
radeon_do_cleanup_pageflip( dev ); \
} \
radeon_mem_release( filp, dev_priv->gart_heap ); \
radeon_mem_release( filp, dev_priv->fb_heap ); \
} \
} while (0)
/* When the last client dies, shut down the CP and free dev->dev_priv.
*/
/* #define __HAVE_RELEASE 1 */
#define DRIVER_PRETAKEDOWN() \
do { \
radeon_do_release( dev ); \
} while (0)
/* DMA customization:
*/
#define __HAVE_DMA 1
......
......@@ -2547,3 +2547,36 @@ int radeon_cp_setparam( DRM_IOCTL_ARGS ) {
return 0;
}
static void radeon_driver_prerelease(drm_device_t *dev, DRMFILE filp)
{
if ( dev->dev_private ) {
drm_radeon_private_t *dev_priv = dev->dev_private;
if ( dev_priv->page_flipping ) {
radeon_do_cleanup_pageflip( dev );
}
radeon_mem_release( filp, dev_priv->gart_heap );
radeon_mem_release( filp, dev_priv->fb_heap );
}
}
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)
{
drm_radeon_private_t *dev_priv = dev->dev_private;
if ( dev_priv )
filp_priv->radeon_fb_delta = dev_priv->fb_location;
else
filp_priv->radeon_fb_delta = 0;
}
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;
}
......@@ -46,3 +46,4 @@
#include "drm_proc.h"
#include "drm_vm.h"
#include "drm_stub.h"
......@@ -404,3 +404,7 @@ int sis_final_context(int context)
return 1;
}
void DRM(driver_register_fns)(drm_device_t *dev)
{
}
......@@ -49,3 +49,8 @@
#include "drm_proc.h"
#include "drm_vm.h"
#include "drm_stub.h"
void DRM(driver_register_fns)(drm_device_t *dev)
{
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment