diff options
Diffstat (limited to 'drivers/gpu/drm/drm_stub.c')
-rw-r--r-- | drivers/gpu/drm/drm_stub.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index 55bb8a82d612..a0c365f2e521 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c | |||
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
35 | #include <linux/moduleparam.h> | 35 | #include <linux/moduleparam.h> |
36 | #include <linux/slab.h> | ||
36 | #include "drmP.h" | 37 | #include "drmP.h" |
37 | #include "drm_core.h" | 38 | #include "drm_core.h" |
38 | 39 | ||
@@ -128,6 +129,7 @@ struct drm_master *drm_master_get(struct drm_master *master) | |||
128 | kref_get(&master->refcount); | 129 | kref_get(&master->refcount); |
129 | return master; | 130 | return master; |
130 | } | 131 | } |
132 | EXPORT_SYMBOL(drm_master_get); | ||
131 | 133 | ||
132 | static void drm_master_destroy(struct kref *kref) | 134 | static void drm_master_destroy(struct kref *kref) |
133 | { | 135 | { |
@@ -170,10 +172,13 @@ void drm_master_put(struct drm_master **master) | |||
170 | kref_put(&(*master)->refcount, drm_master_destroy); | 172 | kref_put(&(*master)->refcount, drm_master_destroy); |
171 | *master = NULL; | 173 | *master = NULL; |
172 | } | 174 | } |
175 | EXPORT_SYMBOL(drm_master_put); | ||
173 | 176 | ||
174 | int drm_setmaster_ioctl(struct drm_device *dev, void *data, | 177 | int drm_setmaster_ioctl(struct drm_device *dev, void *data, |
175 | struct drm_file *file_priv) | 178 | struct drm_file *file_priv) |
176 | { | 179 | { |
180 | int ret = 0; | ||
181 | |||
177 | if (file_priv->is_master) | 182 | if (file_priv->is_master) |
178 | return 0; | 183 | return 0; |
179 | 184 | ||
@@ -188,6 +193,13 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data, | |||
188 | mutex_lock(&dev->struct_mutex); | 193 | mutex_lock(&dev->struct_mutex); |
189 | file_priv->minor->master = drm_master_get(file_priv->master); | 194 | file_priv->minor->master = drm_master_get(file_priv->master); |
190 | file_priv->is_master = 1; | 195 | file_priv->is_master = 1; |
196 | if (dev->driver->master_set) { | ||
197 | ret = dev->driver->master_set(dev, file_priv, false); | ||
198 | if (unlikely(ret != 0)) { | ||
199 | file_priv->is_master = 0; | ||
200 | drm_master_put(&file_priv->minor->master); | ||
201 | } | ||
202 | } | ||
191 | mutex_unlock(&dev->struct_mutex); | 203 | mutex_unlock(&dev->struct_mutex); |
192 | } | 204 | } |
193 | 205 | ||
@@ -204,6 +216,8 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data, | |||
204 | return -EINVAL; | 216 | return -EINVAL; |
205 | 217 | ||
206 | mutex_lock(&dev->struct_mutex); | 218 | mutex_lock(&dev->struct_mutex); |
219 | if (dev->driver->master_drop) | ||
220 | dev->driver->master_drop(dev, file_priv, false); | ||
207 | drm_master_put(&file_priv->minor->master); | 221 | drm_master_put(&file_priv->minor->master); |
208 | file_priv->is_master = 0; | 222 | file_priv->is_master = 0; |
209 | mutex_unlock(&dev->struct_mutex); | 223 | mutex_unlock(&dev->struct_mutex); |
@@ -220,9 +234,11 @@ static int drm_fill_in_dev(struct drm_device * dev, struct pci_dev *pdev, | |||
220 | INIT_LIST_HEAD(&dev->ctxlist); | 234 | INIT_LIST_HEAD(&dev->ctxlist); |
221 | INIT_LIST_HEAD(&dev->vmalist); | 235 | INIT_LIST_HEAD(&dev->vmalist); |
222 | INIT_LIST_HEAD(&dev->maplist); | 236 | INIT_LIST_HEAD(&dev->maplist); |
237 | INIT_LIST_HEAD(&dev->vblank_event_list); | ||
223 | 238 | ||
224 | spin_lock_init(&dev->count_lock); | 239 | spin_lock_init(&dev->count_lock); |
225 | spin_lock_init(&dev->drw_lock); | 240 | spin_lock_init(&dev->drw_lock); |
241 | spin_lock_init(&dev->event_lock); | ||
226 | init_timer(&dev->timer); | 242 | init_timer(&dev->timer); |
227 | mutex_init(&dev->struct_mutex); | 243 | mutex_init(&dev->struct_mutex); |
228 | mutex_init(&dev->ctxlist_mutex); | 244 | mutex_init(&dev->ctxlist_mutex); |
@@ -500,8 +516,6 @@ void drm_put_dev(struct drm_device *dev) | |||
500 | } | 516 | } |
501 | driver = dev->driver; | 517 | driver = dev->driver; |
502 | 518 | ||
503 | drm_vblank_cleanup(dev); | ||
504 | |||
505 | drm_lastclose(dev); | 519 | drm_lastclose(dev); |
506 | 520 | ||
507 | if (drm_core_has_MTRR(dev) && drm_core_has_AGP(dev) && | 521 | if (drm_core_has_MTRR(dev) && drm_core_has_AGP(dev) && |
@@ -521,6 +535,8 @@ void drm_put_dev(struct drm_device *dev) | |||
521 | dev->agp = NULL; | 535 | dev->agp = NULL; |
522 | } | 536 | } |
523 | 537 | ||
538 | drm_vblank_cleanup(dev); | ||
539 | |||
524 | list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) | 540 | list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) |
525 | drm_rmmap(dev, r_list->map); | 541 | drm_rmmap(dev, r_list->map); |
526 | drm_ht_remove(&dev->map_hash); | 542 | drm_ht_remove(&dev->map_hash); |