diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2012-09-28 11:50:29 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-10-03 13:12:22 +1000 |
commit | d6ba6d215a538a58f0f0026f0961b0b9125e8042 (patch) | |
tree | 121208b325939051307ea9cf28be867ab558ecef /drivers/gpu/drm/nouveau/nvc0_fence.c | |
parent | a0d271cbfed1dd50278c6b06bead3d00ba0a88f9 (diff) | |
download | blackbird-op-linux-d6ba6d215a538a58f0f0026f0961b0b9125e8042.tar.gz blackbird-op-linux-d6ba6d215a538a58f0f0026f0961b0b9125e8042.zip |
drm/nvc0/fence: restore pre-suspend fence buffer context on resume
Fixes some unfortunate races on resume. The G84 version of the code doesn't
need this as "gpuobj"s are automagically suspended/resumed by the core code
whereas pinned buffer objects are not.
Cc: stable@vger.kernel.org
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvc0_fence.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvc0_fence.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nvc0_fence.c b/drivers/gpu/drm/nouveau/nvc0_fence.c index 47ab388a606e..8e5a2f407ed4 100644 --- a/drivers/gpu/drm/nouveau/nvc0_fence.c +++ b/drivers/gpu/drm/nouveau/nvc0_fence.c @@ -32,6 +32,7 @@ struct nvc0_fence_priv { struct nouveau_fence_priv base; struct nouveau_bo *bo; + u32 *suspend; }; struct nvc0_fence_chan { @@ -125,12 +126,36 @@ nvc0_fence_context_new(struct nouveau_channel *chan, int engine) static int nvc0_fence_fini(struct drm_device *dev, int engine, bool suspend) { + struct nouveau_fifo_priv *pfifo = nv_engine(dev, NVOBJ_ENGINE_FIFO); + struct nvc0_fence_priv *priv = nv_engine(dev, engine); + int i; + + if (suspend) { + priv->suspend = vmalloc(pfifo->channels * sizeof(u32)); + if (!priv->suspend) + return -ENOMEM; + + for (i = 0; i < pfifo->channels; i++) + priv->suspend[i] = nouveau_bo_rd32(priv->bo, i); + } + return 0; } static int nvc0_fence_init(struct drm_device *dev, int engine) { + struct nouveau_fifo_priv *pfifo = nv_engine(dev, NVOBJ_ENGINE_FIFO); + struct nvc0_fence_priv *priv = nv_engine(dev, engine); + int i; + + if (priv->suspend) { + for (i = 0; i < pfifo->channels; i++) + nouveau_bo_wr32(priv->bo, i, priv->suspend[i]); + vfree(priv->suspend); + priv->suspend = NULL; + } + return 0; } |