aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2011-06-03 00:23:30 -0400
committerBen Skeggs <bskeggs@redhat.com>2011-06-23 01:59:18 -0400
commit6e32fedc8b50d3571bdec4e9849e45659ac96599 (patch)
tree3895a1fd7ac7ad7959ea274416b284cdba510c75
parentdd6a46cc922bec58e9c73782cd59f50a239c4fa7 (diff)
drm/nouveau: will need to specify channel for vm-ful gpuobj allocations
Abuses existing gpuobj_new() chan argument for this, which in turn forces all NVOBJ_FLAG_VM allocations to be done from the global heap, not suballocated from the channel's private heap. Not a problem though in practise. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h9
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_object.c4
-rw-r--r--drivers/gpu/drm/nouveau/nv04_instmem.c3
-rw-r--r--drivers/gpu/drm/nouveau/nv50_instmem.c5
-rw-r--r--drivers/gpu/drm/nouveau/nvc0_copy.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvc0_graph.c10
6 files changed, 19 insertions, 14 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index e8357c969adb..0f5396602afb 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -324,7 +324,8 @@ struct nouveau_instmem_engine {
324 int (*suspend)(struct drm_device *dev); 324 int (*suspend)(struct drm_device *dev);
325 void (*resume)(struct drm_device *dev); 325 void (*resume)(struct drm_device *dev);
326 326
327 int (*get)(struct nouveau_gpuobj *, u32 size, u32 align); 327 int (*get)(struct nouveau_gpuobj *, struct nouveau_channel *,
328 u32 size, u32 align);
328 void (*put)(struct nouveau_gpuobj *); 329 void (*put)(struct nouveau_gpuobj *);
329 int (*map)(struct nouveau_gpuobj *); 330 int (*map)(struct nouveau_gpuobj *);
330 void (*unmap)(struct nouveau_gpuobj *); 331 void (*unmap)(struct nouveau_gpuobj *);
@@ -1183,7 +1184,8 @@ extern int nv04_instmem_init(struct drm_device *);
1183extern void nv04_instmem_takedown(struct drm_device *); 1184extern void nv04_instmem_takedown(struct drm_device *);
1184extern int nv04_instmem_suspend(struct drm_device *); 1185extern int nv04_instmem_suspend(struct drm_device *);
1185extern void nv04_instmem_resume(struct drm_device *); 1186extern void nv04_instmem_resume(struct drm_device *);
1186extern int nv04_instmem_get(struct nouveau_gpuobj *, u32 size, u32 align); 1187extern int nv04_instmem_get(struct nouveau_gpuobj *, struct nouveau_channel *,
1188 u32 size, u32 align);
1187extern void nv04_instmem_put(struct nouveau_gpuobj *); 1189extern void nv04_instmem_put(struct nouveau_gpuobj *);
1188extern int nv04_instmem_map(struct nouveau_gpuobj *); 1190extern int nv04_instmem_map(struct nouveau_gpuobj *);
1189extern void nv04_instmem_unmap(struct nouveau_gpuobj *); 1191extern void nv04_instmem_unmap(struct nouveau_gpuobj *);
@@ -1194,7 +1196,8 @@ extern int nv50_instmem_init(struct drm_device *);
1194extern void nv50_instmem_takedown(struct drm_device *); 1196extern void nv50_instmem_takedown(struct drm_device *);
1195extern int nv50_instmem_suspend(struct drm_device *); 1197extern int nv50_instmem_suspend(struct drm_device *);
1196extern void nv50_instmem_resume(struct drm_device *); 1198extern void nv50_instmem_resume(struct drm_device *);
1197extern int nv50_instmem_get(struct nouveau_gpuobj *, u32 size, u32 align); 1199extern int nv50_instmem_get(struct nouveau_gpuobj *, struct nouveau_channel *,
1200 u32 size, u32 align);
1198extern void nv50_instmem_put(struct nouveau_gpuobj *); 1201extern void nv50_instmem_put(struct nouveau_gpuobj *);
1199extern int nv50_instmem_map(struct nouveau_gpuobj *); 1202extern int nv50_instmem_map(struct nouveau_gpuobj *);
1200extern void nv50_instmem_unmap(struct nouveau_gpuobj *); 1203extern void nv50_instmem_unmap(struct nouveau_gpuobj *);
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c
index c56ac93aee72..ab4be9ca43cc 100644
--- a/drivers/gpu/drm/nouveau/nouveau_object.c
+++ b/drivers/gpu/drm/nouveau/nouveau_object.c
@@ -191,7 +191,7 @@ nouveau_gpuobj_new(struct drm_device *dev, struct nouveau_channel *chan,
191 list_add_tail(&gpuobj->list, &dev_priv->gpuobj_list); 191 list_add_tail(&gpuobj->list, &dev_priv->gpuobj_list);
192 spin_unlock(&dev_priv->ramin_lock); 192 spin_unlock(&dev_priv->ramin_lock);
193 193
194 if (chan) { 194 if (!(flags & NVOBJ_FLAG_VM) && chan) {
195 ramin = drm_mm_search_free(&chan->ramin_heap, size, align, 0); 195 ramin = drm_mm_search_free(&chan->ramin_heap, size, align, 0);
196 if (ramin) 196 if (ramin)
197 ramin = drm_mm_get_block(ramin, size, align); 197 ramin = drm_mm_get_block(ramin, size, align);
@@ -208,7 +208,7 @@ nouveau_gpuobj_new(struct drm_device *dev, struct nouveau_channel *chan,
208 gpuobj->vinst = ramin->start + chan->ramin->vinst; 208 gpuobj->vinst = ramin->start + chan->ramin->vinst;
209 gpuobj->node = ramin; 209 gpuobj->node = ramin;
210 } else { 210 } else {
211 ret = instmem->get(gpuobj, size, align); 211 ret = instmem->get(gpuobj, chan, size, align);
212 if (ret) { 212 if (ret) {
213 nouveau_gpuobj_ref(NULL, &gpuobj); 213 nouveau_gpuobj_ref(NULL, &gpuobj);
214 return ret; 214 return ret;
diff --git a/drivers/gpu/drm/nouveau/nv04_instmem.c b/drivers/gpu/drm/nouveau/nv04_instmem.c
index b8611b955313..ae36bfc84853 100644
--- a/drivers/gpu/drm/nouveau/nv04_instmem.c
+++ b/drivers/gpu/drm/nouveau/nv04_instmem.c
@@ -112,7 +112,8 @@ nv04_instmem_resume(struct drm_device *dev)
112} 112}
113 113
114int 114int
115nv04_instmem_get(struct nouveau_gpuobj *gpuobj, u32 size, u32 align) 115nv04_instmem_get(struct nouveau_gpuobj *gpuobj, struct nouveau_channel *chan,
116 u32 size, u32 align)
116{ 117{
117 struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private; 118 struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private;
118 struct drm_mm_node *ramin = NULL; 119 struct drm_mm_node *ramin = NULL;
diff --git a/drivers/gpu/drm/nouveau/nv50_instmem.c b/drivers/gpu/drm/nouveau/nv50_instmem.c
index ccea671346c9..a7c12c94a5a6 100644
--- a/drivers/gpu/drm/nouveau/nv50_instmem.c
+++ b/drivers/gpu/drm/nouveau/nv50_instmem.c
@@ -306,7 +306,8 @@ struct nv50_gpuobj_node {
306}; 306};
307 307
308int 308int
309nv50_instmem_get(struct nouveau_gpuobj *gpuobj, u32 size, u32 align) 309nv50_instmem_get(struct nouveau_gpuobj *gpuobj, struct nouveau_channel *chan,
310 u32 size, u32 align)
310{ 311{
311 struct drm_device *dev = gpuobj->dev; 312 struct drm_device *dev = gpuobj->dev;
312 struct drm_nouveau_private *dev_priv = dev->dev_private; 313 struct drm_nouveau_private *dev_priv = dev->dev_private;
@@ -335,7 +336,7 @@ nv50_instmem_get(struct nouveau_gpuobj *gpuobj, u32 size, u32 align)
335 if (!(gpuobj->flags & NVOBJ_FLAG_VM_USER)) 336 if (!(gpuobj->flags & NVOBJ_FLAG_VM_USER))
336 flags |= NV_MEM_ACCESS_SYS; 337 flags |= NV_MEM_ACCESS_SYS;
337 338
338 ret = nouveau_vm_get(dev_priv->chan_vm, size, 12, flags, 339 ret = nouveau_vm_get(chan->vm, size, 12, flags,
339 &node->chan_vma); 340 &node->chan_vma);
340 if (ret) { 341 if (ret) {
341 vram->put(dev, &node->vram); 342 vram->put(dev, &node->vram);
diff --git a/drivers/gpu/drm/nouveau/nvc0_copy.c b/drivers/gpu/drm/nouveau/nvc0_copy.c
index 02c00bbeb9e5..5ebcd74244db 100644
--- a/drivers/gpu/drm/nouveau/nvc0_copy.c
+++ b/drivers/gpu/drm/nouveau/nvc0_copy.c
@@ -48,7 +48,7 @@ nvc0_copy_context_new(struct nouveau_channel *chan, int engine)
48 struct nouveau_gpuobj *ctx = NULL; 48 struct nouveau_gpuobj *ctx = NULL;
49 int ret; 49 int ret;
50 50
51 ret = nouveau_gpuobj_new(dev, NULL, 256, 256, 51 ret = nouveau_gpuobj_new(dev, chan, 256, 256,
52 NVOBJ_FLAG_VM | NVOBJ_FLAG_VM_USER | 52 NVOBJ_FLAG_VM | NVOBJ_FLAG_VM_USER |
53 NVOBJ_FLAG_ZERO_ALLOC, &ctx); 53 NVOBJ_FLAG_ZERO_ALLOC, &ctx);
54 if (ret) 54 if (ret)
diff --git a/drivers/gpu/drm/nouveau/nvc0_graph.c b/drivers/gpu/drm/nouveau/nvc0_graph.c
index 68b25ca4015c..56aa92fddc05 100644
--- a/drivers/gpu/drm/nouveau/nvc0_graph.c
+++ b/drivers/gpu/drm/nouveau/nvc0_graph.c
@@ -157,23 +157,23 @@ nvc0_graph_create_context_mmio_list(struct nouveau_channel *chan)
157 int i = 0, gpc, tp, ret; 157 int i = 0, gpc, tp, ret;
158 u32 magic; 158 u32 magic;
159 159
160 ret = nouveau_gpuobj_new(dev, NULL, 0x2000, 256, NVOBJ_FLAG_VM, 160 ret = nouveau_gpuobj_new(dev, chan, 0x2000, 256, NVOBJ_FLAG_VM,
161 &grch->unk408004); 161 &grch->unk408004);
162 if (ret) 162 if (ret)
163 return ret; 163 return ret;
164 164
165 ret = nouveau_gpuobj_new(dev, NULL, 0x8000, 256, NVOBJ_FLAG_VM, 165 ret = nouveau_gpuobj_new(dev, chan, 0x8000, 256, NVOBJ_FLAG_VM,
166 &grch->unk40800c); 166 &grch->unk40800c);
167 if (ret) 167 if (ret)
168 return ret; 168 return ret;
169 169
170 ret = nouveau_gpuobj_new(dev, NULL, 384 * 1024, 4096, 170 ret = nouveau_gpuobj_new(dev, chan, 384 * 1024, 4096,
171 NVOBJ_FLAG_VM | NVOBJ_FLAG_VM_USER, 171 NVOBJ_FLAG_VM | NVOBJ_FLAG_VM_USER,
172 &grch->unk418810); 172 &grch->unk418810);
173 if (ret) 173 if (ret)
174 return ret; 174 return ret;
175 175
176 ret = nouveau_gpuobj_new(dev, NULL, 0x1000, 0, NVOBJ_FLAG_VM, 176 ret = nouveau_gpuobj_new(dev, chan, 0x1000, 0, NVOBJ_FLAG_VM,
177 &grch->mmio); 177 &grch->mmio);
178 if (ret) 178 if (ret)
179 return ret; 179 return ret;
@@ -235,7 +235,7 @@ nvc0_graph_context_new(struct nouveau_channel *chan, int engine)
235 return -ENOMEM; 235 return -ENOMEM;
236 chan->engctx[NVOBJ_ENGINE_GR] = grch; 236 chan->engctx[NVOBJ_ENGINE_GR] = grch;
237 237
238 ret = nouveau_gpuobj_new(dev, NULL, priv->grctx_size, 256, 238 ret = nouveau_gpuobj_new(dev, chan, priv->grctx_size, 256,
239 NVOBJ_FLAG_VM | NVOBJ_FLAG_ZERO_ALLOC, 239 NVOBJ_FLAG_VM | NVOBJ_FLAG_ZERO_ALLOC,
240 &grch->grctx); 240 &grch->grctx);
241 if (ret) 241 if (ret)