aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2012-09-27 21:50:29 -0400
committerBen Skeggs <bskeggs@redhat.com>2012-10-02 23:12:22 -0400
commitd6ba6d215a538a58f0f0026f0961b0b9125e8042 (patch)
tree121208b325939051307ea9cf28be867ab558ecef /drivers/gpu/drm
parenta0d271cbfed1dd50278c6b06bead3d00ba0a88f9 (diff)
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')
-rw-r--r--drivers/gpu/drm/nouveau/nvc0_fence.c25
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 @@
32struct nvc0_fence_priv { 32struct nvc0_fence_priv {
33 struct nouveau_fence_priv base; 33 struct nouveau_fence_priv base;
34 struct nouveau_bo *bo; 34 struct nouveau_bo *bo;
35 u32 *suspend;
35}; 36};
36 37
37struct nvc0_fence_chan { 38struct nvc0_fence_chan {
@@ -125,12 +126,36 @@ nvc0_fence_context_new(struct nouveau_channel *chan, int engine)
125static int 126static int
126nvc0_fence_fini(struct drm_device *dev, int engine, bool suspend) 127nvc0_fence_fini(struct drm_device *dev, int engine, bool suspend)
127{ 128{
129 struct nouveau_fifo_priv *pfifo = nv_engine(dev, NVOBJ_ENGINE_FIFO);
130 struct nvc0_fence_priv *priv = nv_engine(dev, engine);
131 int i;
132
133 if (suspend) {
134 priv->suspend = vmalloc(pfifo->channels * sizeof(u32));
135 if (!priv->suspend)
136 return -ENOMEM;
137
138 for (i = 0; i < pfifo->channels; i++)
139 priv->suspend[i] = nouveau_bo_rd32(priv->bo, i);
140 }
141
128 return 0; 142 return 0;
129} 143}
130 144
131static int 145static int
132nvc0_fence_init(struct drm_device *dev, int engine) 146nvc0_fence_init(struct drm_device *dev, int engine)
133{ 147{
148 struct nouveau_fifo_priv *pfifo = nv_engine(dev, NVOBJ_ENGINE_FIFO);
149 struct nvc0_fence_priv *priv = nv_engine(dev, engine);
150 int i;
151
152 if (priv->suspend) {
153 for (i = 0; i < pfifo->channels; i++)
154 nouveau_bo_wr32(priv->bo, i, priv->suspend[i]);
155 vfree(priv->suspend);
156 priv->suspend = NULL;
157 }
158
134 return 0; 159 return 0;
135} 160}
136 161