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, ((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, 0); \
44 #define OUT_RELOC(bo,data,flags,vor,tor) do { \
45 NOUVEAU_PUSH_CONTEXT(pc); \
46 pc->nvws->push_reloc(pc->nvws, pc->nvws->channel->pushbuf->cur++, \
47 (bo), (data), (flags), (vor), (tor)); \
50 /* Raw data + flags depending on FB/TT buffer */
51 #define OUT_RELOCd(bo,data,flags,vor,tor) do { \
52 OUT_RELOC((bo), (data), (flags) | NOUVEAU_BO_OR, (vor), (tor)); \
55 /* FB/TT object handle */
56 #define OUT_RELOCo(bo,flags) do { \
57 OUT_RELOC((bo), 0, (flags) | NOUVEAU_BO_OR, \
58 pc->nvws->channel->vram->handle, \
59 pc->nvws->channel->gart->handle); \
62 /* Low 32-bits of offset */
63 #define OUT_RELOCl(bo,delta,flags) do { \
64 OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_LOW, 0, 0); \
67 /* High 32-bits of offset */
68 #define OUT_RELOCh(bo,delta,flags) do { \
69 OUT_RELOC((bo), (delta), (flags) | NOUVEAU_BO_HIGH, 0, 0); \
72 /* A reloc which'll recombine into a NV_DMA_METHOD packet header */
73 #define OUT_RELOCm(bo, flags, obj, mthd, size) do { \
74 NOUVEAU_PUSH_CONTEXT(pc); \
75 if (pc->nvws->channel->pushbuf->remaining < ((size) + 1)) \
76 pc->nvws->push_flush(pc->nvws->channel, ((size) + 1)); \
77 OUT_RELOCd((bo), (pc->obj->subc << 13) | ((size) << 18) | (mthd), \
79 pc->nvws->channel->pushbuf->remaining -= ((size) + 1); \