aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_stub.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_stub.c')
-rw-r--r--drivers/gpu/drm/drm_stub.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 55bb8a82d612..ad73e141afdb 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -128,6 +128,7 @@ struct drm_master *drm_master_get(struct drm_master *master)
128 kref_get(&master->refcount); 128 kref_get(&master->refcount);
129 return master; 129 return master;
130} 130}
131EXPORT_SYMBOL(drm_master_get);
131 132
132static void drm_master_destroy(struct kref *kref) 133static void drm_master_destroy(struct kref *kref)
133{ 134{
@@ -170,10 +171,13 @@ void drm_master_put(struct drm_master **master)
170 kref_put(&(*master)->refcount, drm_master_destroy); 171 kref_put(&(*master)->refcount, drm_master_destroy);
171 *master = NULL; 172 *master = NULL;
172} 173}
174EXPORT_SYMBOL(drm_master_put);
173 175
174int drm_setmaster_ioctl(struct drm_device *dev, void *data, 176int drm_setmaster_ioctl(struct drm_device *dev, void *data,
175 struct drm_file *file_priv) 177 struct drm_file *file_priv)
176{ 178{
179 int ret = 0;
180
177 if (file_priv->is_master) 181 if (file_priv->is_master)
178 return 0; 182 return 0;
179 183
@@ -188,6 +192,13 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
188 mutex_lock(&dev->struct_mutex); 192 mutex_lock(&dev->struct_mutex);
189 file_priv->minor->master = drm_master_get(file_priv->master); 193 file_priv->minor->master = drm_master_get(file_priv->master);
190 file_priv->is_master = 1; 194 file_priv->is_master = 1;
195 if (dev->driver->master_set) {
196 ret = dev->driver->master_set(dev, file_priv, false);
197 if (unlikely(ret != 0)) {
198 file_priv->is_master = 0;
199 drm_master_put(&file_priv->minor->master);
200 }
201 }
191 mutex_unlock(&dev->struct_mutex); 202 mutex_unlock(&dev->struct_mutex);
192 } 203 }
193 204
@@ -204,6 +215,8 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
204 return -EINVAL; 215 return -EINVAL;
205 216
206 mutex_lock(&dev->struct_mutex); 217 mutex_lock(&dev->struct_mutex);
218 if (dev->driver->master_drop)
219 dev->driver->master_drop(dev, file_priv, false);
207 drm_master_put(&file_priv->minor->master); 220 drm_master_put(&file_priv->minor->master);
208 file_priv->is_master = 0; 221 file_priv->is_master = 0;
209 mutex_unlock(&dev->struct_mutex); 222 mutex_unlock(&dev->struct_mutex);
@@ -220,9 +233,11 @@ static int drm_fill_in_dev(struct drm_device * dev, struct pci_dev *pdev,
220 INIT_LIST_HEAD(&dev->ctxlist); 233 INIT_LIST_HEAD(&dev->ctxlist);
221 INIT_LIST_HEAD(&dev->vmalist); 234 INIT_LIST_HEAD(&dev->vmalist);
222 INIT_LIST_HEAD(&dev->maplist); 235 INIT_LIST_HEAD(&dev->maplist);
236 INIT_LIST_HEAD(&dev->vblank_event_list);
223 237
224 spin_lock_init(&dev->count_lock); 238 spin_lock_init(&dev->count_lock);
225 spin_lock_init(&dev->drw_lock); 239 spin_lock_init(&dev->drw_lock);
240 spin_lock_init(&dev->event_lock);
226 init_timer(&dev->timer); 241 init_timer(&dev->timer);
227 mutex_init(&dev->struct_mutex); 242 mutex_init(&dev->struct_mutex);
228 mutex_init(&dev->ctxlist_mutex); 243 mutex_init(&dev->ctxlist_mutex);