update i830 similiar to the kernel, add statics

main
Dave Airlie 2005-02-01 10:33:51 +00:00
parent 8d4c731aa1
commit 62e0a58ecf
4 changed files with 64 additions and 100 deletions

View File

@ -54,23 +54,6 @@
#define I830_BUF_UNMAPPED 0 #define I830_BUF_UNMAPPED 0
#define I830_BUF_MAPPED 1 #define I830_BUF_MAPPED 1
static inline void i830_print_status_page(drm_device_t * dev)
{
drm_device_dma_t *dma = dev->dma;
drm_i830_private_t *dev_priv = dev->dev_private;
u32 *temp = dev_priv->hw_status_page;
int i;
DRM_DEBUG("hw_status: Interrupt Status : %x\n", temp[0]);
DRM_DEBUG("hw_status: LpRing Head ptr : %x\n", temp[1]);
DRM_DEBUG("hw_status: IRing Head ptr : %x\n", temp[2]);
DRM_DEBUG("hw_status: Reserved : %x\n", temp[3]);
DRM_DEBUG("hw_status: Driver Counter : %d\n", temp[5]);
for (i = 9; i < dma->buf_count + 9; i++) {
DRM_DEBUG("buffer status idx : %d used: %d\n", i - 9, temp[i]);
}
}
static drm_buf_t *i830_freelist_get(drm_device_t * dev) static drm_buf_t *i830_freelist_get(drm_device_t * dev)
{ {
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
@ -232,7 +215,7 @@ static int i830_dma_get_buffer(drm_device_t * dev, drm_i830_dma_t * d,
return retcode; return retcode;
} }
int i830_dma_cleanup(drm_device_t * dev) static int i830_dma_cleanup(drm_device_t * dev)
{ {
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
@ -467,8 +450,8 @@ static int i830_dma_initialize(drm_device_t * dev,
return 0; return 0;
} }
int i830_dma_init(struct inode *inode, struct file *filp, static int i830_dma_init(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; drm_device_t *dev = priv->head->dev;
@ -1214,7 +1197,7 @@ static void i830_dma_dispatch_vertex(drm_device_t * dev,
} }
} }
void i830_dma_quiescent(drm_device_t * dev) static void i830_dma_quiescent(drm_device_t * dev)
{ {
drm_i830_private_t *dev_priv = dev->dev_private; drm_i830_private_t *dev_priv = dev->dev_private;
RING_LOCALS; RING_LOCALS;
@ -1294,8 +1277,8 @@ void i830_reclaim_buffers(drm_device_t *dev, struct file *filp)
} }
} }
int i830_flush_ioctl(struct inode *inode, struct file *filp, static int i830_flush_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; drm_device_t *dev = priv->head->dev;
@ -1306,8 +1289,8 @@ int i830_flush_ioctl(struct inode *inode, struct file *filp,
return 0; return 0;
} }
int i830_dma_vertex(struct inode *inode, struct file *filp, static int i830_dma_vertex(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; drm_device_t *dev = priv->head->dev;
@ -1340,8 +1323,8 @@ int i830_dma_vertex(struct inode *inode, struct file *filp,
return 0; return 0;
} }
int i830_clear_bufs(struct inode *inode, struct file *filp, static int i830_clear_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; drm_device_t *dev = priv->head->dev;
@ -1364,8 +1347,8 @@ int i830_clear_bufs(struct inode *inode, struct file *filp,
return 0; return 0;
} }
int i830_swap_bufs(struct inode *inode, struct file *filp, static int i830_swap_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; drm_device_t *dev = priv->head->dev;
@ -1390,7 +1373,7 @@ static void i830_do_init_pageflip(drm_device_t * dev)
dev_priv->sarea_priv->pf_current_page = dev_priv->current_page; dev_priv->sarea_priv->pf_current_page = dev_priv->current_page;
} }
int i830_do_cleanup_pageflip(drm_device_t * dev) static int i830_do_cleanup_pageflip(drm_device_t * dev)
{ {
drm_i830_private_t *dev_priv = dev->dev_private; drm_i830_private_t *dev_priv = dev->dev_private;
@ -1402,8 +1385,8 @@ int i830_do_cleanup_pageflip(drm_device_t * dev)
return 0; return 0;
} }
int i830_flip_bufs(struct inode *inode, struct file *filp, static int i830_flip_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; drm_device_t *dev = priv->head->dev;
@ -1420,8 +1403,8 @@ int i830_flip_bufs(struct inode *inode, struct file *filp,
return 0; return 0;
} }
int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd, static int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; drm_device_t *dev = priv->head->dev;
@ -1434,8 +1417,8 @@ int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd,
return 0; return 0;
} }
int i830_getbuf(struct inode *inode, struct file *filp, unsigned int cmd, static int i830_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; drm_device_t *dev = priv->head->dev;
@ -1466,21 +1449,21 @@ int i830_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
return retcode; return retcode;
} }
int i830_copybuf(struct inode *inode, static int i830_copybuf(struct inode *inode,
struct file *filp, unsigned int cmd, unsigned long arg) struct file *filp, unsigned int cmd, unsigned long arg)
{ {
/* Never copy - 2.4.x doesn't need it */ /* Never copy - 2.4.x doesn't need it */
return 0; return 0;
} }
int i830_docopy(struct inode *inode, struct file *filp, unsigned int cmd, static int i830_docopy(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
return 0; return 0;
} }
int i830_getparam(struct inode *inode, struct file *filp, unsigned int cmd, static int i830_getparam(struct inode *inode, struct file *filp,
unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; drm_device_t *dev = priv->head->dev;
@ -1513,8 +1496,8 @@ int i830_getparam(struct inode *inode, struct file *filp, unsigned int cmd,
return 0; return 0;
} }
int i830_setparam(struct inode *inode, struct file *filp, unsigned int cmd, static int i830_setparam(struct inode *inode, struct file *filp,
unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; drm_device_t *dev = priv->head->dev;
@ -1546,6 +1529,16 @@ void i830_driver_pretakedown(drm_device_t * dev)
i830_dma_cleanup(dev); i830_dma_cleanup(dev);
} }
void i830_driver_prerelease(drm_device_t * dev, DRMFILE filp)
{
if (dev->dev_private) {
drm_i830_private_t *dev_priv = dev->dev_private;
if (dev_priv->page_flipping) {
i830_do_cleanup_pageflip(dev);
}
}
}
void i830_driver_release(drm_device_t * dev, struct file *filp) void i830_driver_release(drm_device_t * dev, struct file *filp)
{ {
i830_reclaim_buffers(dev, filp); i830_reclaim_buffers(dev, filp);
@ -1556,3 +1549,22 @@ int i830_driver_dma_quiescent(drm_device_t * dev)
i830_dma_quiescent(dev); i830_dma_quiescent(dev);
return 0; return 0;
} }
drm_ioctl_desc_t i830_ioctls[] = {
[DRM_IOCTL_NR(DRM_I830_INIT)] = {i830_dma_init, 1, 1},
[DRM_IOCTL_NR(DRM_I830_VERTEX)] = {i830_dma_vertex, 1, 0},
[DRM_IOCTL_NR(DRM_I830_CLEAR)] = {i830_clear_bufs, 1, 0},
[DRM_IOCTL_NR(DRM_I830_FLUSH)] = {i830_flush_ioctl, 1, 0},
[DRM_IOCTL_NR(DRM_I830_GETAGE)] = {i830_getage, 1, 0},
[DRM_IOCTL_NR(DRM_I830_GETBUF)] = {i830_getbuf, 1, 0},
[DRM_IOCTL_NR(DRM_I830_SWAP)] = {i830_swap_bufs, 1, 0},
[DRM_IOCTL_NR(DRM_I830_COPY)] = {i830_copybuf, 1, 0},
[DRM_IOCTL_NR(DRM_I830_DOCOPY)] = {i830_docopy, 1, 0},
[DRM_IOCTL_NR(DRM_I830_FLIP)] = {i830_flip_bufs, 1, 0},
[DRM_IOCTL_NR(DRM_I830_IRQ_EMIT)] = {i830_irq_emit, 1, 0},
[DRM_IOCTL_NR(DRM_I830_IRQ_WAIT)] = {i830_irq_wait, 1, 0},
[DRM_IOCTL_NR(DRM_I830_GETPARAM)] = {i830_getparam, 1, 0},
[DRM_IOCTL_NR(DRM_I830_SETPARAM)] = {i830_setparam, 1, 0}
};
int i830_max_ioctl = DRM_ARRAY_SIZE(i830_ioctls);

View File

@ -76,22 +76,8 @@ static struct pci_device_id pciidlist[] = {
i830_PCI_IDS i830_PCI_IDS
}; };
static drm_ioctl_desc_t ioctls[] = { extern drm_ioctl_desc_t i830_ioctls[];
[DRM_IOCTL_NR(DRM_I830_INIT)] = {i830_dma_init, 1, 1}, extern int i830_max_ioctl;
[DRM_IOCTL_NR(DRM_I830_VERTEX)] = {i830_dma_vertex, 1, 0},
[DRM_IOCTL_NR(DRM_I830_CLEAR)] = {i830_clear_bufs, 1, 0},
[DRM_IOCTL_NR(DRM_I830_FLUSH)] = {i830_flush_ioctl, 1, 0},
[DRM_IOCTL_NR(DRM_I830_GETAGE)] = {i830_getage, 1, 0},
[DRM_IOCTL_NR(DRM_I830_GETBUF)] = {i830_getbuf, 1, 0},
[DRM_IOCTL_NR(DRM_I830_SWAP)] = {i830_swap_bufs, 1, 0},
[DRM_IOCTL_NR(DRM_I830_COPY)] = {i830_copybuf, 1, 0},
[DRM_IOCTL_NR(DRM_I830_DOCOPY)] = {i830_docopy, 1, 0},
[DRM_IOCTL_NR(DRM_I830_FLIP)] = {i830_flip_bufs, 1, 0},
[DRM_IOCTL_NR(DRM_I830_IRQ_EMIT)] = {i830_irq_emit, 1, 0},
[DRM_IOCTL_NR(DRM_I830_IRQ_WAIT)] = {i830_irq_wait, 1, 0},
[DRM_IOCTL_NR(DRM_I830_GETPARAM)] = {i830_getparam, 1, 0},
[DRM_IOCTL_NR(DRM_I830_SETPARAM)] = {i830_setparam, 1, 0}
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent); static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
static struct drm_driver driver = { static struct drm_driver driver = {
@ -103,6 +89,7 @@ static struct drm_driver driver = {
#endif #endif
.dev_priv_size = sizeof(drm_i830_buf_priv_t), .dev_priv_size = sizeof(drm_i830_buf_priv_t),
.pretakedown = i830_driver_pretakedown, .pretakedown = i830_driver_pretakedown,
.prerelease = i830_driver_prerelease,
.release = i830_driver_release, .release = i830_driver_release,
.dma_quiescent = i830_driver_dma_quiescent, .dma_quiescent = i830_driver_dma_quiescent,
.reclaim_buffers = i830_reclaim_buffers, .reclaim_buffers = i830_reclaim_buffers,
@ -116,8 +103,7 @@ static struct drm_driver driver = {
#endif #endif
.postinit = postinit, .postinit = postinit,
.version = version, .version = version,
.ioctls = ioctls, .ioctls = i830_ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
.fops = { .fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = drm_open, .open = drm_open,
@ -143,6 +129,7 @@ static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
static int __init i830_init(void) static int __init i830_init(void)
{ {
driver.num_ioctls = i830_max_ioctl;
return drm_init(&driver, pciidlist); return drm_init(&driver, pciidlist);
} }

View File

@ -120,50 +120,14 @@ typedef struct drm_i830_private {
} drm_i830_private_t; } drm_i830_private_t;
/* i830_dma.c */ /* i830_dma.c */
extern int i830_dma_schedule(drm_device_t * dev, int locked);
extern int i830_getbuf(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int i830_dma_init(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int i830_dma_cleanup(drm_device_t * dev);
extern int i830_flush_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern void i830_reclaim_buffers(drm_device_t *dev, struct file *filp); extern void i830_reclaim_buffers(drm_device_t *dev, struct file *filp);
extern int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg);
extern int i830_copybuf(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int i830_docopy(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern void i830_dma_quiescent(drm_device_t * dev);
extern int i830_dma_vertex(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int i830_swap_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int i830_clear_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int i830_flip_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int i830_getparam(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int i830_setparam(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
/* i830_irq.c */ /* i830_irq.c */
extern int i830_irq_emit(struct inode *inode, struct file *filp, extern int i830_irq_emit(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
extern int i830_irq_wait(struct inode *inode, struct file *filp, extern int i830_irq_wait(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
extern int i830_wait_irq(drm_device_t * dev, int irq_nr);
extern int i830_emit_irq(drm_device_t * dev);
extern irqreturn_t i830_driver_irq_handler(DRM_IRQ_ARGS); extern irqreturn_t i830_driver_irq_handler(DRM_IRQ_ARGS);
extern void i830_driver_irq_preinstall(drm_device_t * dev); extern void i830_driver_irq_preinstall(drm_device_t * dev);
@ -172,6 +136,7 @@ extern void i830_driver_irq_uninstall(drm_device_t * dev);
extern void i830_driver_pretakedown(drm_device_t * dev); extern void i830_driver_pretakedown(drm_device_t * dev);
extern void i830_driver_release(drm_device_t * dev, struct file *filp); extern void i830_driver_release(drm_device_t * dev, struct file *filp);
extern int i830_driver_dma_quiescent(drm_device_t * dev); extern int i830_driver_dma_quiescent(drm_device_t * dev);
extern void i830_driver_prerelease(drm_device_t * dev, DRMFILE filp);
#define I830_BASE(reg) ((unsigned long) \ #define I830_BASE(reg) ((unsigned long) \
dev_priv->mmio_map->handle) dev_priv->mmio_map->handle)

View File

@ -54,7 +54,7 @@ irqreturn_t i830_driver_irq_handler(DRM_IRQ_ARGS)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
int i830_emit_irq(drm_device_t * dev) static int i830_emit_irq(drm_device_t * dev)
{ {
drm_i830_private_t *dev_priv = dev->dev_private; drm_i830_private_t *dev_priv = dev->dev_private;
RING_LOCALS; RING_LOCALS;
@ -71,7 +71,7 @@ int i830_emit_irq(drm_device_t * dev)
return atomic_read(&dev_priv->irq_emitted); return atomic_read(&dev_priv->irq_emitted);
} }
int i830_wait_irq(drm_device_t * dev, int irq_nr) static int i830_wait_irq(drm_device_t * dev, int irq_nr)
{ {
drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private; drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private;
DECLARE_WAITQUEUE(entry, current); DECLARE_WAITQUEUE(entry, current);