aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-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