• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef NOUVEAU_WINSYS_H
2 #define NOUVEAU_WINSYS_H
3 
4 #include <stdint.h>
5 #include <inttypes.h>
6 
7 #include "pipe/p_defines.h"
8 
9 #include <libdrm/nouveau.h>
10 
11 #ifndef NV04_PFIFO_MAX_PACKET_LEN
12 #define NV04_PFIFO_MAX_PACKET_LEN 2047
13 #endif
14 
15 static INLINE uint32_t
PUSH_AVAIL(struct nouveau_pushbuf * push)16 PUSH_AVAIL(struct nouveau_pushbuf *push)
17 {
18    return push->end - push->cur;
19 }
20 
21 static INLINE boolean
PUSH_SPACE(struct nouveau_pushbuf * push,uint32_t size)22 PUSH_SPACE(struct nouveau_pushbuf *push, uint32_t size)
23 {
24    if (PUSH_AVAIL(push) < size)
25       return nouveau_pushbuf_space(push, size, 0, 0) == 0;
26    return TRUE;
27 }
28 
29 static INLINE void
PUSH_DATA(struct nouveau_pushbuf * push,uint32_t data)30 PUSH_DATA(struct nouveau_pushbuf *push, uint32_t data)
31 {
32    *push->cur++ = data;
33 }
34 
35 static INLINE void
PUSH_DATAp(struct nouveau_pushbuf * push,const void * data,uint32_t size)36 PUSH_DATAp(struct nouveau_pushbuf *push, const void *data, uint32_t size)
37 {
38    memcpy(push->cur, data, size * 4);
39    push->cur += size;
40 }
41 
42 static INLINE void
PUSH_DATAf(struct nouveau_pushbuf * push,float f)43 PUSH_DATAf(struct nouveau_pushbuf *push, float f)
44 {
45    union { float f; uint32_t i; } u;
46    u.f = f;
47    PUSH_DATA(push, u.i);
48 }
49 
50 static INLINE void
PUSH_KICK(struct nouveau_pushbuf * push)51 PUSH_KICK(struct nouveau_pushbuf *push)
52 {
53    nouveau_pushbuf_kick(push, push->channel);
54 }
55 
56 
57 #define NOUVEAU_RESOURCE_FLAG_LINEAR   (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)
58 #define NOUVEAU_RESOURCE_FLAG_DRV_PRIV (PIPE_RESOURCE_FLAG_DRV_PRIV << 1)
59 
60 static INLINE uint32_t
nouveau_screen_transfer_flags(unsigned pipe)61 nouveau_screen_transfer_flags(unsigned pipe)
62 {
63 	uint32_t flags = 0;
64 
65 	if (!(pipe & PIPE_TRANSFER_UNSYNCHRONIZED)) {
66 		if (pipe & PIPE_TRANSFER_READ)
67 			flags |= NOUVEAU_BO_RD;
68 		if (pipe & PIPE_TRANSFER_WRITE)
69 			flags |= NOUVEAU_BO_WR;
70 		if (pipe & PIPE_TRANSFER_DONTBLOCK)
71 			flags |= NOUVEAU_BO_NOBLOCK;
72 	}
73 
74 	return flags;
75 }
76 
77 extern struct pipe_screen *
78 nv30_screen_create(struct nouveau_device *);
79 
80 extern struct pipe_screen *
81 nv50_screen_create(struct nouveau_device *);
82 
83 extern struct pipe_screen *
84 nvc0_screen_create(struct nouveau_device *);
85 
86 #endif
87