revert between 56095 -> 55830 in arch
[AROS.git] / workbench / libs / mesa / src / gallium / drivers / nvc0 / nvc0_winsys.h
blob6519ce8e19f692ece4a94ffd7a40123166df1c34
2 #ifndef __NVC0_WINSYS_H__
3 #define __NVC0_WINSYS_H__
5 #include <stdint.h>
6 #include <unistd.h>
7 #include "pipe/p_defines.h"
9 #include "nouveau/nouveau_bo.h"
10 #include "nouveau/nouveau_channel.h"
11 #include "nouveau/nouveau_grobj.h"
12 #include "nouveau/nouveau_device.h"
13 #include "nouveau/nouveau_resource.h"
14 #include "nouveau/nouveau_pushbuf.h"
15 #include "nouveau/nouveau_reloc.h"
17 #include "nvc0_resource.h" /* OUT_RESRC */
19 #ifndef NV04_PFIFO_MAX_PACKET_LEN
20 #define NV04_PFIFO_MAX_PACKET_LEN 2047
21 #endif
23 #define NVC0_SUBCH_3D 1
24 #define NVC0_SUBCH_2D 2
25 #define NVC0_SUBCH_MF 3
27 #define NVC0_MF_(n) NVC0_M2MF_##n
29 #define RING_3D(n) ((NVC0_SUBCH_3D << 13) | (NVC0_3D_##n >> 2))
30 #define RING_2D(n) ((NVC0_SUBCH_2D << 13) | (NVC0_2D_##n >> 2))
31 #define RING_MF(n) ((NVC0_SUBCH_MF << 13) | (NVC0_MF_(n) >> 2))
33 #define RING_3D_(m) ((NVC0_SUBCH_3D << 13) | ((m) >> 2))
34 #define RING_2D_(m) ((NVC0_SUBCH_2D << 13) | ((m) >> 2))
35 #define RING_MF_(m) ((NVC0_SUBCH_MF << 13) | ((m) >> 2))
37 #define RING_GR(gr, m) (((gr)->subc << 13) | ((m) >> 2))
39 int nouveau_pushbuf_flush(struct nouveau_channel *, unsigned min);
41 static inline uint32_t
42 nouveau_bo_tile_layout(struct nouveau_bo *bo)
44 return bo->tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK;
47 static INLINE void
48 nouveau_bo_validate(struct nouveau_channel *chan,
49 struct nouveau_bo *bo, unsigned flags)
51 nouveau_reloc_emit(chan, NULL, 0, NULL, bo, 0, 0, flags, 0, 0);
54 /* incremental methods */
55 static INLINE void
56 BEGIN_RING(struct nouveau_channel *chan, uint32_t mthd, unsigned size)
58 WAIT_RING(chan, size + 1);
59 OUT_RING (chan, (0x2 << 28) | (size << 16) | mthd);
62 /* non-incremental */
63 static INLINE void
64 BEGIN_RING_NI(struct nouveau_channel *chan, uint32_t mthd, unsigned size)
66 WAIT_RING(chan, size + 1);
67 OUT_RING (chan, (0x6 << 28) | (size << 16) | mthd);
70 /* increment-once */
71 static INLINE void
72 BEGIN_RING_1I(struct nouveau_channel *chan, uint32_t mthd, unsigned size)
74 WAIT_RING(chan, size + 1);
75 OUT_RING (chan, (0xa << 28) | (size << 16) | mthd);
78 /* inline-data */
79 static INLINE void
80 IMMED_RING(struct nouveau_channel *chan, uint32_t mthd, unsigned data)
82 WAIT_RING(chan, 1);
83 OUT_RING (chan, (0x8 << 28) | (data << 16) | mthd);
86 static INLINE int
87 OUT_RESRCh(struct nouveau_channel *chan, struct nv04_resource *res,
88 unsigned delta, unsigned flags)
90 return OUT_RELOCh(chan, res->bo, res->offset + delta, res->domain | flags);
93 static INLINE int
94 OUT_RESRCl(struct nouveau_channel *chan, struct nv04_resource *res,
95 unsigned delta, unsigned flags)
97 if (flags & NOUVEAU_BO_WR)
98 res->status |= NOUVEAU_BUFFER_STATUS_GPU_WRITING;
99 return OUT_RELOCl(chan, res->bo, res->offset + delta, res->domain | flags);
102 static INLINE void
103 BIND_RING(struct nouveau_channel *chan, struct nouveau_grobj *gr, unsigned s)
105 struct nouveau_subchannel *subc = &gr->channel->subc[s];
107 assert(s < 8);
108 if (subc->gr) {
109 assert(subc->gr->bound != NOUVEAU_GROBJ_BOUND_EXPLICIT);
110 subc->gr->bound = NOUVEAU_GROBJ_UNBOUND;
112 subc->gr = gr;
113 subc->gr->subc = s;
114 subc->gr->bound = NOUVEAU_GROBJ_BOUND_EXPLICIT;
116 BEGIN_RING(chan, RING_GR(gr, 0x0000), 1);
117 OUT_RING (chan, gr->grclass);
120 #endif