diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2014-08-29 06:12:46 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2014-09-10 03:43:34 -0400 |
commit | bb6d822ec546603bca01f7ba17c52f0f4f80e329 (patch) | |
tree | d7edf6819c03a3195dccd33e9bc242553c00f28a /drivers/gpu/drm | |
parent | d4f68a7506e924e28a9153933076628002ba8bbc (diff) |
drm: move drm-lock API to drm_legacy.h
Same as the other legacy APIs, most of this is internal, so prefix it with
drm_legacy_* and move into drm_legacy.h.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/drm_fops.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_ioctl.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_legacy.h | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_lock.c | 20 | ||||
-rw-r--r-- | drivers/gpu/drm/i810/i810_dma.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/savage/savage_bci.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/sis/sis_mm.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/via/via_mm.c | 6 |
8 files changed, 35 insertions, 24 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 12e6a1cd804d..b419990042b0 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -268,11 +268,11 @@ static void drm_master_release(struct drm_device *dev, struct file *filp) | |||
268 | { | 268 | { |
269 | struct drm_file *file_priv = filp->private_data; | 269 | struct drm_file *file_priv = filp->private_data; |
270 | 270 | ||
271 | if (drm_i_have_hw_lock(dev, file_priv)) { | 271 | if (drm_legacy_i_have_hw_lock(dev, file_priv)) { |
272 | DRM_DEBUG("File %p released, freeing lock for context %d\n", | 272 | DRM_DEBUG("File %p released, freeing lock for context %d\n", |
273 | filp, _DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock)); | 273 | filp, _DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock)); |
274 | drm_lock_free(&file_priv->master->lock, | 274 | drm_legacy_lock_free(&file_priv->master->lock, |
275 | _DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock)); | 275 | _DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock)); |
276 | } | 276 | } |
277 | } | 277 | } |
278 | 278 | ||
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 3a1349f82b41..187dfaaeb491 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c | |||
@@ -82,8 +82,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { | |||
82 | DRM_IOCTL_DEF(DRM_IOCTL_ADD_DRAW, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), | 82 | DRM_IOCTL_DEF(DRM_IOCTL_ADD_DRAW, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
83 | DRM_IOCTL_DEF(DRM_IOCTL_RM_DRAW, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), | 83 | DRM_IOCTL_DEF(DRM_IOCTL_RM_DRAW, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
84 | 84 | ||
85 | DRM_IOCTL_DEF(DRM_IOCTL_LOCK, drm_lock, DRM_AUTH), | 85 | DRM_IOCTL_DEF(DRM_IOCTL_LOCK, drm_legacy_lock, DRM_AUTH), |
86 | DRM_IOCTL_DEF(DRM_IOCTL_UNLOCK, drm_unlock, DRM_AUTH), | 86 | DRM_IOCTL_DEF(DRM_IOCTL_UNLOCK, drm_legacy_unlock, DRM_AUTH), |
87 | 87 | ||
88 | DRM_IOCTL_DEF(DRM_IOCTL_FINISH, drm_noop, DRM_AUTH), | 88 | DRM_IOCTL_DEF(DRM_IOCTL_FINISH, drm_noop, DRM_AUTH), |
89 | 89 | ||
diff --git a/drivers/gpu/drm/drm_legacy.h b/drivers/gpu/drm/drm_legacy.h index f2d076823b2d..3049af5a01b3 100644 --- a/drivers/gpu/drm/drm_legacy.h +++ b/drivers/gpu/drm/drm_legacy.h | |||
@@ -83,4 +83,13 @@ struct drm_agp_mem { | |||
83 | struct list_head head; | 83 | struct list_head head; |
84 | }; | 84 | }; |
85 | 85 | ||
86 | /* | ||
87 | * Generic Userspace Locking-API | ||
88 | */ | ||
89 | |||
90 | int drm_legacy_i_have_hw_lock(struct drm_device *d, struct drm_file *f); | ||
91 | int drm_legacy_lock(struct drm_device *d, void *v, struct drm_file *f); | ||
92 | int drm_legacy_unlock(struct drm_device *d, void *v, struct drm_file *f); | ||
93 | int drm_legacy_lock_free(struct drm_lock_data *lock, unsigned int ctx); | ||
94 | |||
86 | #endif /* __DRM_LEGACY_H__ */ | 95 | #endif /* __DRM_LEGACY_H__ */ |
diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c index 60f148134e6a..727b032292b4 100644 --- a/drivers/gpu/drm/drm_lock.c +++ b/drivers/gpu/drm/drm_lock.c | |||
@@ -52,7 +52,8 @@ static int drm_lock_take(struct drm_lock_data *lock_data, unsigned int context); | |||
52 | * | 52 | * |
53 | * Add the current task to the lock wait queue, and attempt to take to lock. | 53 | * Add the current task to the lock wait queue, and attempt to take to lock. |
54 | */ | 54 | */ |
55 | int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) | 55 | int drm_legacy_lock(struct drm_device *dev, void *data, |
56 | struct drm_file *file_priv) | ||
56 | { | 57 | { |
57 | DECLARE_WAITQUEUE(entry, current); | 58 | DECLARE_WAITQUEUE(entry, current); |
58 | struct drm_lock *lock = data; | 59 | struct drm_lock *lock = data; |
@@ -146,7 +147,7 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
146 | * | 147 | * |
147 | * Transfer and free the lock. | 148 | * Transfer and free the lock. |
148 | */ | 149 | */ |
149 | int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv) | 150 | int drm_legacy_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv) |
150 | { | 151 | { |
151 | struct drm_lock *lock = data; | 152 | struct drm_lock *lock = data; |
152 | struct drm_master *master = file_priv->master; | 153 | struct drm_master *master = file_priv->master; |
@@ -157,7 +158,7 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
157 | return -EINVAL; | 158 | return -EINVAL; |
158 | } | 159 | } |
159 | 160 | ||
160 | if (drm_lock_free(&master->lock, lock->context)) { | 161 | if (drm_legacy_lock_free(&master->lock, lock->context)) { |
161 | /* FIXME: Should really bail out here. */ | 162 | /* FIXME: Should really bail out here. */ |
162 | } | 163 | } |
163 | 164 | ||
@@ -250,7 +251,7 @@ static int drm_lock_transfer(struct drm_lock_data *lock_data, | |||
250 | * Marks the lock as not held, via the \p cmpxchg instruction. Wakes any task | 251 | * Marks the lock as not held, via the \p cmpxchg instruction. Wakes any task |
251 | * waiting on the lock queue. | 252 | * waiting on the lock queue. |
252 | */ | 253 | */ |
253 | int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context) | 254 | int drm_legacy_lock_free(struct drm_lock_data *lock_data, unsigned int context) |
254 | { | 255 | { |
255 | unsigned int old, new, prev; | 256 | unsigned int old, new, prev; |
256 | volatile unsigned int *lock = &lock_data->hw_lock->lock; | 257 | volatile unsigned int *lock = &lock_data->hw_lock->lock; |
@@ -324,7 +325,7 @@ static int drm_notifier(void *priv) | |||
324 | * having to worry about starvation. | 325 | * having to worry about starvation. |
325 | */ | 326 | */ |
326 | 327 | ||
327 | void drm_idlelock_take(struct drm_lock_data *lock_data) | 328 | void drm_legacy_idlelock_take(struct drm_lock_data *lock_data) |
328 | { | 329 | { |
329 | int ret; | 330 | int ret; |
330 | 331 | ||
@@ -341,9 +342,9 @@ void drm_idlelock_take(struct drm_lock_data *lock_data) | |||
341 | } | 342 | } |
342 | spin_unlock_bh(&lock_data->spinlock); | 343 | spin_unlock_bh(&lock_data->spinlock); |
343 | } | 344 | } |
344 | EXPORT_SYMBOL(drm_idlelock_take); | 345 | EXPORT_SYMBOL(drm_legacy_idlelock_take); |
345 | 346 | ||
346 | void drm_idlelock_release(struct drm_lock_data *lock_data) | 347 | void drm_legacy_idlelock_release(struct drm_lock_data *lock_data) |
347 | { | 348 | { |
348 | unsigned int old, prev; | 349 | unsigned int old, prev; |
349 | volatile unsigned int *lock = &lock_data->hw_lock->lock; | 350 | volatile unsigned int *lock = &lock_data->hw_lock->lock; |
@@ -361,9 +362,10 @@ void drm_idlelock_release(struct drm_lock_data *lock_data) | |||
361 | } | 362 | } |
362 | spin_unlock_bh(&lock_data->spinlock); | 363 | spin_unlock_bh(&lock_data->spinlock); |
363 | } | 364 | } |
364 | EXPORT_SYMBOL(drm_idlelock_release); | 365 | EXPORT_SYMBOL(drm_legacy_idlelock_release); |
365 | 366 | ||
366 | int drm_i_have_hw_lock(struct drm_device *dev, struct drm_file *file_priv) | 367 | int drm_legacy_i_have_hw_lock(struct drm_device *dev, |
368 | struct drm_file *file_priv) | ||
367 | { | 369 | { |
368 | struct drm_master *master = file_priv->master; | 370 | struct drm_master *master = file_priv->master; |
369 | return (file_priv->lock_count && master->lock.hw_lock && | 371 | return (file_priv->lock_count && master->lock.hw_lock && |
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c index bae897de9468..c97e2ff6a35a 100644 --- a/drivers/gpu/drm/i810/i810_dma.c +++ b/drivers/gpu/drm/i810/i810_dma.c | |||
@@ -1215,9 +1215,9 @@ void i810_driver_preclose(struct drm_device *dev, struct drm_file *file_priv) | |||
1215 | } | 1215 | } |
1216 | 1216 | ||
1217 | if (file_priv->master && file_priv->master->lock.hw_lock) { | 1217 | if (file_priv->master && file_priv->master->lock.hw_lock) { |
1218 | drm_idlelock_take(&file_priv->master->lock); | 1218 | drm_legacy_idlelock_take(&file_priv->master->lock); |
1219 | i810_driver_reclaim_buffers(dev, file_priv); | 1219 | i810_driver_reclaim_buffers(dev, file_priv); |
1220 | drm_idlelock_release(&file_priv->master->lock); | 1220 | drm_legacy_idlelock_release(&file_priv->master->lock); |
1221 | } else { | 1221 | } else { |
1222 | /* master disappeared, clean up stuff anyway and hope nothing | 1222 | /* master disappeared, clean up stuff anyway and hope nothing |
1223 | * goes wrong */ | 1223 | * goes wrong */ |
diff --git a/drivers/gpu/drm/savage/savage_bci.c b/drivers/gpu/drm/savage/savage_bci.c index 82a078ca04f7..9288d3037ce5 100644 --- a/drivers/gpu/drm/savage/savage_bci.c +++ b/drivers/gpu/drm/savage/savage_bci.c | |||
@@ -1051,7 +1051,7 @@ void savage_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv) | |||
1051 | return; | 1051 | return; |
1052 | 1052 | ||
1053 | if (file_priv->master && file_priv->master->lock.hw_lock) { | 1053 | if (file_priv->master && file_priv->master->lock.hw_lock) { |
1054 | drm_idlelock_take(&file_priv->master->lock); | 1054 | drm_legacy_idlelock_take(&file_priv->master->lock); |
1055 | release_idlelock = 1; | 1055 | release_idlelock = 1; |
1056 | } | 1056 | } |
1057 | 1057 | ||
@@ -1070,7 +1070,7 @@ void savage_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv) | |||
1070 | } | 1070 | } |
1071 | 1071 | ||
1072 | if (release_idlelock) | 1072 | if (release_idlelock) |
1073 | drm_idlelock_release(&file_priv->master->lock); | 1073 | drm_legacy_idlelock_release(&file_priv->master->lock); |
1074 | } | 1074 | } |
1075 | 1075 | ||
1076 | const struct drm_ioctl_desc savage_ioctls[] = { | 1076 | const struct drm_ioctl_desc savage_ioctls[] = { |
diff --git a/drivers/gpu/drm/sis/sis_mm.c b/drivers/gpu/drm/sis/sis_mm.c index 77f288e4a0a6..93ad8a5704d1 100644 --- a/drivers/gpu/drm/sis/sis_mm.c +++ b/drivers/gpu/drm/sis/sis_mm.c | |||
@@ -319,12 +319,12 @@ void sis_reclaim_buffers_locked(struct drm_device *dev, | |||
319 | if (!(file->minor->master && file->master->lock.hw_lock)) | 319 | if (!(file->minor->master && file->master->lock.hw_lock)) |
320 | return; | 320 | return; |
321 | 321 | ||
322 | drm_idlelock_take(&file->master->lock); | 322 | drm_legacy_idlelock_take(&file->master->lock); |
323 | 323 | ||
324 | mutex_lock(&dev->struct_mutex); | 324 | mutex_lock(&dev->struct_mutex); |
325 | if (list_empty(&file_priv->obj_list)) { | 325 | if (list_empty(&file_priv->obj_list)) { |
326 | mutex_unlock(&dev->struct_mutex); | 326 | mutex_unlock(&dev->struct_mutex); |
327 | drm_idlelock_release(&file->master->lock); | 327 | drm_legacy_idlelock_release(&file->master->lock); |
328 | 328 | ||
329 | return; | 329 | return; |
330 | } | 330 | } |
@@ -345,7 +345,7 @@ void sis_reclaim_buffers_locked(struct drm_device *dev, | |||
345 | } | 345 | } |
346 | mutex_unlock(&dev->struct_mutex); | 346 | mutex_unlock(&dev->struct_mutex); |
347 | 347 | ||
348 | drm_idlelock_release(&file->master->lock); | 348 | drm_legacy_idlelock_release(&file->master->lock); |
349 | 349 | ||
350 | return; | 350 | return; |
351 | } | 351 | } |
diff --git a/drivers/gpu/drm/via/via_mm.c b/drivers/gpu/drm/via/via_mm.c index d70b1e1544bf..4f20742e7788 100644 --- a/drivers/gpu/drm/via/via_mm.c +++ b/drivers/gpu/drm/via/via_mm.c | |||
@@ -211,12 +211,12 @@ void via_reclaim_buffers_locked(struct drm_device *dev, | |||
211 | if (!(file->minor->master && file->master->lock.hw_lock)) | 211 | if (!(file->minor->master && file->master->lock.hw_lock)) |
212 | return; | 212 | return; |
213 | 213 | ||
214 | drm_idlelock_take(&file->master->lock); | 214 | drm_legacy_idlelock_take(&file->master->lock); |
215 | 215 | ||
216 | mutex_lock(&dev->struct_mutex); | 216 | mutex_lock(&dev->struct_mutex); |
217 | if (list_empty(&file_priv->obj_list)) { | 217 | if (list_empty(&file_priv->obj_list)) { |
218 | mutex_unlock(&dev->struct_mutex); | 218 | mutex_unlock(&dev->struct_mutex); |
219 | drm_idlelock_release(&file->master->lock); | 219 | drm_legacy_idlelock_release(&file->master->lock); |
220 | 220 | ||
221 | return; | 221 | return; |
222 | } | 222 | } |
@@ -231,7 +231,7 @@ void via_reclaim_buffers_locked(struct drm_device *dev, | |||
231 | } | 231 | } |
232 | mutex_unlock(&dev->struct_mutex); | 232 | mutex_unlock(&dev->struct_mutex); |
233 | 233 | ||
234 | drm_idlelock_release(&file->master->lock); | 234 | drm_legacy_idlelock_release(&file->master->lock); |
235 | 235 | ||
236 | return; | 236 | return; |
237 | } | 237 | } |