1 #ifndef __NOUVEAU_SCREEN_H__
2 #define __NOUVEAU_SCREEN_H__
4 #include "pipe/p_screen.h"
5 #include "util/u_memory.h"
10 struct nouveau_screen
{
11 struct pipe_screen base
;
12 struct nouveau_device
*device
;
13 struct nouveau_channel
*channel
;
15 /* note that OpenGL doesn't distinguish between these, so
16 * these almost always should be set to the same value */
17 unsigned vertex_buffer_flags
;
18 unsigned index_buffer_flags
;
19 unsigned sysmem_bindings
;
22 struct nouveau_fence
*head
;
23 struct nouveau_fence
*tail
;
24 struct nouveau_fence
*current
;
27 void (*emit
)(struct pipe_screen
*, u32 sequence
);
28 u32 (*update
)(struct pipe_screen
*);
31 struct nouveau_mman
*mm_VRAM
;
32 struct nouveau_mman
*mm_GART
;
35 static INLINE
struct nouveau_screen
*
36 nouveau_screen(struct pipe_screen
*pscreen
)
38 return (struct nouveau_screen
*)pscreen
;
43 /* Not really sure if this is needed, or whether the individual
44 * drivers are happy to talk to the bo functions themselves. In a way
45 * this is what we'd expect from a regular winsys interface.
48 nouveau_screen_bo_new(struct pipe_screen
*pscreen
, unsigned alignment
,
49 unsigned usage
, unsigned bind
, unsigned size
);
51 nouveau_screen_bo_map(struct pipe_screen
*pscreen
,
52 struct nouveau_bo
*pb
,
55 nouveau_screen_bo_map_range(struct pipe_screen
*pscreen
, struct nouveau_bo
*bo
,
56 unsigned offset
, unsigned length
, unsigned usage
);
58 nouveau_screen_bo_map_flush_range(struct pipe_screen
*pscreen
, struct nouveau_bo
*bo
,
59 unsigned offset
, unsigned length
);
61 nouveau_screen_bo_unmap(struct pipe_screen
*pscreen
, struct nouveau_bo
*bo
);
63 nouveau_screen_bo_release(struct pipe_screen
*pscreen
, struct nouveau_bo
*bo
);
66 nouveau_screen_bo_get_handle(struct pipe_screen
*pscreen
,
67 struct nouveau_bo
*bo
,
69 struct winsys_handle
*whandle
);
71 nouveau_screen_bo_from_handle(struct pipe_screen
*pscreen
,
72 struct winsys_handle
*whandle
,
73 unsigned *out_stride
);
76 int nouveau_screen_init(struct nouveau_screen
*, struct nouveau_device
*);
77 void nouveau_screen_fini(struct nouveau_screen
*);
82 static INLINE
unsigned
83 RING_3D(unsigned mthd
, unsigned size
)
85 return (7 << 13) | (size
<< 18) | mthd
;
88 static INLINE
unsigned
89 RING_3D_NI(unsigned mthd
, unsigned size
)
91 return 0x40000000 | (7 << 13) | (size
<< 18) | mthd
;