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)) {
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);
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) {
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);
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) {
}
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);