Commit ce29b686 authored by Dave Airlie's avatar Dave Airlie

drm: make reclaim_buffers take dev argument

Allow drivers to override reclaim_buffers in an OS-independent 
way by passing drm_device_t* as first parameter, like in the
BSD version.

From: Felix Kuehling <fxhuehl@gmx.de>
Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent 3f75e537
...@@ -580,7 +580,7 @@ struct drm_driver { ...@@ -580,7 +580,7 @@ struct drm_driver {
void (*irq_preinstall)(struct drm_device *dev); void (*irq_preinstall)(struct drm_device *dev);
void (*irq_postinstall)(struct drm_device *dev); void (*irq_postinstall)(struct drm_device *dev);
void (*irq_uninstall)(struct drm_device *dev); void (*irq_uninstall)(struct drm_device *dev);
void (*reclaim_buffers)(struct file *filp); void (*reclaim_buffers)(struct drm_device *dev, struct file *filp);
unsigned long (*get_map_ofs)(drm_map_t *map); unsigned long (*get_map_ofs)(drm_map_t *map);
unsigned long (*get_reg_ofs)(struct drm_device *dev); unsigned long (*get_reg_ofs)(struct drm_device *dev);
void (*set_version)(struct drm_device *dev, drm_set_version_t *sv); void (*set_version)(struct drm_device *dev, drm_set_version_t *sv);
...@@ -912,7 +912,7 @@ extern int drm_mapbufs( struct inode *inode, struct file *filp, ...@@ -912,7 +912,7 @@ extern int drm_mapbufs( struct inode *inode, struct file *filp,
extern int drm_dma_setup(drm_device_t *dev); extern int drm_dma_setup(drm_device_t *dev);
extern void drm_dma_takedown(drm_device_t *dev); extern void drm_dma_takedown(drm_device_t *dev);
extern void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf); extern void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf);
extern void drm_core_reclaim_buffers( struct file *filp ); extern void drm_core_reclaim_buffers(drm_device_t *dev, struct file *filp);
/* IRQ support (drm_irq.h) */ /* IRQ support (drm_irq.h) */
extern int drm_control( struct inode *inode, struct file *filp, extern int drm_control( struct inode *inode, struct file *filp,
......
...@@ -154,10 +154,8 @@ void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf) ...@@ -154,10 +154,8 @@ void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf)
* *
* Frees each buffer associated with \p filp not already on the hardware. * Frees each buffer associated with \p filp not already on the hardware.
*/ */
void drm_core_reclaim_buffers( struct file *filp ) void drm_core_reclaim_buffers(drm_device_t *dev, struct file *filp)
{ {
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
int i; int i;
......
...@@ -251,7 +251,7 @@ int drm_release( struct inode *inode, struct file *filp ) ...@@ -251,7 +251,7 @@ int drm_release( struct inode *inode, struct file *filp )
if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
{ {
dev->driver->reclaim_buffers(filp); dev->driver->reclaim_buffers(dev, filp);
} }
drm_fasync( -1, filp, 0 ); drm_fasync( -1, filp, 0 );
......
...@@ -994,10 +994,8 @@ static int i810_flush_queue(drm_device_t *dev) ...@@ -994,10 +994,8 @@ static int i810_flush_queue(drm_device_t *dev)
} }
/* Must be called with the lock held */ /* Must be called with the lock held */
void i810_reclaim_buffers(struct file *filp) void i810_reclaim_buffers(drm_device_t *dev, struct file *filp)
{ {
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
int i; int i;
...@@ -1367,7 +1365,7 @@ void i810_driver_pretakedown(drm_device_t *dev) ...@@ -1367,7 +1365,7 @@ void i810_driver_pretakedown(drm_device_t *dev)
void i810_driver_release(drm_device_t *dev, struct file *filp) void i810_driver_release(drm_device_t *dev, struct file *filp)
{ {
i810_reclaim_buffers(filp); i810_reclaim_buffers(dev, filp);
} }
int i810_driver_dma_quiescent(drm_device_t *dev) int i810_driver_dma_quiescent(drm_device_t *dev)
......
...@@ -122,7 +122,7 @@ extern int i810_dma_init(struct inode *inode, struct file *filp, ...@@ -122,7 +122,7 @@ extern int i810_dma_init(struct inode *inode, struct file *filp,
extern int i810_dma_cleanup(drm_device_t *dev); extern int i810_dma_cleanup(drm_device_t *dev);
extern int i810_flush_ioctl(struct inode *inode, struct file *filp, extern int i810_flush_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
extern void i810_reclaim_buffers(struct file *filp); extern void i810_reclaim_buffers(drm_device_t *dev, struct file *filp);
extern int i810_getage(struct inode *inode, struct file *filp, extern int i810_getage(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
extern int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma); extern int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma);
......
...@@ -1283,10 +1283,8 @@ static int i830_flush_queue(drm_device_t *dev) ...@@ -1283,10 +1283,8 @@ static int i830_flush_queue(drm_device_t *dev)
} }
/* Must be called with the lock held */ /* Must be called with the lock held */
void i830_reclaim_buffers( struct file *filp ) void i830_reclaim_buffers(drm_device_t *dev, struct file *filp)
{ {
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
int i; int i;
...@@ -1570,7 +1568,7 @@ void i830_driver_pretakedown(drm_device_t *dev) ...@@ -1570,7 +1568,7 @@ void i830_driver_pretakedown(drm_device_t *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(filp); i830_reclaim_buffers(dev, filp);
} }
int i830_driver_dma_quiescent(drm_device_t *dev) int i830_driver_dma_quiescent(drm_device_t *dev)
......
...@@ -129,7 +129,7 @@ extern int i830_dma_init(struct inode *inode, struct file *filp, ...@@ -129,7 +129,7 @@ extern int i830_dma_init(struct inode *inode, struct file *filp,
extern int i830_dma_cleanup(drm_device_t *dev); extern int i830_dma_cleanup(drm_device_t *dev);
extern int i830_flush_ioctl(struct inode *inode, struct file *filp, extern int i830_flush_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
extern void i830_reclaim_buffers(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, extern int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg); unsigned long arg);
extern int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma); extern int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma);
......
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