2 #ifndef __NV50_WINSYS_H__
3 #define __NV50_WINSYS_H__
8 #include "pipe/p_defines.h"
10 #include "nouveau_winsys.h"
11 #include "nouveau_buffer.h"
14 #ifndef NV04_PFIFO_MAX_PACKET_LEN
15 #define NV04_PFIFO_MAX_PACKET_LEN 2047
20 nv50_add_bufctx_resident_bo(struct nouveau_bufctx
*bufctx
, int bin
,
21 unsigned flags
, struct nouveau_bo
*bo
)
23 nouveau_bufctx_refn(bufctx
, bin
, bo
, flags
)->priv
= NULL
;
27 nv50_add_bufctx_resident(struct nouveau_bufctx
*bufctx
, int bin
,
28 struct nv04_resource
*res
, unsigned flags
)
30 struct nouveau_bufref
*ref
=
31 nouveau_bufctx_refn(bufctx
, bin
, res
->bo
, flags
| res
->domain
);
33 ref
->priv_data
= flags
;
36 #define BCTX_REFN_bo(ctx, bin, fl, bo) \
37 nv50_add_bufctx_resident_bo(ctx, NV50_BIND_##bin, fl, bo);
39 #define BCTX_REFN(bctx, bin, res, acc) \
40 nv50_add_bufctx_resident(bctx, NV50_BIND_##bin, res, NOUVEAU_BO_##acc)
43 PUSH_REFN(struct nouveau_pushbuf
*push
, struct nouveau_bo
*bo
, uint32_t flags
)
45 struct nouveau_pushbuf_refn ref
= { bo
, flags
};
46 nouveau_pushbuf_refn(push
, &ref
, 1);
50 #define SUBC_3D(m) 3, (m)
51 #define NV50_3D(n) SUBC_3D(NV50_3D_##n)
52 #define NV84_3D(n) SUBC_3D(NV84_3D_##n)
53 #define NVA0_3D(n) SUBC_3D(NVA0_3D_##n)
55 #define SUBC_2D(m) 4, (m)
56 #define NV50_2D(n) SUBC_2D(NV50_2D_##n)
58 #define SUBC_M2MF(m) 5, (m)
59 #define NV50_M2MF(n) SUBC_M2MF(NV50_M2MF_##n)
61 #define SUBC_CP(m) 6, (m)
62 #define NV50_CP(n) SUBC_CP(NV50_COMPUTE_##n)
65 static inline uint32_t
66 NV50_FIFO_PKHDR(int subc
, int mthd
, unsigned size
)
68 return 0x00000000 | (size
<< 18) | (subc
<< 13) | mthd
;
71 static inline uint32_t
72 NV50_FIFO_PKHDR_NI(int subc
, int mthd
, unsigned size
)
74 return 0x40000000 | (size
<< 18) | (subc
<< 13) | mthd
;
77 static inline uint32_t
78 NV50_FIFO_PKHDR_L(int subc
, int mthd
)
80 return 0x00030000 | (subc
<< 13) | mthd
;
84 static inline uint32_t
85 nouveau_bo_memtype(const struct nouveau_bo
*bo
)
87 return bo
->config
.nv50
.memtype
;
92 PUSH_DATAh(struct nouveau_pushbuf
*push
, uint64_t data
)
94 *push
->cur
++ = (uint32_t)(data
>> 32);
98 BEGIN_NV04(struct nouveau_pushbuf
*push
, int subc
, int mthd
, unsigned size
)
100 #ifndef NV50_PUSH_EXPLICIT_SPACE_CHECKING
101 PUSH_SPACE(push
, size
+ 1);
103 PUSH_DATA (push
, NV50_FIFO_PKHDR(subc
, mthd
, size
));
107 BEGIN_NI04(struct nouveau_pushbuf
*push
, int subc
, int mthd
, unsigned size
)
109 #ifndef NV50_PUSH_EXPLICIT_SPACE_CHECKING
110 PUSH_SPACE(push
, size
+ 1);
112 PUSH_DATA (push
, NV50_FIFO_PKHDR_NI(subc
, mthd
, size
));
115 /* long, non-incremental, nv50-only */
117 BEGIN_NL50(struct nouveau_pushbuf
*push
, int subc
, int mthd
, uint32_t size
)
119 #ifndef NV50_PUSH_EXPLICIT_SPACE_CHECKING
122 PUSH_DATA (push
, NV50_FIFO_PKHDR_L(subc
, mthd
));
123 PUSH_DATA (push
, size
);
126 #endif /* __NV50_WINSYS_H__ */