aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_dma.h
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2012-07-19 18:17:34 -0400
committerBen Skeggs <bskeggs@redhat.com>2012-10-02 23:12:56 -0400
commitebb945a94bba2ce8dff7b0942ff2b3f2a52a0a69 (patch)
tree07cad59be501458e6ae1304b7c0352e322ac3387 /drivers/gpu/drm/nouveau/nouveau_dma.h
parentac1499d9573f4aadd1d2beac11fe23af8ce90c24 (diff)
drm/nouveau: port all engines to new engine module format
This is a HUGE commit, but it's not nearly as bad as it looks - any problems can be isolated to a particular chipset and engine combination. It was simply too difficult to port each one at a time, the compat layers are *already* ridiculous. Most of the changes here are simply to the glue, the process for each of the engine modules was to start with a standard skeleton and copy+paste the old code into the appropriate places, fixing up variable names etc as needed. v2: Marcin Slusarz <marcin.slusarz@gmail.com> - fix find/replace bug in license header v3: Ben Skeggs <bskeggs@redhat.com> - bump indirect pushbuf size to 8KiB, 4KiB barely enough for userspace and left no space for kernel's requirements during GEM pushbuf submission. - fix duplicate assignments noticed by clang v4: Marcin Slusarz <marcin.slusarz@gmail.com> - add sparse annotations to nv04_fifo_pause/nv04_fifo_start - use ioread32_native/iowrite32_native for fifo control registers v5: Ben Skeggs <bskeggs@redhat.com> - rebase on v3.6-rc4, modified to keep copy engine fix intact - nv10/fence: unmap fence bo before destroying - fixed fermi regression when using nvidia gr fuc - fixed typo in supported dma_mask checking Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_dma.h')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_dma.h51
1 files changed, 34 insertions, 17 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.h b/drivers/gpu/drm/nouveau/nouveau_dma.h
index 8db68be9544f..5c2e22932d1c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dma.h
+++ b/drivers/gpu/drm/nouveau/nouveau_dma.h
@@ -27,10 +27,10 @@
27#ifndef __NOUVEAU_DMA_H__ 27#ifndef __NOUVEAU_DMA_H__
28#define __NOUVEAU_DMA_H__ 28#define __NOUVEAU_DMA_H__
29 29
30#ifndef NOUVEAU_DMA_DEBUG 30#include "nouveau_bo.h"
31#define NOUVEAU_DMA_DEBUG 0 31#include "nouveau_chan.h"
32#endif
33 32
33int nouveau_dma_wait(struct nouveau_channel *, int slots, int size);
34void nv50_dma_push(struct nouveau_channel *, struct nouveau_bo *, 34void nv50_dma_push(struct nouveau_channel *, struct nouveau_bo *,
35 int delta, int length); 35 int delta, int length);
36 36
@@ -116,12 +116,7 @@ RING_SPACE(struct nouveau_channel *chan, int size)
116static inline void 116static inline void
117OUT_RING(struct nouveau_channel *chan, int data) 117OUT_RING(struct nouveau_channel *chan, int data)
118{ 118{
119 if (NOUVEAU_DMA_DEBUG) { 119 nouveau_bo_wr32(chan->push.buffer, chan->dma.cur++, data);
120 NV_INFO(chan->dev, "Ch%d/0x%08x: 0x%08x\n",
121 chan->id, chan->dma.cur << 2, data);
122 }
123
124 nouveau_bo_wr32(chan->pushbuf_bo, chan->dma.cur++, data);
125} 120}
126 121
127extern void 122extern void
@@ -159,24 +154,19 @@ BEGIN_IMC0(struct nouveau_channel *chan, int subc, int mthd, u16 data)
159 154
160#define WRITE_PUT(val) do { \ 155#define WRITE_PUT(val) do { \
161 DRM_MEMORYBARRIER(); \ 156 DRM_MEMORYBARRIER(); \
162 nouveau_bo_rd32(chan->pushbuf_bo, 0); \ 157 nouveau_bo_rd32(chan->push.buffer, 0); \
163 nvchan_wr32(chan, chan->user_put, ((val) << 2) + chan->pushbuf_base); \ 158 nv_wo32(chan->object, chan->user_put, ((val) << 2) + chan->push.vma.offset); \
164} while (0) 159} while (0)
165 160
166static inline void 161static inline void
167FIRE_RING(struct nouveau_channel *chan) 162FIRE_RING(struct nouveau_channel *chan)
168{ 163{
169 if (NOUVEAU_DMA_DEBUG) {
170 NV_INFO(chan->dev, "Ch%d/0x%08x: PUSH!\n",
171 chan->id, chan->dma.cur << 2);
172 }
173
174 if (chan->dma.cur == chan->dma.put) 164 if (chan->dma.cur == chan->dma.put)
175 return; 165 return;
176 chan->accel_done = true; 166 chan->accel_done = true;
177 167
178 if (chan->dma.ib_max) { 168 if (chan->dma.ib_max) {
179 nv50_dma_push(chan, chan->pushbuf_bo, chan->dma.put << 2, 169 nv50_dma_push(chan, chan->push.buffer, chan->dma.put << 2,
180 (chan->dma.cur - chan->dma.put) << 2); 170 (chan->dma.cur - chan->dma.put) << 2);
181 } else { 171 } else {
182 WRITE_PUT(chan->dma.cur); 172 WRITE_PUT(chan->dma.cur);
@@ -191,4 +181,31 @@ WIND_RING(struct nouveau_channel *chan)
191 chan->dma.cur = chan->dma.put; 181 chan->dma.cur = chan->dma.put;
192} 182}
193 183
184/* FIFO methods */
185#define NV01_SUBCHAN_OBJECT 0x00000000
186#define NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH 0x00000010
187#define NV84_SUBCHAN_SEMAPHORE_ADDRESS_LOW 0x00000014
188#define NV84_SUBCHAN_SEMAPHORE_SEQUENCE 0x00000018
189#define NV84_SUBCHAN_SEMAPHORE_TRIGGER 0x0000001c
190#define NV84_SUBCHAN_SEMAPHORE_TRIGGER_ACQUIRE_EQUAL 0x00000001
191#define NV84_SUBCHAN_SEMAPHORE_TRIGGER_WRITE_LONG 0x00000002
192#define NV84_SUBCHAN_SEMAPHORE_TRIGGER_ACQUIRE_GEQUAL 0x00000004
193#define NVC0_SUBCHAN_SEMAPHORE_TRIGGER_YIELD 0x00001000
194#define NV84_SUBCHAN_NOTIFY_INTR 0x00000020
195#define NV84_SUBCHAN_WRCACHE_FLUSH 0x00000024
196#define NV10_SUBCHAN_REF_CNT 0x00000050
197#define NVSW_SUBCHAN_PAGE_FLIP 0x00000054
198#define NV11_SUBCHAN_DMA_SEMAPHORE 0x00000060
199#define NV11_SUBCHAN_SEMAPHORE_OFFSET 0x00000064
200#define NV11_SUBCHAN_SEMAPHORE_ACQUIRE 0x00000068
201#define NV11_SUBCHAN_SEMAPHORE_RELEASE 0x0000006c
202#define NV40_SUBCHAN_YIELD 0x00000080
203
204/* NV_SW object class */
205#define NV_SW_DMA_VBLSEM 0x0000018c
206#define NV_SW_VBLSEM_OFFSET 0x00000400
207#define NV_SW_VBLSEM_RELEASE_VALUE 0x00000404
208#define NV_SW_VBLSEM_RELEASE 0x00000408
209#define NV_SW_PAGE_FLIP 0x00000500
210
194#endif 211#endif