diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2011-06-03 00:23:30 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-06-23 01:59:18 -0400 |
commit | 6e32fedc8b50d3571bdec4e9849e45659ac96599 (patch) | |
tree | 3895a1fd7ac7ad7959ea274416b284cdba510c75 | |
parent | dd6a46cc922bec58e9c73782cd59f50a239c4fa7 (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.h | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_object.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv04_instmem.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_instmem.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvc0_copy.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvc0_graph.c | 10 |
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 *); | |||
1183 | extern void nv04_instmem_takedown(struct drm_device *); | 1184 | extern void nv04_instmem_takedown(struct drm_device *); |
1184 | extern int nv04_instmem_suspend(struct drm_device *); | 1185 | extern int nv04_instmem_suspend(struct drm_device *); |
1185 | extern void nv04_instmem_resume(struct drm_device *); | 1186 | extern void nv04_instmem_resume(struct drm_device *); |
1186 | extern int nv04_instmem_get(struct nouveau_gpuobj *, u32 size, u32 align); | 1187 | extern int nv04_instmem_get(struct nouveau_gpuobj *, struct nouveau_channel *, |
1188 | u32 size, u32 align); | ||
1187 | extern void nv04_instmem_put(struct nouveau_gpuobj *); | 1189 | extern void nv04_instmem_put(struct nouveau_gpuobj *); |
1188 | extern int nv04_instmem_map(struct nouveau_gpuobj *); | 1190 | extern int nv04_instmem_map(struct nouveau_gpuobj *); |
1189 | extern void nv04_instmem_unmap(struct nouveau_gpuobj *); | 1191 | extern void nv04_instmem_unmap(struct nouveau_gpuobj *); |
@@ -1194,7 +1196,8 @@ extern int nv50_instmem_init(struct drm_device *); | |||
1194 | extern void nv50_instmem_takedown(struct drm_device *); | 1196 | extern void nv50_instmem_takedown(struct drm_device *); |
1195 | extern int nv50_instmem_suspend(struct drm_device *); | 1197 | extern int nv50_instmem_suspend(struct drm_device *); |
1196 | extern void nv50_instmem_resume(struct drm_device *); | 1198 | extern void nv50_instmem_resume(struct drm_device *); |
1197 | extern int nv50_instmem_get(struct nouveau_gpuobj *, u32 size, u32 align); | 1199 | extern int nv50_instmem_get(struct nouveau_gpuobj *, struct nouveau_channel *, |
1200 | u32 size, u32 align); | ||
1198 | extern void nv50_instmem_put(struct nouveau_gpuobj *); | 1201 | extern void nv50_instmem_put(struct nouveau_gpuobj *); |
1199 | extern int nv50_instmem_map(struct nouveau_gpuobj *); | 1202 | extern int nv50_instmem_map(struct nouveau_gpuobj *); |
1200 | extern void nv50_instmem_unmap(struct nouveau_gpuobj *); | 1203 | extern 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 | ||
114 | int | 114 | int |
115 | nv04_instmem_get(struct nouveau_gpuobj *gpuobj, u32 size, u32 align) | 115 | nv04_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 | ||
308 | int | 308 | int |
309 | nv50_instmem_get(struct nouveau_gpuobj *gpuobj, u32 size, u32 align) | 309 | nv50_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) |