1 #ifndef __NOUVEAU_PUSH_H__
2 #define __NOUVEAU_PUSH_H__
4 #include "nouveau/nouveau_winsys.h"
6 #ifndef NOUVEAU_PUSH_CONTEXT
7 #error undefined push context
10 #define OUT_RING(data) do { \
11 NOUVEAU_PUSH_CONTEXT(pc); \
12 (*pc->nvws->channel->pushbuf->cur++) = (data); \
15 #define OUT_RINGp(src,size) do { \
16 NOUVEAU_PUSH_CONTEXT(pc); \
17 memcpy(pc->nvws->channel->pushbuf->cur, (src), (size) * 4); \
18 pc->nvws->channel->pushbuf->cur += (size); \
21 #define OUT_RINGf(data) do { \
22 union { float v; uint32_t u; } c; \
27 #define BEGIN_RING(obj,mthd,size) do { \
28 NOUVEAU_PUSH_CONTEXT(pc); \
29 if (pc->nvws->channel->pushbuf->remaining < ((size) + 1)) \
30 pc->nvws->push_flush(pc->nvws->channel, ((size) + 1)); \
31 OUT_RING((pc->obj->subc << 13) | ((size) << 18) | (mthd)); \
32 pc->nvws->channel->pushbuf->remaining -= ((size) + 1); \
35 #define BEGIN_RING_NI(obj,mthd,size) do { \
36 BEGIN_RING(obj, (mthd) | 0x40000000, (size)); \
39 #define FIRE_RING() do { \
40 NOUVEAU_PUSH_CONTEXT(pc); \
41 pc->nvws->push_flush(pc->nvws->channel, 0); \
44 #define OUT_RELOC(bo,data,flags,vor,tor) do { \
45 NOUVEAU_PUSH_CONTEXT(pc); \
46 pc->nvws->push_reloc(pc->nvws->channel, \
47 pc->nvws->channel->pushbuf->cur++, \
48 (bo), (data), (flags), (vor), (tor)); \
51 /* Raw data + flags depending on FB/TT buffer */
52 #define OUT_RELOCd(bo,data,flags,vor,tor) do { \
53 OUT_RELOC((bo), (data), (flags) | NOUVEAU_BO_OR, (vor), (tor)); \
56 /* FB/TT object handle */
57 #define OUT_RELOCo(bo,flags) do { \
58 OUT_RELOC((bo), 0, (flags) | NOUVEAU_BO_OR, \
59 pc->nvws->channel->vram->handle, \
60 pc->nvws->channel->gart->handle); \
63 /* Low 32-bits of offset */
64 #define OUT_RELOCl(bo,delta,flags) do { \
65 OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_LOW, 0, 0); \
68 /* High 32-bits of offset */
69 #define OUT_RELOCh(bo,delta,flags) do { \
70 OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_HIGH, 0, 0); \
73 /* A reloc which'll recombine into a NV_DMA_METHOD packet header */
74 #define OUT_RELOCm(bo, flags, obj, mthd, size) do { \
75 NOUVEAU_PUSH_CONTEXT(pc); \
76 if (pc->nvws->channel->pushbuf->remaining < ((size) + 1)) \
77 pc->nvws->push_flush(pc->nvws->channel, ((size) + 1)); \
78 OUT_RELOCd((bo), (pc->obj->subc << 13) | ((size) << 18) | (mthd), \
80 pc->nvws->channel->pushbuf->remaining -= ((size) + 1); \