2 #ifndef __NV50_WINSYS_H__
3 #define __NV50_WINSYS_H__
8 #include "pipe/p_defines.h"
10 #include "nouveau/nouveau_bo.h"
11 #include "nouveau/nouveau_channel.h"
12 #include "nouveau/nouveau_grobj.h"
13 #include "nouveau/nouveau_device.h"
14 #include "nouveau/nouveau_resource.h"
15 #include "nouveau/nouveau_pushbuf.h"
16 #include "nouveau/nouveau_reloc.h"
17 #include "nouveau/nouveau_notifier.h"
19 #include "nouveau/nouveau_buffer.h"
21 #ifndef NV04_PFIFO_MAX_PACKET_LEN
22 #define NV04_PFIFO_MAX_PACKET_LEN 2047
25 #define NV50_SUBCH_3D 5
26 #define NV50_SUBCH_2D 6
27 #define NV50_SUBCH_MF 7
29 #define NV50_MF_(n) NV50_M2MF_##n
31 #define RING_3D(n) ((NV50_SUBCH_3D << 13) | NV50_3D_##n)
32 #define RING_2D(n) ((NV50_SUBCH_2D << 13) | NV50_2D_##n)
33 #define RING_MF(n) ((NV50_SUBCH_MF << 13) | NV50_MF_(n))
35 #define RING_3D_(m) ((NV50_SUBCH_3D << 13) | (m))
36 #define RING_2D_(m) ((NV50_SUBCH_2D << 13) | (m))
37 #define RING_MF_(m) ((NV50_SUBCH_MF << 13) | (m))
39 #define RING_GR(gr, m) (((gr)->subc << 13) | (m))
41 int nouveau_pushbuf_flush(struct nouveau_channel
*, unsigned min
);
43 static inline uint32_t
44 nouveau_bo_tile_layout(struct nouveau_bo
*bo
)
46 return bo
->tile_flags
& NOUVEAU_BO_TILE_LAYOUT_MASK
;
50 nouveau_bo_validate(struct nouveau_channel
*chan
,
51 struct nouveau_bo
*bo
, unsigned flags
)
53 nouveau_reloc_emit(chan
, NULL
, 0, NULL
, bo
, 0, 0, flags
, 0, 0);
56 /* incremental methods */
58 BEGIN_RING(struct nouveau_channel
*chan
, uint32_t mthd
, unsigned size
)
60 WAIT_RING(chan
, size
+ 1);
61 OUT_RING (chan
, (size
<< 18) | mthd
);
66 BEGIN_RING_NI(struct nouveau_channel
*chan
, uint32_t mthd
, unsigned size
)
68 WAIT_RING(chan
, size
+ 1);
69 OUT_RING (chan
, (0x2 << 29) | (size
<< 18) | mthd
);
73 OUT_RESRCh(struct nouveau_channel
*chan
, struct nv04_resource
*res
,
74 unsigned delta
, unsigned flags
)
76 return OUT_RELOCh(chan
, res
->bo
, res
->offset
+ delta
, res
->domain
| flags
);
80 OUT_RESRCl(struct nouveau_channel
*chan
, struct nv04_resource
*res
,
81 unsigned delta
, unsigned flags
)
83 if (flags
& NOUVEAU_BO_WR
)
84 res
->status
|= NOUVEAU_BUFFER_STATUS_GPU_WRITING
;
85 return OUT_RELOCl(chan
, res
->bo
, res
->offset
+ delta
, res
->domain
| flags
);
89 BIND_RING(struct nouveau_channel
*chan
, struct nouveau_grobj
*gr
, unsigned s
)
91 struct nouveau_subchannel
*subc
= &gr
->channel
->subc
[s
];
95 assert(subc
->gr
->bound
!= NOUVEAU_GROBJ_BOUND_EXPLICIT
);
96 subc
->gr
->bound
= NOUVEAU_GROBJ_UNBOUND
;
100 subc
->gr
->bound
= NOUVEAU_GROBJ_BOUND_EXPLICIT
;
102 BEGIN_RING(chan
, RING_GR(gr
, 0x0000), 1);
103 OUT_RING (chan
, gr
->handle
);