diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2013-05-05 23:54:50 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2013-05-19 23:24:07 -0400 |
commit | c2e3259b7b6c89686892e4fbcc56dbcab14f1acf (patch) | |
tree | 0bc21617f0ddfc1e90af64c94d0d0809c313b5e5 /drivers/gpu/drm/nouveau | |
parent | fe6fc096b82eb0e84a0609f6431f7069f6c6c347 (diff) |
drm/nve0/fifo: prevent races between clients updating playlists
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r-- | drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c index 9151919fb831..56192a7242ae 100644 --- a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c +++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c | |||
@@ -94,11 +94,13 @@ nve0_fifo_playlist_update(struct nve0_fifo_priv *priv, u32 engine) | |||
94 | u32 match = (engine << 16) | 0x00000001; | 94 | u32 match = (engine << 16) | 0x00000001; |
95 | int i, p; | 95 | int i, p; |
96 | 96 | ||
97 | mutex_lock(&nv_subdev(priv)->mutex); | ||
97 | cur = engn->playlist[engn->cur_playlist]; | 98 | cur = engn->playlist[engn->cur_playlist]; |
98 | if (unlikely(cur == NULL)) { | 99 | if (unlikely(cur == NULL)) { |
99 | int ret = nouveau_gpuobj_new(nv_object(priv), NULL, | 100 | int ret = nouveau_gpuobj_new(nv_object(priv), NULL, |
100 | 0x8000, 0x1000, 0, &cur); | 101 | 0x8000, 0x1000, 0, &cur); |
101 | if (ret) { | 102 | if (ret) { |
103 | mutex_unlock(&nv_subdev(priv)->mutex); | ||
102 | nv_error(priv, "playlist alloc failed\n"); | 104 | nv_error(priv, "playlist alloc failed\n"); |
103 | return; | 105 | return; |
104 | } | 106 | } |
@@ -122,6 +124,7 @@ nve0_fifo_playlist_update(struct nve0_fifo_priv *priv, u32 engine) | |||
122 | nv_wr32(priv, 0x002274, (engine << 20) | (p >> 3)); | 124 | nv_wr32(priv, 0x002274, (engine << 20) | (p >> 3)); |
123 | if (!nv_wait(priv, 0x002284 + (engine * 4), 0x00100000, 0x00000000)) | 125 | if (!nv_wait(priv, 0x002284 + (engine * 4), 0x00100000, 0x00000000)) |
124 | nv_error(priv, "playlist %d update timeout\n", engine); | 126 | nv_error(priv, "playlist %d update timeout\n", engine); |
127 | mutex_unlock(&nv_subdev(priv)->mutex); | ||
125 | } | 128 | } |
126 | 129 | ||
127 | static int | 130 | static int |