.. | .. |
---|
21 | 21 | * |
---|
22 | 22 | * Authors: Ben Skeggs |
---|
23 | 23 | */ |
---|
24 | | - |
---|
25 | 24 | #include "nouveau_drv.h" |
---|
26 | 25 | #include "nouveau_dma.h" |
---|
27 | 26 | #include "nouveau_fence.h" |
---|
.. | .. |
---|
29 | 28 | |
---|
30 | 29 | #include "nv50_display.h" |
---|
31 | 30 | |
---|
| 31 | +#include <nvif/push206e.h> |
---|
| 32 | + |
---|
| 33 | +#include <nvhw/class/cl826f.h> |
---|
| 34 | + |
---|
32 | 35 | static int |
---|
33 | 36 | nv84_fence_emit32(struct nouveau_channel *chan, u64 virtual, u32 sequence) |
---|
34 | 37 | { |
---|
35 | | - int ret = RING_SPACE(chan, 8); |
---|
| 38 | + struct nvif_push *push = chan->chan.push; |
---|
| 39 | + int ret = PUSH_WAIT(push, 8); |
---|
36 | 40 | if (ret == 0) { |
---|
37 | | - BEGIN_NV04(chan, 0, NV11_SUBCHAN_DMA_SEMAPHORE, 1); |
---|
38 | | - OUT_RING (chan, chan->vram.handle); |
---|
39 | | - BEGIN_NV04(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 5); |
---|
40 | | - OUT_RING (chan, upper_32_bits(virtual)); |
---|
41 | | - OUT_RING (chan, lower_32_bits(virtual)); |
---|
42 | | - OUT_RING (chan, sequence); |
---|
43 | | - OUT_RING (chan, NV84_SUBCHAN_SEMAPHORE_TRIGGER_WRITE_LONG); |
---|
44 | | - OUT_RING (chan, 0x00000000); |
---|
45 | | - FIRE_RING (chan); |
---|
| 41 | + PUSH_MTHD(push, NV826F, SET_CONTEXT_DMA_SEMAPHORE, chan->vram.handle); |
---|
| 42 | + |
---|
| 43 | + PUSH_MTHD(push, NV826F, SEMAPHOREA, |
---|
| 44 | + NVVAL(NV826F, SEMAPHOREA, OFFSET_UPPER, upper_32_bits(virtual)), |
---|
| 45 | + |
---|
| 46 | + SEMAPHOREB, lower_32_bits(virtual), |
---|
| 47 | + SEMAPHOREC, sequence, |
---|
| 48 | + |
---|
| 49 | + SEMAPHORED, |
---|
| 50 | + NVDEF(NV826F, SEMAPHORED, OPERATION, RELEASE), |
---|
| 51 | + |
---|
| 52 | + NON_STALLED_INTERRUPT, 0); |
---|
| 53 | + PUSH_KICK(push); |
---|
46 | 54 | } |
---|
47 | 55 | return ret; |
---|
48 | 56 | } |
---|
.. | .. |
---|
50 | 58 | static int |
---|
51 | 59 | nv84_fence_sync32(struct nouveau_channel *chan, u64 virtual, u32 sequence) |
---|
52 | 60 | { |
---|
53 | | - int ret = RING_SPACE(chan, 7); |
---|
| 61 | + struct nvif_push *push = chan->chan.push; |
---|
| 62 | + int ret = PUSH_WAIT(push, 7); |
---|
54 | 63 | if (ret == 0) { |
---|
55 | | - BEGIN_NV04(chan, 0, NV11_SUBCHAN_DMA_SEMAPHORE, 1); |
---|
56 | | - OUT_RING (chan, chan->vram.handle); |
---|
57 | | - BEGIN_NV04(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 4); |
---|
58 | | - OUT_RING (chan, upper_32_bits(virtual)); |
---|
59 | | - OUT_RING (chan, lower_32_bits(virtual)); |
---|
60 | | - OUT_RING (chan, sequence); |
---|
61 | | - OUT_RING (chan, NV84_SUBCHAN_SEMAPHORE_TRIGGER_ACQUIRE_GEQUAL); |
---|
62 | | - FIRE_RING (chan); |
---|
| 64 | + PUSH_MTHD(push, NV826F, SET_CONTEXT_DMA_SEMAPHORE, chan->vram.handle); |
---|
| 65 | + |
---|
| 66 | + PUSH_MTHD(push, NV826F, SEMAPHOREA, |
---|
| 67 | + NVVAL(NV826F, SEMAPHOREA, OFFSET_UPPER, upper_32_bits(virtual)), |
---|
| 68 | + |
---|
| 69 | + SEMAPHOREB, lower_32_bits(virtual), |
---|
| 70 | + SEMAPHOREC, sequence, |
---|
| 71 | + |
---|
| 72 | + SEMAPHORED, |
---|
| 73 | + NVDEF(NV826F, SEMAPHORED, OPERATION, ACQ_GEQ)); |
---|
| 74 | + PUSH_KICK(push); |
---|
63 | 75 | } |
---|
64 | 76 | return ret; |
---|
65 | 77 | } |
---|
.. | .. |
---|
109 | 121 | int |
---|
110 | 122 | nv84_fence_context_new(struct nouveau_channel *chan) |
---|
111 | 123 | { |
---|
112 | | - struct nouveau_cli *cli = (void *)chan->user.client; |
---|
113 | 124 | struct nv84_fence_priv *priv = chan->drm->fence; |
---|
114 | 125 | struct nv84_fence_chan *fctx; |
---|
115 | 126 | int ret; |
---|
.. | .. |
---|
127 | 138 | fctx->base.sequence = nv84_fence_read(chan); |
---|
128 | 139 | |
---|
129 | 140 | mutex_lock(&priv->mutex); |
---|
130 | | - ret = nouveau_vma_new(priv->bo, &cli->vmm, &fctx->vma); |
---|
| 141 | + ret = nouveau_vma_new(priv->bo, chan->vmm, &fctx->vma); |
---|
131 | 142 | mutex_unlock(&priv->mutex); |
---|
132 | 143 | |
---|
133 | 144 | if (ret) |
---|
.. | .. |
---|
198 | 209 | mutex_init(&priv->mutex); |
---|
199 | 210 | |
---|
200 | 211 | /* Use VRAM if there is any ; otherwise fallback to system memory */ |
---|
201 | | - domain = drm->client.device.info.ram_size != 0 ? TTM_PL_FLAG_VRAM : |
---|
202 | | - /* |
---|
203 | | - * fences created in sysmem must be non-cached or we |
---|
204 | | - * will lose CPU/GPU coherency! |
---|
205 | | - */ |
---|
206 | | - TTM_PL_FLAG_TT | TTM_PL_FLAG_UNCACHED; |
---|
| 212 | + domain = drm->client.device.info.ram_size != 0 ? |
---|
| 213 | + NOUVEAU_GEM_DOMAIN_VRAM : |
---|
| 214 | + /* |
---|
| 215 | + * fences created in sysmem must be non-cached or we |
---|
| 216 | + * will lose CPU/GPU coherency! |
---|
| 217 | + */ |
---|
| 218 | + NOUVEAU_GEM_DOMAIN_GART | NOUVEAU_GEM_DOMAIN_COHERENT; |
---|
207 | 219 | ret = nouveau_bo_new(&drm->client, 16 * drm->chan.nr, 0, |
---|
208 | 220 | domain, 0, 0, NULL, NULL, &priv->bo); |
---|
209 | 221 | if (ret == 0) { |
---|