Commit 6e32fedc authored by Ben Skeggs's avatar Ben Skeggs

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: default avatarBen Skeggs <bskeggs@redhat.com>
parent dd6a46cc
...@@ -324,7 +324,8 @@ struct nouveau_instmem_engine { ...@@ -324,7 +324,8 @@ struct nouveau_instmem_engine {
int (*suspend)(struct drm_device *dev); int (*suspend)(struct drm_device *dev);
void (*resume)(struct drm_device *dev); void (*resume)(struct drm_device *dev);
int (*get)(struct nouveau_gpuobj *, u32 size, u32 align); int (*get)(struct nouveau_gpuobj *, struct nouveau_channel *,
u32 size, u32 align);
void (*put)(struct nouveau_gpuobj *); void (*put)(struct nouveau_gpuobj *);
int (*map)(struct nouveau_gpuobj *); int (*map)(struct nouveau_gpuobj *);
void (*unmap)(struct nouveau_gpuobj *); void (*unmap)(struct nouveau_gpuobj *);
...@@ -1183,7 +1184,8 @@ extern int nv04_instmem_init(struct drm_device *); ...@@ -1183,7 +1184,8 @@ extern int nv04_instmem_init(struct drm_device *);
extern void nv04_instmem_takedown(struct drm_device *); extern void nv04_instmem_takedown(struct drm_device *);
extern int nv04_instmem_suspend(struct drm_device *); extern int nv04_instmem_suspend(struct drm_device *);
extern void nv04_instmem_resume(struct drm_device *); extern void nv04_instmem_resume(struct drm_device *);
extern int nv04_instmem_get(struct nouveau_gpuobj *, u32 size, u32 align); extern int nv04_instmem_get(struct nouveau_gpuobj *, struct nouveau_channel *,
u32 size, u32 align);
extern void nv04_instmem_put(struct nouveau_gpuobj *); extern void nv04_instmem_put(struct nouveau_gpuobj *);
extern int nv04_instmem_map(struct nouveau_gpuobj *); extern int nv04_instmem_map(struct nouveau_gpuobj *);
extern void nv04_instmem_unmap(struct nouveau_gpuobj *); extern void nv04_instmem_unmap(struct nouveau_gpuobj *);
...@@ -1194,7 +1196,8 @@ extern int nv50_instmem_init(struct drm_device *); ...@@ -1194,7 +1196,8 @@ extern int nv50_instmem_init(struct drm_device *);
extern void nv50_instmem_takedown(struct drm_device *); extern void nv50_instmem_takedown(struct drm_device *);
extern int nv50_instmem_suspend(struct drm_device *); extern int nv50_instmem_suspend(struct drm_device *);
extern void nv50_instmem_resume(struct drm_device *); extern void nv50_instmem_resume(struct drm_device *);
extern int nv50_instmem_get(struct nouveau_gpuobj *, u32 size, u32 align); extern int nv50_instmem_get(struct nouveau_gpuobj *, struct nouveau_channel *,
u32 size, u32 align);
extern void nv50_instmem_put(struct nouveau_gpuobj *); extern void nv50_instmem_put(struct nouveau_gpuobj *);
extern int nv50_instmem_map(struct nouveau_gpuobj *); extern int nv50_instmem_map(struct nouveau_gpuobj *);
extern void nv50_instmem_unmap(struct nouveau_gpuobj *); extern void nv50_instmem_unmap(struct nouveau_gpuobj *);
......
...@@ -191,7 +191,7 @@ nouveau_gpuobj_new(struct drm_device *dev, struct nouveau_channel *chan, ...@@ -191,7 +191,7 @@ nouveau_gpuobj_new(struct drm_device *dev, struct nouveau_channel *chan,
list_add_tail(&gpuobj->list, &dev_priv->gpuobj_list); list_add_tail(&gpuobj->list, &dev_priv->gpuobj_list);
spin_unlock(&dev_priv->ramin_lock); spin_unlock(&dev_priv->ramin_lock);
if (chan) { if (!(flags & NVOBJ_FLAG_VM) && chan) {
ramin = drm_mm_search_free(&chan->ramin_heap, size, align, 0); ramin = drm_mm_search_free(&chan->ramin_heap, size, align, 0);
if (ramin) if (ramin)
ramin = drm_mm_get_block(ramin, size, align); ramin = drm_mm_get_block(ramin, size, align);
...@@ -208,7 +208,7 @@ nouveau_gpuobj_new(struct drm_device *dev, struct nouveau_channel *chan, ...@@ -208,7 +208,7 @@ nouveau_gpuobj_new(struct drm_device *dev, struct nouveau_channel *chan,
gpuobj->vinst = ramin->start + chan->ramin->vinst; gpuobj->vinst = ramin->start + chan->ramin->vinst;
gpuobj->node = ramin; gpuobj->node = ramin;
} else { } else {
ret = instmem->get(gpuobj, size, align); ret = instmem->get(gpuobj, chan, size, align);
if (ret) { if (ret) {
nouveau_gpuobj_ref(NULL, &gpuobj); nouveau_gpuobj_ref(NULL, &gpuobj);
return ret; return ret;
......
...@@ -112,7 +112,8 @@ nv04_instmem_resume(struct drm_device *dev) ...@@ -112,7 +112,8 @@ nv04_instmem_resume(struct drm_device *dev)
} }
int int
nv04_instmem_get(struct nouveau_gpuobj *gpuobj, u32 size, u32 align) nv04_instmem_get(struct nouveau_gpuobj *gpuobj, struct nouveau_channel *chan,
u32 size, u32 align)
{ {
struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private; struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private;
struct drm_mm_node *ramin = NULL; struct drm_mm_node *ramin = NULL;
......
...@@ -306,7 +306,8 @@ struct nv50_gpuobj_node { ...@@ -306,7 +306,8 @@ struct nv50_gpuobj_node {
}; };
int int
nv50_instmem_get(struct nouveau_gpuobj *gpuobj, u32 size, u32 align) nv50_instmem_get(struct nouveau_gpuobj *gpuobj, struct nouveau_channel *chan,
u32 size, u32 align)
{ {
struct drm_device *dev = gpuobj->dev; struct drm_device *dev = gpuobj->dev;
struct drm_nouveau_private *dev_priv = dev->dev_private; 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,7 +336,7 @@ nv50_instmem_get(struct nouveau_gpuobj *gpuobj, u32 size, u32 align)
if (!(gpuobj->flags & NVOBJ_FLAG_VM_USER)) if (!(gpuobj->flags & NVOBJ_FLAG_VM_USER))
flags |= NV_MEM_ACCESS_SYS; flags |= NV_MEM_ACCESS_SYS;
ret = nouveau_vm_get(dev_priv->chan_vm, size, 12, flags, ret = nouveau_vm_get(chan->vm, size, 12, flags,
&node->chan_vma); &node->chan_vma);
if (ret) { if (ret) {
vram->put(dev, &node->vram); vram->put(dev, &node->vram);
......
...@@ -48,7 +48,7 @@ nvc0_copy_context_new(struct nouveau_channel *chan, int engine) ...@@ -48,7 +48,7 @@ nvc0_copy_context_new(struct nouveau_channel *chan, int engine)
struct nouveau_gpuobj *ctx = NULL; struct nouveau_gpuobj *ctx = NULL;
int ret; int ret;
ret = nouveau_gpuobj_new(dev, NULL, 256, 256, ret = nouveau_gpuobj_new(dev, chan, 256, 256,
NVOBJ_FLAG_VM | NVOBJ_FLAG_VM_USER | NVOBJ_FLAG_VM | NVOBJ_FLAG_VM_USER |
NVOBJ_FLAG_ZERO_ALLOC, &ctx); NVOBJ_FLAG_ZERO_ALLOC, &ctx);
if (ret) if (ret)
......
...@@ -157,23 +157,23 @@ nvc0_graph_create_context_mmio_list(struct nouveau_channel *chan) ...@@ -157,23 +157,23 @@ nvc0_graph_create_context_mmio_list(struct nouveau_channel *chan)
int i = 0, gpc, tp, ret; int i = 0, gpc, tp, ret;
u32 magic; u32 magic;
ret = nouveau_gpuobj_new(dev, NULL, 0x2000, 256, NVOBJ_FLAG_VM, ret = nouveau_gpuobj_new(dev, chan, 0x2000, 256, NVOBJ_FLAG_VM,
&grch->unk408004); &grch->unk408004);
if (ret) if (ret)
return ret; return ret;
ret = nouveau_gpuobj_new(dev, NULL, 0x8000, 256, NVOBJ_FLAG_VM, ret = nouveau_gpuobj_new(dev, chan, 0x8000, 256, NVOBJ_FLAG_VM,
&grch->unk40800c); &grch->unk40800c);
if (ret) if (ret)
return ret; return ret;
ret = nouveau_gpuobj_new(dev, NULL, 384 * 1024, 4096, ret = nouveau_gpuobj_new(dev, chan, 384 * 1024, 4096,
NVOBJ_FLAG_VM | NVOBJ_FLAG_VM_USER, NVOBJ_FLAG_VM | NVOBJ_FLAG_VM_USER,
&grch->unk418810); &grch->unk418810);
if (ret) if (ret)
return ret; return ret;
ret = nouveau_gpuobj_new(dev, NULL, 0x1000, 0, NVOBJ_FLAG_VM, ret = nouveau_gpuobj_new(dev, chan, 0x1000, 0, NVOBJ_FLAG_VM,
&grch->mmio); &grch->mmio);
if (ret) if (ret)
return ret; return ret;
...@@ -235,7 +235,7 @@ nvc0_graph_context_new(struct nouveau_channel *chan, int engine) ...@@ -235,7 +235,7 @@ nvc0_graph_context_new(struct nouveau_channel *chan, int engine)
return -ENOMEM; return -ENOMEM;
chan->engctx[NVOBJ_ENGINE_GR] = grch; chan->engctx[NVOBJ_ENGINE_GR] = grch;
ret = nouveau_gpuobj_new(dev, NULL, priv->grctx_size, 256, ret = nouveau_gpuobj_new(dev, chan, priv->grctx_size, 256,
NVOBJ_FLAG_VM | NVOBJ_FLAG_ZERO_ALLOC, NVOBJ_FLAG_VM | NVOBJ_FLAG_ZERO_ALLOC,
&grch->grctx); &grch->grctx);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment