start moving over to proper hierarchy wrt master accesses
parent
0fbee62ec1
commit
a4fc1d7ac6
|
@ -262,11 +262,11 @@ struct drm_file;
|
|||
*/
|
||||
#define LOCK_TEST_WITH_RETURN( dev, file_priv ) \
|
||||
do { \
|
||||
if ( !_DRM_LOCK_IS_HELD( dev->primary->master->lock.hw_lock->lock ) || \
|
||||
dev->primary->master->lock.file_priv != file_priv ) { \
|
||||
if ( !_DRM_LOCK_IS_HELD( file_priv->master->lock.hw_lock->lock ) || \
|
||||
file_priv->master->lock.file_priv != file_priv ) { \
|
||||
DRM_ERROR( "%s called without lock held, held %d owner %p %p\n",\
|
||||
__FUNCTION__, _DRM_LOCK_IS_HELD( dev->primary->master->lock.hw_lock->lock ),\
|
||||
dev->primary->master->lock.file_priv, file_priv ); \
|
||||
__FUNCTION__, _DRM_LOCK_IS_HELD( file_priv->master->lock.hw_lock->lock ),\
|
||||
file_priv->master->lock.file_priv, file_priv ); \
|
||||
return -EINVAL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
@ -430,9 +430,11 @@ struct drm_file {
|
|||
|
||||
struct drm_open_hash refd_object_hash[_DRM_NO_REF_TYPES];
|
||||
struct file *filp;
|
||||
struct drm_master *master; /* this private has a master associated with it */
|
||||
void *driver_priv;
|
||||
|
||||
int is_master; /* this file private is a master for a minor */
|
||||
struct drm_master *master; /* master this node is currently associated with
|
||||
N.B. not always minor->master */
|
||||
struct list_head fbs;
|
||||
};
|
||||
|
||||
|
@ -612,7 +614,8 @@ struct drm_ati_pcigart_info {
|
|||
/* per-master structure */
|
||||
struct drm_master {
|
||||
|
||||
struct drm_device *dev;
|
||||
struct list_head head; /**< each minor contains a list of masters */
|
||||
struct drm_minor *minor; /**< link back to minor we are a master for */
|
||||
|
||||
char *unique; /**< Unique identifier: e.g., busid */
|
||||
int unique_len; /**< Length of unique field */
|
||||
|
@ -775,7 +778,10 @@ struct drm_minor {
|
|||
struct class_device *dev_class;
|
||||
|
||||
/* for control nodes - a pointer to the current master for this control node */
|
||||
struct drm_master *master;
|
||||
struct drm_master *master; /* currently active master for this node */
|
||||
struct list_head master_list;
|
||||
|
||||
/* possibly needs a list of configured modesetting pieces */
|
||||
};
|
||||
|
||||
|
||||
|
@ -831,7 +837,7 @@ struct drm_device {
|
|||
struct list_head vmalist; /**< List of vmas (for debugging) */
|
||||
|
||||
struct list_head filelist;
|
||||
// struct drm_master *master;
|
||||
|
||||
/*@} */
|
||||
|
||||
/** \name DMA queues (contexts) */
|
||||
|
@ -1235,7 +1241,7 @@ extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle);
|
|||
extern struct drm_ttm_backend *drm_agp_init_ttm(struct drm_device *dev);
|
||||
extern void drm_agp_chipset_flush(struct drm_device *dev);
|
||||
/* Stub support (drm_stub.h) */
|
||||
extern struct drm_master *drm_get_master(struct drm_device *dev);
|
||||
extern struct drm_master *drm_get_master(struct drm_minor *minor);
|
||||
extern void drm_put_master(struct drm_master *master);
|
||||
extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
|
||||
struct drm_driver *driver);
|
||||
|
@ -1252,13 +1258,9 @@ extern struct idr drm_minors_idr;
|
|||
extern drm_local_map_t *drm_getsarea(struct drm_device *dev);
|
||||
|
||||
/* Proc support (drm_proc.h) */
|
||||
extern int drm_proc_init(struct drm_device *dev,
|
||||
int minor,
|
||||
struct proc_dir_entry *root,
|
||||
struct proc_dir_entry **dev_root);
|
||||
extern int drm_proc_cleanup(int minor,
|
||||
struct proc_dir_entry *root,
|
||||
struct proc_dir_entry *dev_root);
|
||||
int drm_proc_init(struct drm_minor *minor, int minor_id,
|
||||
struct proc_dir_entry *root);
|
||||
int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root);
|
||||
|
||||
/* Scatter Gather Support (drm_scatter.h) */
|
||||
extern void drm_sg_cleanup(struct drm_sg_mem * entry);
|
||||
|
|
|
@ -50,7 +50,7 @@ static struct drm_file *drm_find_file(struct drm_master *master , drm_magic_t ma
|
|||
struct drm_file *retval = NULL;
|
||||
struct drm_magic_entry *pt;
|
||||
struct drm_hash_item *hash;
|
||||
struct drm_device *dev = master->dev;
|
||||
struct drm_device *dev = master->minor->dev;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
if (!drm_ht_find_item(&master->magiclist, (unsigned long)magic, &hash)) {
|
||||
|
@ -76,7 +76,7 @@ static int drm_add_magic(struct drm_master *master, struct drm_file * priv,
|
|||
drm_magic_t magic)
|
||||
{
|
||||
struct drm_magic_entry *entry;
|
||||
struct drm_device *dev = master->dev;
|
||||
struct drm_device *dev = master->minor->dev;
|
||||
DRM_DEBUG("%d\n", magic);
|
||||
|
||||
entry = drm_alloc(sizeof(*entry), DRM_MEM_MAGIC);
|
||||
|
@ -106,7 +106,7 @@ static int drm_remove_magic(struct drm_master *master, drm_magic_t magic)
|
|||
{
|
||||
struct drm_magic_entry *pt;
|
||||
struct drm_hash_item *hash;
|
||||
struct drm_device *dev = master->dev;
|
||||
struct drm_device *dev = master->minor->dev;
|
||||
|
||||
DRM_DEBUG("%d\n", magic);
|
||||
|
||||
|
@ -154,9 +154,9 @@ int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
|||
++sequence; /* reserve 0 */
|
||||
auth->magic = sequence++;
|
||||
spin_unlock(&lock);
|
||||
} while (drm_find_file(dev->primary->master, auth->magic));
|
||||
} while (drm_find_file(file_priv->master, auth->magic));
|
||||
file_priv->magic = auth->magic;
|
||||
drm_add_magic(dev->primary->master, file_priv, auth->magic);
|
||||
drm_add_magic(file_priv->master, file_priv, auth->magic);
|
||||
}
|
||||
|
||||
DRM_DEBUG("%u\n", auth->magic);
|
||||
|
@ -182,9 +182,9 @@ int drm_authmagic(struct drm_device *dev, void *data,
|
|||
struct drm_file *file;
|
||||
|
||||
DRM_DEBUG("%u\n", auth->magic);
|
||||
if ((file = drm_find_file(dev->primary->master, auth->magic))) {
|
||||
if ((file = drm_find_file(file_priv->master, auth->magic))) {
|
||||
file->authenticated = 1;
|
||||
drm_remove_magic(dev->primary->master, auth->magic);
|
||||
drm_remove_magic(file_priv->master, auth->magic);
|
||||
return 0;
|
||||
}
|
||||
return -EINVAL;
|
||||
|
|
|
@ -257,12 +257,13 @@ static int drm_context_switch(struct drm_device *dev, int old, int new)
|
|||
* hardware lock is held, clears the drm_device::context_flag and wakes up
|
||||
* drm_device::context_wait.
|
||||
*/
|
||||
static int drm_context_switch_complete(struct drm_device *dev, int new)
|
||||
static int drm_context_switch_complete(struct drm_device *dev,
|
||||
struct drm_file *file_priv, int new)
|
||||
{
|
||||
dev->last_context = new; /* PRE/POST: This is the _only_ writer. */
|
||||
dev->last_switch = jiffies;
|
||||
|
||||
if (!_DRM_LOCK_IS_HELD(dev->primary->master->lock.hw_lock->lock)) {
|
||||
if (!_DRM_LOCK_IS_HELD(file_priv->master->lock.hw_lock->lock)) {
|
||||
DRM_ERROR("Lock isn't held after context switch\n");
|
||||
}
|
||||
|
||||
|
@ -421,7 +422,7 @@ int drm_newctx(struct drm_device *dev, void *data,
|
|||
struct drm_ctx *ctx = data;
|
||||
|
||||
DRM_DEBUG("%d\n", ctx->handle);
|
||||
drm_context_switch_complete(dev, ctx->handle);
|
||||
drm_context_switch_complete(dev, file_priv, ctx->handle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -43,10 +43,8 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
|
|||
|
||||
static int drm_setup(struct drm_device * dev)
|
||||
{
|
||||
drm_local_map_t *map;
|
||||
int i;
|
||||
int ret;
|
||||
int sareapage;
|
||||
|
||||
if (dev->driver->firstopen) {
|
||||
ret = dev->driver->firstopen(dev);
|
||||
|
@ -54,12 +52,6 @@ static int drm_setup(struct drm_device * dev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* prebuild the SAREA */
|
||||
sareapage = max(SAREA_MAX, PAGE_SIZE);
|
||||
i = drm_addmap(dev, 0, sareapage, _DRM_SHM, _DRM_CONTAINS_LOCK, &map);
|
||||
if (i != 0)
|
||||
return i;
|
||||
|
||||
atomic_set(&dev->ioctl_count, 0);
|
||||
atomic_set(&dev->vma_count, 0);
|
||||
dev->buf_use = 0;
|
||||
|
@ -279,25 +271,27 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
|
|||
mutex_lock(&dev->struct_mutex);
|
||||
|
||||
/* if there is no current master make this fd it */
|
||||
if (!dev->primary->master) {
|
||||
priv->master = drm_get_master(dev);
|
||||
if (!priv->master) {
|
||||
if (!priv->minor->master) {
|
||||
priv->minor->master = drm_get_master(priv->minor);
|
||||
if (!priv->minor->master) {
|
||||
ret = -ENOMEM;
|
||||
goto out_free;
|
||||
}
|
||||
dev->primary->master = priv->master;
|
||||
|
||||
priv->is_master = 1;
|
||||
priv->master = priv->minor->master;
|
||||
|
||||
if (dev->driver->master_create) {
|
||||
ret = dev->driver->master_create(dev, dev->primary->master);
|
||||
ret = dev->driver->master_create(dev, priv->master);
|
||||
if (ret) {
|
||||
drm_put_master(dev->primary->master);
|
||||
dev->primary->master = priv->master = NULL;
|
||||
drm_put_master(priv->minor->master);
|
||||
priv->minor->master = priv->master = NULL;
|
||||
goto out_free;
|
||||
}
|
||||
}
|
||||
} else
|
||||
priv->master = NULL;
|
||||
|
||||
}
|
||||
else
|
||||
priv->master = priv->minor->master;
|
||||
list_add(&priv->lhead, &dev->filelist);
|
||||
mutex_unlock(&dev->struct_mutex);
|
||||
|
||||
|
@ -403,23 +397,23 @@ int drm_release(struct inode *inode, struct file *filp)
|
|||
current->pid, (long)old_encode_dev(file_priv->minor->device),
|
||||
dev->open_count);
|
||||
|
||||
if (dev->driver->reclaim_buffers_locked && dev->primary->master->lock.hw_lock) {
|
||||
if (dev->driver->reclaim_buffers_locked && file_priv->master->lock.hw_lock) {
|
||||
if (drm_i_have_hw_lock(dev, file_priv)) {
|
||||
dev->driver->reclaim_buffers_locked(dev, file_priv);
|
||||
} else {
|
||||
unsigned long _end=jiffies + 3*DRM_HZ;
|
||||
int locked = 0;
|
||||
|
||||
drm_idlelock_take(&dev->primary->master->lock);
|
||||
drm_idlelock_take(&file_priv->master->lock);
|
||||
|
||||
/*
|
||||
* Wait for a while.
|
||||
*/
|
||||
|
||||
do{
|
||||
spin_lock(&dev->primary->master->lock.spinlock);
|
||||
locked = dev->primary->master->lock.idle_has_lock;
|
||||
spin_unlock(&dev->primary->master->lock.spinlock);
|
||||
spin_lock(&file_priv->master->lock.spinlock);
|
||||
locked = file_priv->master->lock.idle_has_lock;
|
||||
spin_unlock(&file_priv->master->lock.spinlock);
|
||||
if (locked)
|
||||
break;
|
||||
schedule();
|
||||
|
@ -432,24 +426,24 @@ int drm_release(struct inode *inode, struct file *filp)
|
|||
}
|
||||
|
||||
dev->driver->reclaim_buffers_locked(dev, file_priv);
|
||||
drm_idlelock_release(&dev->primary->master->lock);
|
||||
drm_idlelock_release(&file_priv->master->lock);
|
||||
}
|
||||
}
|
||||
|
||||
if (dev->driver->reclaim_buffers_idlelocked && dev->primary->master->lock.hw_lock) {
|
||||
if (dev->driver->reclaim_buffers_idlelocked && file_priv->master->lock.hw_lock) {
|
||||
|
||||
drm_idlelock_take(&dev->primary->master->lock);
|
||||
drm_idlelock_take(&file_priv->master->lock);
|
||||
dev->driver->reclaim_buffers_idlelocked(dev, file_priv);
|
||||
drm_idlelock_release(&dev->primary->master->lock);
|
||||
drm_idlelock_release(&file_priv->master->lock);
|
||||
|
||||
}
|
||||
|
||||
if (drm_i_have_hw_lock(dev, file_priv)) {
|
||||
DRM_DEBUG("File %p released, freeing lock for context %d\n",
|
||||
filp, _DRM_LOCKING_CONTEXT(dev->primary->master->lock.hw_lock->lock));
|
||||
filp, _DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock));
|
||||
|
||||
drm_lock_free(&dev->primary->master->lock,
|
||||
_DRM_LOCKING_CONTEXT(dev->primary->master->lock.hw_lock->lock));
|
||||
drm_lock_free(&file_priv->master->lock,
|
||||
_DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock));
|
||||
}
|
||||
|
||||
|
||||
|
@ -493,13 +487,13 @@ int drm_release(struct inode *inode, struct file *filp)
|
|||
}
|
||||
list_del(&file_priv->lhead);
|
||||
|
||||
if (file_priv->master) {
|
||||
if (file_priv->master == dev->primary->master)
|
||||
dev->primary->master = NULL;
|
||||
drm_put_master(file_priv->master);
|
||||
file_priv->master = NULL;
|
||||
if (file_priv->is_master) {
|
||||
drm_put_master(file_priv->minor->master);
|
||||
file_priv->minor->master = NULL;
|
||||
}
|
||||
|
||||
file_priv->master = NULL;
|
||||
|
||||
mutex_unlock(&dev->struct_mutex);
|
||||
|
||||
if (dev->driver->postclose)
|
||||
|
|
|
@ -53,7 +53,7 @@ int drm_getunique(struct drm_device *dev, void *data,
|
|||
struct drm_file *file_priv)
|
||||
{
|
||||
struct drm_unique *u = data;
|
||||
struct drm_master *master = dev->primary->master;
|
||||
struct drm_master *master = file_priv->master;
|
||||
|
||||
if (u->unique_len >= master->unique_len) {
|
||||
if (copy_to_user(u->unique, master->unique, master->unique_len))
|
||||
|
@ -82,7 +82,7 @@ int drm_setunique(struct drm_device *dev, void *data,
|
|||
struct drm_file *file_priv)
|
||||
{
|
||||
struct drm_unique *u = data;
|
||||
struct drm_master *master = dev->primary->master;
|
||||
struct drm_master *master = file_priv->master;
|
||||
int domain, bus, slot, func, ret;
|
||||
|
||||
if (master->unique_len || master->unique)
|
||||
|
@ -127,9 +127,9 @@ int drm_setunique(struct drm_device *dev, void *data,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int drm_set_busid(struct drm_device * dev)
|
||||
static int drm_set_busid(struct drm_device *dev, struct drm_file *file_priv)
|
||||
{
|
||||
struct drm_master *master = dev->primary->master;
|
||||
struct drm_master *master = file_priv->master;
|
||||
int len;
|
||||
|
||||
if (master->unique != NULL)
|
||||
|
@ -279,7 +279,7 @@ int drm_getstats(struct drm_device *dev, void *data,
|
|||
for (i = 0; i < dev->counters; i++) {
|
||||
if (dev->types[i] == _DRM_STAT_LOCK)
|
||||
stats->data[i].value =
|
||||
(dev->primary->master->lock.hw_lock ? dev->primary->master->lock.hw_lock->lock : 0);
|
||||
(file_priv->master->lock.hw_lock ? file_priv->master->lock.hw_lock->lock : 0);
|
||||
else
|
||||
stats->data[i].value = atomic_read(&dev->counts[i]);
|
||||
stats->data[i].type = dev->types[i];
|
||||
|
@ -321,7 +321,7 @@ int drm_setversion(struct drm_device *dev, void *data, struct drm_file *file_pri
|
|||
/*
|
||||
* Version 1.1 includes tying of DRM to specific device
|
||||
*/
|
||||
drm_set_busid(dev);
|
||||
drm_set_busid(dev, file_priv);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
|||
{
|
||||
DECLARE_WAITQUEUE(entry, current);
|
||||
struct drm_lock *lock = data;
|
||||
struct drm_master *master = dev->primary->master;
|
||||
struct drm_master *master = file_priv->master;
|
||||
int ret = 0;
|
||||
|
||||
++file_priv->lock_count;
|
||||
|
@ -150,7 +150,7 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
|||
int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||
{
|
||||
struct drm_lock *lock = data;
|
||||
struct drm_master *master = dev->primary->master;
|
||||
struct drm_master *master = file_priv->master;
|
||||
unsigned long irqflags;
|
||||
|
||||
if (lock->context == DRM_KERNEL_CONTEXT) {
|
||||
|
@ -386,7 +386,7 @@ EXPORT_SYMBOL(drm_idlelock_release);
|
|||
|
||||
int drm_i_have_hw_lock(struct drm_device *dev, struct drm_file *file_priv)
|
||||
{
|
||||
struct drm_master *master = dev->primary->master;
|
||||
struct drm_master *master = file_priv->master;
|
||||
return (file_priv->lock_count && master->lock.hw_lock &&
|
||||
_DRM_LOCK_IS_HELD(master->lock.hw_lock->lock) &&
|
||||
master->lock.file_priv == file_priv);
|
||||
|
|
|
@ -90,34 +90,35 @@ static struct drm_proc_list {
|
|||
* "/proc/dri/%minor%/", and each entry in proc_list as
|
||||
* "/proc/dri/%minor%/%name%".
|
||||
*/
|
||||
int drm_proc_init(struct drm_device *dev, int minor,
|
||||
struct proc_dir_entry *root, struct proc_dir_entry **dev_root)
|
||||
int drm_proc_init(struct drm_minor *minor, int minor_id,
|
||||
struct proc_dir_entry *root)
|
||||
{
|
||||
struct proc_dir_entry *ent;
|
||||
int i, j;
|
||||
char name[64];
|
||||
|
||||
sprintf(name, "%d", minor);
|
||||
*dev_root = proc_mkdir(name, root);
|
||||
if (!*dev_root) {
|
||||
sprintf(name, "%d", minor_id);
|
||||
minor->dev_root = proc_mkdir(name, root);
|
||||
if (!minor->dev_root) {
|
||||
DRM_ERROR("Cannot create /proc/dri/%s\n", name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < DRM_PROC_ENTRIES; i++) {
|
||||
ent = create_proc_entry(drm_proc_list[i].name,
|
||||
S_IFREG | S_IRUGO, *dev_root);
|
||||
S_IFREG | S_IRUGO, minor->dev_root);
|
||||
if (!ent) {
|
||||
DRM_ERROR("Cannot create /proc/dri/%s/%s\n",
|
||||
name, drm_proc_list[i].name);
|
||||
for (j = 0; j < i; j++)
|
||||
remove_proc_entry(drm_proc_list[i].name,
|
||||
*dev_root);
|
||||
minor->dev_root);
|
||||
remove_proc_entry(name, root);
|
||||
minor->dev_root = NULL;
|
||||
return -1;
|
||||
}
|
||||
ent->read_proc = drm_proc_list[i].f;
|
||||
ent->data = dev;
|
||||
ent->data = minor;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -132,18 +133,17 @@ int drm_proc_init(struct drm_device *dev, int minor,
|
|||
*
|
||||
* Remove all proc entries created by proc_init().
|
||||
*/
|
||||
int drm_proc_cleanup(int minor, struct proc_dir_entry *root,
|
||||
struct proc_dir_entry *dev_root)
|
||||
int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root)
|
||||
{
|
||||
int i;
|
||||
char name[64];
|
||||
|
||||
if (!root || !dev_root)
|
||||
if (!root || !minor->dev_root)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < DRM_PROC_ENTRIES; i++)
|
||||
remove_proc_entry(drm_proc_list[i].name, dev_root);
|
||||
sprintf(name, "%d", minor);
|
||||
remove_proc_entry(drm_proc_list[i].name, minor->dev_root);
|
||||
sprintf(name, "%d", minor->index);
|
||||
remove_proc_entry(name, root);
|
||||
|
||||
return 0;
|
||||
|
@ -165,8 +165,9 @@ int drm_proc_cleanup(int minor, struct proc_dir_entry *root,
|
|||
static int drm_name_info(char *buf, char **start, off_t offset, int request,
|
||||
int *eof, void *data)
|
||||
{
|
||||
struct drm_device *dev = (struct drm_device *) data;
|
||||
struct drm_master *master = dev->primary->master;
|
||||
struct drm_minor *minor = (struct drm_minor *) data;
|
||||
struct drm_master *master = minor->master;
|
||||
struct drm_device *dev = minor->dev;
|
||||
int len = 0;
|
||||
|
||||
if (offset > DRM_PROC_LIMIT) {
|
||||
|
@ -208,7 +209,9 @@ static int drm_name_info(char *buf, char **start, off_t offset, int request,
|
|||
static int drm__vm_info(char *buf, char **start, off_t offset, int request,
|
||||
int *eof, void *data)
|
||||
{
|
||||
struct drm_device *dev = (struct drm_device *) data;
|
||||
struct drm_minor *minor = (struct drm_minor *) data;
|
||||
struct drm_master *master = minor->master;
|
||||
struct drm_device *dev = minor->dev;
|
||||
int len = 0;
|
||||
struct drm_map *map;
|
||||
struct drm_map_list *r_list;
|
||||
|
@ -265,7 +268,9 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request,
|
|||
static int drm_vm_info(char *buf, char **start, off_t offset, int request,
|
||||
int *eof, void *data)
|
||||
{
|
||||
struct drm_device *dev = (struct drm_device *) data;
|
||||
struct drm_minor *minor = (struct drm_minor *) data;
|
||||
struct drm_master *master = minor->master;
|
||||
struct drm_device *dev = minor->dev;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
@ -288,7 +293,8 @@ static int drm_vm_info(char *buf, char **start, off_t offset, int request,
|
|||
static int drm__queues_info(char *buf, char **start, off_t offset,
|
||||
int request, int *eof, void *data)
|
||||
{
|
||||
struct drm_device *dev = (struct drm_device *) data;
|
||||
struct drm_minor *minor = (struct drm_minor *) data;
|
||||
struct drm_device *dev = minor->dev;
|
||||
int len = 0;
|
||||
int i;
|
||||
struct drm_queue *q;
|
||||
|
@ -338,7 +344,8 @@ static int drm__queues_info(char *buf, char **start, off_t offset,
|
|||
static int drm_queues_info(char *buf, char **start, off_t offset, int request,
|
||||
int *eof, void *data)
|
||||
{
|
||||
struct drm_device *dev = (struct drm_device *) data;
|
||||
struct drm_minor *minor = (struct drm_minor *) data;
|
||||
struct drm_device *dev = minor->dev;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
@ -361,7 +368,8 @@ static int drm_queues_info(char *buf, char **start, off_t offset, int request,
|
|||
static int drm__bufs_info(char *buf, char **start, off_t offset, int request,
|
||||
int *eof, void *data)
|
||||
{
|
||||
struct drm_device *dev = (struct drm_device *) data;
|
||||
struct drm_minor *minor = (struct drm_minor *) data;
|
||||
struct drm_device *dev = minor->dev;
|
||||
int len = 0;
|
||||
struct drm_device_dma *dma = dev->dma;
|
||||
int i;
|
||||
|
@ -410,7 +418,8 @@ static int drm__bufs_info(char *buf, char **start, off_t offset, int request,
|
|||
static int drm_bufs_info(char *buf, char **start, off_t offset, int request,
|
||||
int *eof, void *data)
|
||||
{
|
||||
struct drm_device *dev = (struct drm_device *) data;
|
||||
struct drm_minor *minor = (struct drm_minor *) data;
|
||||
struct drm_device *dev = minor->dev;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
@ -433,7 +442,8 @@ static int drm_bufs_info(char *buf, char **start, off_t offset, int request,
|
|||
static int drm__objects_info(char *buf, char **start, off_t offset, int request,
|
||||
int *eof, void *data)
|
||||
{
|
||||
struct drm_device *dev = (struct drm_device *) data;
|
||||
struct drm_minor *minor = (struct drm_minor *) data;
|
||||
struct drm_device *dev = minor->dev;
|
||||
int len = 0;
|
||||
struct drm_buffer_manager *bm = &dev->bm;
|
||||
struct drm_fence_manager *fm = &dev->fm;
|
||||
|
@ -497,7 +507,8 @@ static int drm__objects_info(char *buf, char **start, off_t offset, int request,
|
|||
static int drm_objects_info(char *buf, char **start, off_t offset, int request,
|
||||
int *eof, void *data)
|
||||
{
|
||||
struct drm_device *dev = (struct drm_device *) data;
|
||||
struct drm_minor *minor = (struct drm_minor *) data;
|
||||
struct drm_device *dev = minor->dev;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
@ -520,7 +531,8 @@ static int drm_objects_info(char *buf, char **start, off_t offset, int request,
|
|||
static int drm__clients_info(char *buf, char **start, off_t offset,
|
||||
int request, int *eof, void *data)
|
||||
{
|
||||
struct drm_device *dev = (struct drm_device *) data;
|
||||
struct drm_minor *minor = (struct drm_minor *) data;
|
||||
struct drm_device *dev = minor->dev;
|
||||
int len = 0;
|
||||
struct drm_file *priv;
|
||||
|
||||
|
@ -553,7 +565,8 @@ static int drm__clients_info(char *buf, char **start, off_t offset,
|
|||
static int drm_clients_info(char *buf, char **start, off_t offset,
|
||||
int request, int *eof, void *data)
|
||||
{
|
||||
struct drm_device *dev = (struct drm_device *) data;
|
||||
struct drm_minor *minor = (struct drm_minor *) data;
|
||||
struct drm_device *dev = minor->dev;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
@ -567,7 +580,8 @@ static int drm_clients_info(char *buf, char **start, off_t offset,
|
|||
static int drm__vma_info(char *buf, char **start, off_t offset, int request,
|
||||
int *eof, void *data)
|
||||
{
|
||||
struct drm_device *dev = (struct drm_device *) data;
|
||||
struct drm_minor *minor = (struct drm_minor *) data;
|
||||
struct drm_device *dev = minor->dev;
|
||||
int len = 0;
|
||||
struct drm_vma_entry *pt;
|
||||
struct vm_area_struct *vma;
|
||||
|
@ -626,7 +640,8 @@ static int drm__vma_info(char *buf, char **start, off_t offset, int request,
|
|||
static int drm_vma_info(char *buf, char **start, off_t offset, int request,
|
||||
int *eof, void *data)
|
||||
{
|
||||
struct drm_device *dev = (struct drm_device *) data;
|
||||
struct drm_minor *minor = (struct drm_minor *) data;
|
||||
struct drm_device *dev = minor->dev;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
|
|
@ -91,7 +91,7 @@ again:
|
|||
return new_id;
|
||||
}
|
||||
|
||||
struct drm_master *drm_get_master(struct drm_device *dev)
|
||||
struct drm_master *drm_get_master(struct drm_minor *minor)
|
||||
{
|
||||
struct drm_master *master;
|
||||
|
||||
|
@ -104,7 +104,9 @@ struct drm_master *drm_get_master(struct drm_device *dev)
|
|||
init_waitqueue_head(&master->lock.lock_queue);
|
||||
drm_ht_create(&master->magiclist, DRM_MAGIC_HASH_ORDER);
|
||||
INIT_LIST_HEAD(&master->magicfree);
|
||||
master->dev = dev;
|
||||
master->minor = minor;
|
||||
|
||||
list_add_tail(&master->head, &minor->master_list);
|
||||
|
||||
return master;
|
||||
}
|
||||
|
@ -112,7 +114,9 @@ struct drm_master *drm_get_master(struct drm_device *dev)
|
|||
void drm_put_master(struct drm_master *master)
|
||||
{
|
||||
struct drm_magic_entry *pt, *next;
|
||||
struct drm_device *dev = master->dev;
|
||||
struct drm_device *dev = master->minor->dev;
|
||||
|
||||
list_del(&master->head);
|
||||
|
||||
if (dev->driver->master_destroy)
|
||||
dev->driver->master_destroy(dev, master);
|
||||
|
@ -265,12 +269,12 @@ static int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int t
|
|||
new_minor->device = MKDEV(DRM_MAJOR, minor_id);
|
||||
new_minor->dev = dev;
|
||||
new_minor->index = minor_id;
|
||||
INIT_LIST_HEAD(&new_minor->master_list);
|
||||
|
||||
idr_replace(&drm_minors_idr, new_minor, minor_id);
|
||||
|
||||
if (type == DRM_MINOR_RENDER) {
|
||||
ret = drm_proc_init(dev, minor_id, drm_proc_root,
|
||||
&new_minor->dev_root);
|
||||
ret = drm_proc_init(new_minor, minor_id, drm_proc_root);
|
||||
if (ret) {
|
||||
DRM_ERROR("DRM: Failed to initialize /proc/dri.\n");
|
||||
goto err_mem;
|
||||
|
@ -292,7 +296,7 @@ static int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int t
|
|||
|
||||
err_g2:
|
||||
if (new_minor->type == DRM_MINOR_RENDER)
|
||||
drm_proc_cleanup(minor_id, drm_proc_root, new_minor->dev_root);
|
||||
drm_proc_cleanup(new_minor, drm_proc_root);
|
||||
err_mem:
|
||||
kfree(new_minor);
|
||||
err_idr:
|
||||
|
@ -416,7 +420,7 @@ int drm_put_minor(struct drm_minor **minor_p)
|
|||
DRM_DEBUG("release secondary minor %d\n", minor->index);
|
||||
|
||||
if (minor->type == DRM_MINOR_RENDER)
|
||||
drm_proc_cleanup(minor->index, drm_proc_root, minor->dev_root);
|
||||
drm_proc_cleanup(minor, drm_proc_root);
|
||||
drm_sysfs_device_remove(minor);
|
||||
|
||||
idr_remove(&drm_minors_idr, minor->index);
|
||||
|
|
Loading…
Reference in New Issue