diff options
-rw-r--r-- | linux-core/i830_dma.c | 98 | ||||
-rw-r--r-- | linux-core/i830_drv.c | 23 | ||||
-rw-r--r-- | linux-core/i830_drv.h | 39 | ||||
-rw-r--r-- | linux-core/i830_irq.c | 4 |
4 files changed, 64 insertions, 100 deletions
diff --git a/linux-core/i830_dma.c b/linux-core/i830_dma.c index 454d82a3..90ce43ea 100644 --- a/linux-core/i830_dma.c +++ b/linux-core/i830_dma.c @@ -54,23 +54,6 @@ #define I830_BUF_UNMAPPED 0 #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) { 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; } -int i830_dma_cleanup(drm_device_t * dev) +static int i830_dma_cleanup(drm_device_t * dev) { drm_device_dma_t *dma = dev->dma; @@ -467,8 +450,8 @@ static int i830_dma_initialize(drm_device_t * dev, return 0; } -int i830_dma_init(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +static int i830_dma_init(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; 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; 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, - unsigned int cmd, unsigned long arg) +static int i830_flush_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->head->dev; @@ -1306,8 +1289,8 @@ int i830_flush_ioctl(struct inode *inode, struct file *filp, return 0; } -int i830_dma_vertex(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +static int i830_dma_vertex(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->head->dev; @@ -1340,8 +1323,8 @@ int i830_dma_vertex(struct inode *inode, struct file *filp, return 0; } -int i830_clear_bufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +static int i830_clear_bufs(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->head->dev; @@ -1364,8 +1347,8 @@ int i830_clear_bufs(struct inode *inode, struct file *filp, return 0; } -int i830_swap_bufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +static int i830_swap_bufs(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; 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; } -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; @@ -1402,8 +1385,8 @@ int i830_do_cleanup_pageflip(drm_device_t * dev) return 0; } -int i830_flip_bufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +static int i830_flip_bufs(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->head->dev; @@ -1420,8 +1403,8 @@ int i830_flip_bufs(struct inode *inode, struct file *filp, return 0; } -int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +static int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) { drm_file_t *priv = filp->private_data; 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; } -int i830_getbuf(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +static int i830_getbuf(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) { drm_file_t *priv = filp->private_data; 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; } -int i830_copybuf(struct inode *inode, - struct file *filp, unsigned int cmd, unsigned long arg) +static int i830_copybuf(struct inode *inode, + struct file *filp, unsigned int cmd, unsigned long arg) { /* Never copy - 2.4.x doesn't need it */ 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) { return 0; } -int i830_getparam(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +static int i830_getparam(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; 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; } -int i830_setparam(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +static int i830_setparam(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->head->dev; @@ -1546,6 +1529,16 @@ void i830_driver_pretakedown(drm_device_t * 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) { i830_reclaim_buffers(dev, filp); @@ -1556,3 +1549,22 @@ int i830_driver_dma_quiescent(drm_device_t * dev) i830_dma_quiescent(dev); 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); diff --git a/linux-core/i830_drv.c b/linux-core/i830_drv.c index 0b4a24e4..e5e069b8 100644 --- a/linux-core/i830_drv.c +++ b/linux-core/i830_drv.c @@ -76,22 +76,8 @@ static struct pci_device_id pciidlist[] = { i830_PCI_IDS }; -static drm_ioctl_desc_t 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} -}; +extern drm_ioctl_desc_t i830_ioctls[]; +extern int i830_max_ioctl; static int probe(struct pci_dev *pdev, const struct pci_device_id *ent); static struct drm_driver driver = { @@ -103,6 +89,7 @@ static struct drm_driver driver = { #endif .dev_priv_size = sizeof(drm_i830_buf_priv_t), .pretakedown = i830_driver_pretakedown, + .prerelease = i830_driver_prerelease, .release = i830_driver_release, .dma_quiescent = i830_driver_dma_quiescent, .reclaim_buffers = i830_reclaim_buffers, @@ -116,8 +103,7 @@ static struct drm_driver driver = { #endif .postinit = postinit, .version = version, - .ioctls = ioctls, - .num_ioctls = DRM_ARRAY_SIZE(ioctls), + .ioctls = i830_ioctls, .fops = { .owner = THIS_MODULE, .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) { + driver.num_ioctls = i830_max_ioctl; return drm_init(&driver, pciidlist); } diff --git a/linux-core/i830_drv.h b/linux-core/i830_drv.h index 553f8d48..47f498e3 100644 --- a/linux-core/i830_drv.h +++ b/linux-core/i830_drv.h @@ -120,50 +120,14 @@ typedef struct drm_i830_private { } drm_i830_private_t; - /* 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); +/* i830_dma.c */ 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 */ extern int i830_irq_emit(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int i830_irq_wait(struct inode *inode, struct file *filp, 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 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_release(drm_device_t * dev, struct file *filp); 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) \ dev_priv->mmio_map->handle) diff --git a/linux-core/i830_irq.c b/linux-core/i830_irq.c index 4f592e48..a6d264ca 100644 --- a/linux-core/i830_irq.c +++ b/linux-core/i830_irq.c @@ -54,7 +54,7 @@ irqreturn_t i830_driver_irq_handler(DRM_IRQ_ARGS) 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; RING_LOCALS; @@ -71,7 +71,7 @@ int i830_emit_irq(drm_device_t * dev) 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; DECLARE_WAITQUEUE(entry, current); |