drm/nvc0/fifo: prevent races between clients updating playlists
authorBen Skeggs <bskeggs@redhat.com>
Mon, 13 May 2013 00:02:11 +0000 (10:02 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 20 May 2013 03:24:07 +0000 (13:24 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c

index 4d4a6b905370b2633b6afb199de3eb3973943ece..1613193e21e66aae63775dfaee4dfdf46f440bc0 100644 (file)
@@ -71,6 +71,7 @@ nvc0_fifo_playlist_update(struct nvc0_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;
 
@@ -87,6 +88,7 @@ nvc0_fifo_playlist_update(struct nvc0_fifo_priv *priv)
        nv_wr32(priv, 0x002274, 0x01f00000 | (p >> 3));
        if (!nv_wait(priv, 0x00227c, 0x00100000, 0x00000000))
                nv_error(priv, "playlist update failed\n");
+       mutex_unlock(&nv_subdev(priv)->mutex);
 }
 
 static int