nv30: more interface updates
[profile/ivi/mesa.git] / src / mesa / pipe / nv30 / nv30_dma.h
1 #ifndef __NV30_DMA_H__
2 #define __NV30_DMA_H__
3
4 #include "pipe/nouveau/nouveau_winsys.h"
5
6 #define OUT_RING(data) do {                                                    \
7         (*nv30->nvws->channel->pushbuf->cur++) = (data);                       \
8 } while(0)
9
10 #define OUT_RINGp(src,size) do {                                               \
11         memcpy(nv30->nvws->channel->pushbuf->cur, (src), (size) * 4);          \
12         nv30->nvws->channel->pushbuf->cur += (size);                           \
13 } while(0)
14
15 #define OUT_RINGf(data) do {                                                   \
16         union { float v; uint32_t u; } c;                                      \
17         c.v = (data);                                                          \
18         OUT_RING(c.u);                                                         \
19 } while(0)
20
21 #define BEGIN_RING(obj,mthd,size) do {                                         \
22         if (nv30->nvws->channel->pushbuf->remaining < ((size) + 1))            \
23                 nv30->nvws->push_flush(nv30->nvws->channel, ((size) + 1));     \
24         OUT_RING((nv30->obj->subc << 13) | ((size) << 18) | (mthd));           \
25         nv30->nvws->channel->pushbuf->remaining -= ((size) + 1);               \
26 } while(0)
27
28 #define BEGIN_RING_NI(obj,mthd,size) do {                                      \
29         BEGIN_RING(obj, (mthd) | 0x40000000, (size));                          \
30 } while(0)
31
32 #define FIRE_RING() do {                                                       \
33         nv30->nvws->push_flush(nv30->nvws->channel, 0);                        \
34 } while(0)
35
36 #define OUT_RELOC(bo,data,flags,vor,tor) do {                                  \
37         nv30->nvws->push_reloc(nv30->nvws->channel,                            \
38                                nv30->nvws->channel->pushbuf->cur++,            \
39                                (struct nouveau_bo *)(bo),                      \
40                                (data), (flags), (vor), (tor));                 \
41 } while(0)
42
43 /* Raw data + flags depending on FB/TT buffer */
44 #define OUT_RELOCd(bo,data,flags,vor,tor) do {                                 \
45         OUT_RELOC((bo), (data), (flags) | NOUVEAU_BO_OR, (vor), (tor));        \
46 } while(0)
47
48 /* FB/TT object handle */
49 #define OUT_RELOCo(bo,flags) do {                                              \
50         OUT_RELOC((bo), 0, (flags) | NOUVEAU_BO_OR,                            \
51                   nv30->nvws->channel->vram->handle,                           \
52                   nv30->nvws->channel->gart->handle);                          \
53 } while(0)
54
55 /* Low 32-bits of offset */
56 #define OUT_RELOCl(bo,delta,flags) do {                                        \
57         OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_LOW, 0, 0);              \
58 } while(0)
59
60 /* High 32-bits of offset */
61 #define OUT_RELOCh(bo,delta,flags) do {                                        \
62         OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_HIGH, 0, 0);             \
63 } while(0)
64
65 #endif