various fixes from trying to get userspace started

This commit is contained in:
Dave Airlie 2008-02-15 16:15:04 +10:00
parent 75b01cf996
commit 222092a1a8
4 changed files with 25 additions and 10 deletions

View file

@ -318,6 +318,7 @@ static int drm_addmap_core(struct drm_device *dev, unsigned int offset,
list->user_token = list->hash.key << PAGE_SHIFT;
mutex_unlock(&dev->struct_mutex);
list->master = dev->primary->master;
*maplist = list;
return 0;
}

View file

@ -1094,7 +1094,7 @@ int drm_crtc_set_config(struct drm_crtc *crtc, struct drm_mode_crtc *crtc_info,
crtc->fb = fb;
crtc->enabled = (new_mode != NULL);
if (new_mode != NULL) {
DRM_DEBUG("attempting to set mode from userspace\n");
DRM_DEBUG("attempting to set mode from userspace %p\n", crtc->fb);
drm_mode_debug_printmodeline(dev, new_mode);
if (!drm_crtc_set_mode(crtc, new_mode, crtc_info->x,
crtc_info->y)) {
@ -1577,7 +1577,13 @@ int drm_mode_setcrtc(struct drm_device *dev,
ret = -EINVAL;
goto out;
}
DRM_DEBUG("found fb %p for id %d\n", fb, crtc_req->fb_id);
} else {
DRM_DEBUG("Unknown FB ID %d\n", crtc_req->fb_id);
ret = -EINVAL;
goto out;
}
mode = drm_mode_create(dev);
drm_crtc_convert_umode(mode, &crtc_req->mode);

View file

@ -268,9 +268,9 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
goto out_free;
}
mutex_lock(&dev->struct_mutex);
/* if there is no current master make this fd it */
mutex_lock(&dev->struct_mutex);
if (!priv->minor->master) {
priv->minor->master = drm_get_master(priv->minor);
if (!priv->minor->master) {
@ -281,17 +281,22 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
priv->is_master = 1;
priv->master = priv->minor->master;
mutex_unlock(&dev->struct_mutex);
if (dev->driver->master_create) {
ret = dev->driver->master_create(dev, priv->master);
if (ret) {
drm_put_master(priv->minor->master);
priv->minor->master = priv->master = NULL;
mutex_unlock(&dev->struct_mutex);
goto out_free;
}
}
}
else
} else {
priv->master = priv->minor->master;
mutex_unlock(&dev->struct_mutex);
}
mutex_lock(&dev->struct_mutex);
list_add(&priv->lhead, &dev->filelist);
mutex_unlock(&dev->struct_mutex);
@ -477,6 +482,14 @@ int drm_release(struct inode *inode, struct file *filp)
mutex_unlock(&dev->ctxlist_mutex);
drm_fb_release(filp);
file_priv->master = NULL;
if (file_priv->is_master) {
drm_put_master(file_priv->minor->master);
file_priv->minor->master = NULL;
}
mutex_lock(&dev->struct_mutex);
drm_object_release(filp);
if (file_priv->remove_auth_on_close == 1) {
@ -487,12 +500,6 @@ int drm_release(struct inode *inode, struct file *filp)
}
list_del(&file_priv->lhead);
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);

View file

@ -152,6 +152,7 @@ static int drm_fill_in_dev(struct drm_device * dev, struct pci_dev *pdev,
INIT_LIST_HEAD(&dev->ctxlist);
INIT_LIST_HEAD(&dev->vmalist);
INIT_LIST_HEAD(&dev->maplist);
INIT_LIST_HEAD(&dev->filelist);
spin_lock_init(&dev->count_lock);
spin_lock_init(&dev->drw_lock);