summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux-core/drm_bufs.c1
-rw-r--r--linux-core/drm_crtc.c8
-rw-r--r--linux-core/drm_fops.c25
-rw-r--r--linux-core/drm_stub.c1
4 files changed, 25 insertions, 10 deletions
diff --git a/linux-core/drm_bufs.c b/linux-core/drm_bufs.c
index 3e1767c0..031f8ba0 100644
--- a/linux-core/drm_bufs.c
+++ b/linux-core/drm_bufs.c
@@ -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;
}
diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c
index 55390a82..3a0dd9c8 100644
--- a/linux-core/drm_crtc.c
+++ b/linux-core/drm_crtc.c
@@ -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);
diff --git a/linux-core/drm_fops.c b/linux-core/drm_fops.c
index 6ac09fb9..5a74f424 100644
--- a/linux-core/drm_fops.c
+++ b/linux-core/drm_fops.c
@@ -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);
diff --git a/linux-core/drm_stub.c b/linux-core/drm_stub.c
index 801dab09..334c8f03 100644
--- a/linux-core/drm_stub.c
+++ b/linux-core/drm_stub.c
@@ -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);