drm/nv50/fifo: prevent races between clients updating playlists
authorBen Skeggs <bskeggs@redhat.com>
Tue, 14 May 2013 03:33:56 +0000 (13:33 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 20 May 2013 03:24:09 +0000 (13:24 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/engine/fifo/nv50.c

index ddaeb55729038ee4572b17c78c6ec94198ac0280..89bf459d584bb2f8272c0443ed8411715c2c0ed5 100644 (file)
@@ -47,6 +47,7 @@ nv50_fifo_playlist_update(struct nv50_fifo_priv *priv)
        struct nouveau_gpuobj *cur;
        int i, p;
 
+       mutex_lock(&nv_subdev(priv)->mutex);
        cur = priv->playlist[priv->cur_playlist];
        priv->cur_playlist = !priv->cur_playlist;
 
@@ -60,6 +61,7 @@ nv50_fifo_playlist_update(struct nv50_fifo_priv *priv)
        nv_wr32(priv, 0x0032f4, cur->addr >> 12);
        nv_wr32(priv, 0x0032ec, p);
        nv_wr32(priv, 0x002500, 0x00000101);
+       mutex_unlock(&nv_subdev(priv)->mutex);
 }
 
 static int