1 #ifndef NOUVEAU_WINSYS_H
2 #define NOUVEAU_WINSYS_H
7 #include "pipe/p_defines.h"
9 #include "drm-uapi/drm.h"
12 #ifndef NV04_PFIFO_MAX_PACKET_LEN
13 #define NV04_PFIFO_MAX_PACKET_LEN 2047
16 #define NOUVEAU_MIN_BUFFER_MAP_ALIGN 64
17 #define NOUVEAU_MIN_BUFFER_MAP_ALIGN_MASK (NOUVEAU_MIN_BUFFER_MAP_ALIGN - 1)
19 static inline uint32_t
20 PUSH_AVAIL(struct nouveau_pushbuf
*push
)
22 return push
->end
- push
->cur
;
26 PUSH_SPACE(struct nouveau_pushbuf
*push
, uint32_t size
)
28 /* Provide a buffer so that fences always have room to be emitted */
30 if (PUSH_AVAIL(push
) < size
)
31 return nouveau_pushbuf_space(push
, size
, 0, 0) == 0;
36 PUSH_DATA(struct nouveau_pushbuf
*push
, uint32_t data
)
42 PUSH_DATAp(struct nouveau_pushbuf
*push
, const void *data
, uint32_t size
)
44 memcpy(push
->cur
, data
, size
* 4);
49 PUSH_DATAb(struct nouveau_pushbuf
*push
, const void *data
, uint32_t size
)
51 memcpy(push
->cur
, data
, size
);
52 push
->cur
+= DIV_ROUND_UP(size
, 4);
56 PUSH_DATAf(struct nouveau_pushbuf
*push
, float f
)
58 union { float f
; uint32_t i
; } u
;
64 PUSH_KICK(struct nouveau_pushbuf
*push
)
66 nouveau_pushbuf_kick(push
, push
->channel
);
70 #define NOUVEAU_RESOURCE_FLAG_LINEAR (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)
71 #define NOUVEAU_RESOURCE_FLAG_DRV_PRIV (PIPE_RESOURCE_FLAG_DRV_PRIV << 1)
73 static inline uint32_t
74 nouveau_screen_transfer_flags(unsigned pipe
)
78 if (!(pipe
& PIPE_TRANSFER_UNSYNCHRONIZED
)) {
79 if (pipe
& PIPE_TRANSFER_READ
)
80 flags
|= NOUVEAU_BO_RD
;
81 if (pipe
& PIPE_TRANSFER_WRITE
)
82 flags
|= NOUVEAU_BO_WR
;
83 if (pipe
& PIPE_TRANSFER_DONTBLOCK
)
84 flags
|= NOUVEAU_BO_NOBLOCK
;
90 extern struct nouveau_screen
*
91 nv30_screen_create(struct nouveau_device
*);
93 extern struct nouveau_screen
*
94 nv50_screen_create(struct nouveau_device
*);
96 extern struct nouveau_screen
*
97 nvc0_screen_create(struct nouveau_device
*);