Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 329618
b: refs/heads/master
c: 9da226f
h: refs/heads/master
v: v3
  • Loading branch information
Ben Skeggs committed Oct 3, 2012
1 parent 0d4b3b6 commit ace4204
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 70ee6f1cd6911098ddd4c11ee21b69dbe51fb3f9
refs/heads/master: 9da226f698c01b268b9172050df4150f269a7613
40 changes: 21 additions & 19 deletions trunk/drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ struct nvc0_fifo_priv {
struct nouveau_fifo_priv base;
struct nouveau_gpuobj *playlist[2];
int cur_playlist;
struct nouveau_vma user_vma;
struct {
struct nouveau_gpuobj *mem;
struct nouveau_vma bar;
} user;
int spoon_nr;
};

struct nvc0_fifo_chan {
struct nouveau_fifo_chan base;
struct nouveau_gpuobj *user;
};

static void
Expand Down Expand Up @@ -78,6 +80,7 @@ nvc0_fifo_context_new(struct nouveau_channel *chan, int engine)
struct nouveau_instmem_engine *pinstmem = &dev_priv->engine.instmem;
struct nvc0_fifo_priv *priv = nv_engine(dev, engine);
struct nvc0_fifo_chan *fctx;
u64 usermem = priv->user.mem->vinst + chan->id * 0x1000;
u64 ib_virt = chan->pushbuf_base + chan->dma.ib_base * 4;
int ret, i;

Expand All @@ -86,26 +89,17 @@ nvc0_fifo_context_new(struct nouveau_channel *chan, int engine)
return -ENOMEM;

chan->user = ioremap_wc(pci_resource_start(dev->pdev, 1) +
priv->user_vma.offset + (chan->id * 0x1000),
priv->user.bar.offset + (chan->id * 0x1000),
PAGE_SIZE);
if (!chan->user) {
ret = -ENOMEM;
goto error;
}

/* allocate vram for control regs, map into polling area */
ret = nouveau_gpuobj_new(dev, NULL, 0x1000, 0x1000,
NVOBJ_FLAG_ZERO_ALLOC, &fctx->user);
if (ret)
goto error;

nouveau_vm_map_at(&priv->user_vma, chan->id * 0x1000,
*(struct nouveau_mem **)fctx->user->node);

for (i = 0; i < 0x100; i += 4)
nv_wo32(chan->ramin, i, 0x00000000);
nv_wo32(chan->ramin, 0x08, lower_32_bits(fctx->user->vinst));
nv_wo32(chan->ramin, 0x0c, upper_32_bits(fctx->user->vinst));
nv_wo32(chan->ramin, 0x08, lower_32_bits(usermem));
nv_wo32(chan->ramin, 0x0c, upper_32_bits(usermem));
nv_wo32(chan->ramin, 0x10, 0x0000face);
nv_wo32(chan->ramin, 0x30, 0xfffff902);
nv_wo32(chan->ramin, 0x48, lower_32_bits(ib_virt));
Expand Down Expand Up @@ -147,7 +141,6 @@ nvc0_fifo_context_del(struct nouveau_channel *chan, int engine)
nvc0_fifo_playlist_update(dev);
nv_wr32(dev, 0x003000 + (chan->id * 8), 0x00000000);

nouveau_gpuobj_ref(NULL, &fctx->user);
if (chan->user) {
iounmap(chan->user);
chan->user = NULL;
Expand Down Expand Up @@ -192,7 +185,7 @@ nvc0_fifo_init(struct drm_device *dev, int engine)
}

nv_mask(dev, 0x002200, 0x00000001, 0x00000001);
nv_wr32(dev, 0x002254, 0x10000000 | priv->user_vma.offset >> 12);
nv_wr32(dev, 0x002254, 0x10000000 | priv->user.bar.offset >> 12);

nv_wr32(dev, 0x002a00, 0xffffffff); /* clears PFIFO.INTR bit 30 */
nv_wr32(dev, 0x002100, 0xffffffff);
Expand Down Expand Up @@ -429,7 +422,9 @@ nvc0_fifo_destroy(struct drm_device *dev, int engine)
struct nvc0_fifo_priv *priv = nv_engine(dev, NVOBJ_ENGINE_FIFO);
struct drm_nouveau_private *dev_priv = dev->dev_private;

nouveau_vm_put(&priv->user_vma);
nouveau_vm_put(&priv->user.bar);
nouveau_gpuobj_ref(NULL, &priv->user.mem);

nouveau_gpuobj_ref(NULL, &priv->playlist[1]);
nouveau_gpuobj_ref(NULL, &priv->playlist[0]);

Expand Down Expand Up @@ -464,11 +459,18 @@ nvc0_fifo_create(struct drm_device *dev)
if (ret)
goto error;

ret = nouveau_vm_get(dev_priv->bar1_vm, priv->base.channels * 0x1000,
12, NV_MEM_ACCESS_RW, &priv->user_vma);
ret = nouveau_gpuobj_new(dev, NULL, priv->base.channels * 4096, 0x1000,
NVOBJ_FLAG_ZERO_ALLOC, &priv->user.mem);
if (ret)
goto error;

ret = nouveau_vm_get(dev_priv->bar1_vm, priv->user.mem->size,
12, NV_MEM_ACCESS_RW, &priv->user.bar);
if (ret)
goto error;

nouveau_vm_map(&priv->user.bar, *(struct nouveau_mem **)priv->user.mem->node);

nouveau_irq_register(dev, 8, nvc0_fifo_isr);
error:
if (ret)
Expand Down

0 comments on commit ace4204

Please sign in to comment.