aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_lock.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-14 03:39:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-14 03:39:08 -0400
commit2d65a9f48fcdf7866aab6457bc707ca233e0c791 (patch)
treef93e5838d6ac2e59434367f4ff905f7d9c45fc2b /drivers/gpu/drm/drm_lock.c
parentda92da3638a04894afdca8b99e973ddd20268471 (diff)
parentdfda0df3426483cf5fc7441f23f318edbabecb03 (diff)
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm updates from Dave Airlie: "This is the main git pull for the drm, I pretty much froze major pulls at -rc5/6 time, and haven't had much fallout, so will probably continue doing that. Lots of changes all over, big internal header cleanup to make it clear drm features are legacy things and what are things that modern KMS drivers should be using. Also big move to use the new generic fences in all the TTM drivers. core: atomic prep work, vblank rework changes, allows immediate vblank disables major header reworking and cleanups to better delinate legacy interfaces from what KMS drivers should be using. cursor planes locking fixes ttm: move to generic fences (affects all TTM drivers) ppc64 caching fixes radeon: userptr support, uvd for old asics, reset rework for fence changes better buffer placement changes, dpm feature enablement hdmi audio support fixes intel: Cherryview work, 180 degree rotation, skylake prep work, execlist command submission full ppgtt prep work cursor improvements edid caching, vdd handling improvements nouveau: fence reworking kepler memory clock work gt21x clock work fan control improvements hdmi infoframe fixes DP audio ast: ppc64 fixes caching fix rcar: rcar-du DT support ipuv3: prep work for capture support msm: LVDS support for mdp4, new panel, gpu refactoring exynos: exynos3250 SoC support, drop bad mmap interface, mipi dsi changes, and component match support" * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (640 commits) drm/mst: rework payload table allocation to conform better. drm/ast: Fix HW cursor image drm/radeon/kv: add uvd/vce info to dpm debugfs output drm/radeon/ci: add uvd/vce info to dpm debugfs output drm/radeon: export reservation_object from dmabuf to ttm drm/radeon: cope with foreign fences inside the reservation object drm/radeon: cope with foreign fences inside display drm/core: use helper to check driver features drm/radeon/cik: write gfx ucode version to ucode addr reg drm/radeon/si: print full CS when we hit a packet 0 drm/radeon: remove unecessary includes drm/radeon/combios: declare legacy_connector_convert as static drm/radeon/atombios: declare connector convert tables as static drm/radeon: drop btc_get_max_clock_from_voltage_dependency_table drm/radeon/dpm: drop clk/voltage dependency filters for BTC drm/radeon/dpm: drop clk/voltage dependency filters for CI drm/radeon/dpm: drop clk/voltage dependency filters for SI drm/radeon/dpm: drop clk/voltage dependency filters for NI drm/radeon: disable audio when we disable hdmi (v2) drm/radeon: split audio enable between eg and r600 (v2) ...
Diffstat (limited to 'drivers/gpu/drm/drm_lock.c')
-rw-r--r--drivers/gpu/drm/drm_lock.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c
index e26b59e385ff..f861361a635e 100644
--- a/drivers/gpu/drm/drm_lock.c
+++ b/drivers/gpu/drm/drm_lock.c
@@ -36,6 +36,7 @@
36#include <linux/export.h> 36#include <linux/export.h>
37#include <drm/drmP.h> 37#include <drm/drmP.h>
38#include "drm_legacy.h" 38#include "drm_legacy.h"
39#include "drm_internal.h"
39 40
40static int drm_notifier(void *priv); 41static int drm_notifier(void *priv);
41 42
@@ -52,7 +53,8 @@ static int drm_lock_take(struct drm_lock_data *lock_data, unsigned int context);
52 * 53 *
53 * Add the current task to the lock wait queue, and attempt to take to lock. 54 * Add the current task to the lock wait queue, and attempt to take to lock.
54 */ 55 */
55int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) 56int drm_legacy_lock(struct drm_device *dev, void *data,
57 struct drm_file *file_priv)
56{ 58{
57 DECLARE_WAITQUEUE(entry, current); 59 DECLARE_WAITQUEUE(entry, current);
58 struct drm_lock *lock = data; 60 struct drm_lock *lock = data;
@@ -120,7 +122,7 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
120 sigaddset(&dev->sigmask, SIGTTOU); 122 sigaddset(&dev->sigmask, SIGTTOU);
121 dev->sigdata.context = lock->context; 123 dev->sigdata.context = lock->context;
122 dev->sigdata.lock = master->lock.hw_lock; 124 dev->sigdata.lock = master->lock.hw_lock;
123 block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); 125 block_all_signals(drm_notifier, dev, &dev->sigmask);
124 } 126 }
125 127
126 if (dev->driver->dma_quiescent && (lock->flags & _DRM_LOCK_QUIESCENT)) 128 if (dev->driver->dma_quiescent && (lock->flags & _DRM_LOCK_QUIESCENT))
@@ -146,7 +148,7 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
146 * 148 *
147 * Transfer and free the lock. 149 * Transfer and free the lock.
148 */ 150 */
149int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv) 151int drm_legacy_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
150{ 152{
151 struct drm_lock *lock = data; 153 struct drm_lock *lock = data;
152 struct drm_master *master = file_priv->master; 154 struct drm_master *master = file_priv->master;
@@ -157,7 +159,7 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
157 return -EINVAL; 159 return -EINVAL;
158 } 160 }
159 161
160 if (drm_lock_free(&master->lock, lock->context)) { 162 if (drm_legacy_lock_free(&master->lock, lock->context)) {
161 /* FIXME: Should really bail out here. */ 163 /* FIXME: Should really bail out here. */
162 } 164 }
163 165
@@ -250,7 +252,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 252 * Marks the lock as not held, via the \p cmpxchg instruction. Wakes any task
251 * waiting on the lock queue. 253 * waiting on the lock queue.
252 */ 254 */
253int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context) 255int drm_legacy_lock_free(struct drm_lock_data *lock_data, unsigned int context)
254{ 256{
255 unsigned int old, new, prev; 257 unsigned int old, new, prev;
256 volatile unsigned int *lock = &lock_data->hw_lock->lock; 258 volatile unsigned int *lock = &lock_data->hw_lock->lock;
@@ -286,26 +288,27 @@ int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context)
286 * If the lock is not held, then let the signal proceed as usual. If the lock 288 * If the lock is not held, then let the signal proceed as usual. If the lock
287 * is held, then set the contended flag and keep the signal blocked. 289 * is held, then set the contended flag and keep the signal blocked.
288 * 290 *
289 * \param priv pointer to a drm_sigdata structure. 291 * \param priv pointer to a drm_device structure.
290 * \return one if the signal should be delivered normally, or zero if the 292 * \return one if the signal should be delivered normally, or zero if the
291 * signal should be blocked. 293 * signal should be blocked.
292 */ 294 */
293static int drm_notifier(void *priv) 295static int drm_notifier(void *priv)
294{ 296{
295 struct drm_sigdata *s = (struct drm_sigdata *) priv; 297 struct drm_device *dev = priv;
298 struct drm_hw_lock *lock = dev->sigdata.lock;
296 unsigned int old, new, prev; 299 unsigned int old, new, prev;
297 300
298 /* Allow signal delivery if lock isn't held */ 301 /* Allow signal delivery if lock isn't held */
299 if (!s->lock || !_DRM_LOCK_IS_HELD(s->lock->lock) 302 if (!lock || !_DRM_LOCK_IS_HELD(lock->lock)
300 || _DRM_LOCKING_CONTEXT(s->lock->lock) != s->context) 303 || _DRM_LOCKING_CONTEXT(lock->lock) != dev->sigdata.context)
301 return 1; 304 return 1;
302 305
303 /* Otherwise, set flag to force call to 306 /* Otherwise, set flag to force call to
304 drmUnlock */ 307 drmUnlock */
305 do { 308 do {
306 old = s->lock->lock; 309 old = lock->lock;
307 new = old | _DRM_LOCK_CONT; 310 new = old | _DRM_LOCK_CONT;
308 prev = cmpxchg(&s->lock->lock, old, new); 311 prev = cmpxchg(&lock->lock, old, new);
309 } while (prev != old); 312 } while (prev != old);
310 return 0; 313 return 0;
311} 314}
@@ -323,7 +326,7 @@ static int drm_notifier(void *priv)
323 * having to worry about starvation. 326 * having to worry about starvation.
324 */ 327 */
325 328
326void drm_idlelock_take(struct drm_lock_data *lock_data) 329void drm_legacy_idlelock_take(struct drm_lock_data *lock_data)
327{ 330{
328 int ret; 331 int ret;
329 332
@@ -340,9 +343,9 @@ void drm_idlelock_take(struct drm_lock_data *lock_data)
340 } 343 }
341 spin_unlock_bh(&lock_data->spinlock); 344 spin_unlock_bh(&lock_data->spinlock);
342} 345}
343EXPORT_SYMBOL(drm_idlelock_take); 346EXPORT_SYMBOL(drm_legacy_idlelock_take);
344 347
345void drm_idlelock_release(struct drm_lock_data *lock_data) 348void drm_legacy_idlelock_release(struct drm_lock_data *lock_data)
346{ 349{
347 unsigned int old, prev; 350 unsigned int old, prev;
348 volatile unsigned int *lock = &lock_data->hw_lock->lock; 351 volatile unsigned int *lock = &lock_data->hw_lock->lock;
@@ -360,9 +363,10 @@ void drm_idlelock_release(struct drm_lock_data *lock_data)
360 } 363 }
361 spin_unlock_bh(&lock_data->spinlock); 364 spin_unlock_bh(&lock_data->spinlock);
362} 365}
363EXPORT_SYMBOL(drm_idlelock_release); 366EXPORT_SYMBOL(drm_legacy_idlelock_release);
364 367
365int drm_i_have_hw_lock(struct drm_device *dev, struct drm_file *file_priv) 368int drm_legacy_i_have_hw_lock(struct drm_device *dev,
369 struct drm_file *file_priv)
366{ 370{
367 struct drm_master *master = file_priv->master; 371 struct drm_master *master = file_priv->master;
368 return (file_priv->lock_count && master->lock.hw_lock && 372 return (file_priv->lock_count && master->lock.hw_lock &&