Commit ce163f69 authored by Ben Skeggs's avatar Ben Skeggs

drm/nv50-nvc0: explicitly map pushbuf bo into channel vm

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 0b718733
...@@ -56,6 +56,11 @@ nouveau_channel_pushbuf_init(struct nouveau_channel *chan) ...@@ -56,6 +56,11 @@ nouveau_channel_pushbuf_init(struct nouveau_channel *chan)
*/ */
chan->pushbuf_base = chan->pushbuf_bo->bo.offset; chan->pushbuf_base = chan->pushbuf_bo->bo.offset;
if (dev_priv->card_type >= NV_50) { if (dev_priv->card_type >= NV_50) {
ret = nouveau_bo_vma_add(chan->pushbuf_bo, chan->vm,
&chan->pushbuf_vma);
if (ret)
goto out;
if (dev_priv->card_type < NV_C0) { if (dev_priv->card_type < NV_C0) {
ret = nouveau_gpuobj_dma_new(chan, ret = nouveau_gpuobj_dma_new(chan,
NV_CLASS_DMA_IN_MEMORY, 0, NV_CLASS_DMA_IN_MEMORY, 0,
...@@ -64,7 +69,7 @@ nouveau_channel_pushbuf_init(struct nouveau_channel *chan) ...@@ -64,7 +69,7 @@ nouveau_channel_pushbuf_init(struct nouveau_channel *chan)
NV_MEM_TARGET_VM, NV_MEM_TARGET_VM,
&chan->pushbuf); &chan->pushbuf);
} }
chan->pushbuf_base = chan->pushbuf_bo->vma.offset; chan->pushbuf_base = chan->pushbuf_vma.offset;
} else } else
if (chan->pushbuf_bo->bo.mem.mem_type == TTM_PL_TT) { if (chan->pushbuf_bo->bo.mem.mem_type == TTM_PL_TT) {
ret = nouveau_gpuobj_dma_new(chan, NV_CLASS_DMA_IN_MEMORY, 0, ret = nouveau_gpuobj_dma_new(chan, NV_CLASS_DMA_IN_MEMORY, 0,
...@@ -95,6 +100,7 @@ nouveau_channel_pushbuf_init(struct nouveau_channel *chan) ...@@ -95,6 +100,7 @@ nouveau_channel_pushbuf_init(struct nouveau_channel *chan)
out: out:
if (ret) { if (ret) {
NV_ERROR(dev, "error initialising pushbuf: %d\n", ret); NV_ERROR(dev, "error initialising pushbuf: %d\n", ret);
nouveau_bo_vma_del(chan->pushbuf_bo, &chan->pushbuf_vma);
nouveau_gpuobj_ref(NULL, &chan->pushbuf); nouveau_gpuobj_ref(NULL, &chan->pushbuf);
if (chan->pushbuf_bo) { if (chan->pushbuf_bo) {
nouveau_bo_unmap(chan->pushbuf_bo); nouveau_bo_unmap(chan->pushbuf_bo);
...@@ -295,6 +301,7 @@ nouveau_channel_put_unlocked(struct nouveau_channel **pchan) ...@@ -295,6 +301,7 @@ nouveau_channel_put_unlocked(struct nouveau_channel **pchan)
/* destroy any resources the channel owned */ /* destroy any resources the channel owned */
nouveau_gpuobj_ref(NULL, &chan->pushbuf); nouveau_gpuobj_ref(NULL, &chan->pushbuf);
if (chan->pushbuf_bo) { if (chan->pushbuf_bo) {
nouveau_bo_vma_del(chan->pushbuf_bo, &chan->pushbuf_vma);
nouveau_bo_unmap(chan->pushbuf_bo); nouveau_bo_unmap(chan->pushbuf_bo);
nouveau_bo_unpin(chan->pushbuf_bo); nouveau_bo_unpin(chan->pushbuf_bo);
nouveau_bo_ref(NULL, &chan->pushbuf_bo); nouveau_bo_ref(NULL, &chan->pushbuf_bo);
......
...@@ -245,6 +245,7 @@ struct nouveau_channel { ...@@ -245,6 +245,7 @@ struct nouveau_channel {
/* DMA push buffer */ /* DMA push buffer */
struct nouveau_gpuobj *pushbuf; struct nouveau_gpuobj *pushbuf;
struct nouveau_bo *pushbuf_bo; struct nouveau_bo *pushbuf_bo;
struct nouveau_vma pushbuf_vma;
uint32_t pushbuf_base; uint32_t pushbuf_base;
/* Notifier memory */ /* Notifier memory */
......
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