aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nv50_instmem.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2010-10-25 01:23:59 -0400
committerBen Skeggs <bskeggs@redhat.com>2010-12-03 00:11:47 -0500
commitdc1e5c0dbff27c2b5147eaea16c578d2337870c3 (patch)
tree82b7bd25bd162d5a9bcc5ee0598e697e1ddbd08e /drivers/gpu/drm/nouveau/nv50_instmem.c
parentfce2bad0ee2666d6a10bfeb634b1021469cc3d79 (diff)
drm/nouveau: simplify gpuobj suspend/resume
Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv50_instmem.c')
-rw-r--r--drivers/gpu/drm/nouveau/nv50_instmem.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_instmem.c b/drivers/gpu/drm/nouveau/nv50_instmem.c
index 2c98eb176d64..1640c12d8b3a 100644
--- a/drivers/gpu/drm/nouveau/nv50_instmem.c
+++ b/drivers/gpu/drm/nouveau/nv50_instmem.c
@@ -276,16 +276,8 @@ int
276nv50_instmem_suspend(struct drm_device *dev) 276nv50_instmem_suspend(struct drm_device *dev)
277{ 277{
278 struct drm_nouveau_private *dev_priv = dev->dev_private; 278 struct drm_nouveau_private *dev_priv = dev->dev_private;
279 struct nouveau_channel *chan = dev_priv->channels.ptr[0];
280 struct nouveau_gpuobj *ramin = chan->ramin;
281 int i;
282 279
283 ramin->im_backing_suspend = vmalloc(ramin->size); 280 dev_priv->ramin_available = false;
284 if (!ramin->im_backing_suspend)
285 return -ENOMEM;
286
287 for (i = 0; i < ramin->size; i += 4)
288 ramin->im_backing_suspend[i/4] = nv_ri32(dev, i);
289 return 0; 281 return 0;
290} 282}
291 283
@@ -295,17 +287,8 @@ nv50_instmem_resume(struct drm_device *dev)
295 struct drm_nouveau_private *dev_priv = dev->dev_private; 287 struct drm_nouveau_private *dev_priv = dev->dev_private;
296 struct nv50_instmem_priv *priv = dev_priv->engine.instmem.priv; 288 struct nv50_instmem_priv *priv = dev_priv->engine.instmem.priv;
297 struct nouveau_channel *chan = dev_priv->channels.ptr[0]; 289 struct nouveau_channel *chan = dev_priv->channels.ptr[0];
298 struct nouveau_gpuobj *ramin = chan->ramin;
299 int i; 290 int i;
300 291
301 dev_priv->ramin_available = false;
302 dev_priv->ramin_base = ~0;
303 for (i = 0; i < ramin->size; i += 4)
304 nv_wo32(ramin, i, ramin->im_backing_suspend[i/4]);
305 dev_priv->ramin_available = true;
306 vfree(ramin->im_backing_suspend);
307 ramin->im_backing_suspend = NULL;
308
309 /* Poke the relevant regs, and pray it works :) */ 292 /* Poke the relevant regs, and pray it works :) */
310 nv_wr32(dev, NV50_PUNK_BAR_CFG_BASE, (chan->ramin->vinst >> 12)); 293 nv_wr32(dev, NV50_PUNK_BAR_CFG_BASE, (chan->ramin->vinst >> 12));
311 nv_wr32(dev, NV50_PUNK_UNK1710, 0); 294 nv_wr32(dev, NV50_PUNK_UNK1710, 0);
@@ -318,6 +301,8 @@ nv50_instmem_resume(struct drm_device *dev)
318 301
319 for (i = 0; i < 8; i++) 302 for (i = 0; i < 8; i++)
320 nv_wr32(dev, 0x1900 + (i*4), 0); 303 nv_wr32(dev, 0x1900 + (i*4), 0);
304
305 dev_priv->ramin_available = true;
321} 306}
322 307
323int 308int