i915g: actually try to clear 16bit depth bufs
[mesa.git] / src / gallium / drivers / nouveau / nouveau_screen.h
1 #ifndef __NOUVEAU_SCREEN_H__
2 #define __NOUVEAU_SCREEN_H__
3
4 #include "pipe/p_screen.h"
5 #include "util/u_memory.h"
6 typedef uint32_t u32;
7
8 struct nouveau_bo;
9
10 struct nouveau_screen {
11 struct pipe_screen base;
12 struct nouveau_device *device;
13 struct nouveau_channel *channel;
14
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;
20
21 struct {
22 struct nouveau_fence *head;
23 struct nouveau_fence *tail;
24 struct nouveau_fence *current;
25 u32 sequence;
26 u32 sequence_ack;
27 void (*emit)(struct pipe_screen *, u32 sequence);
28 u32 (*update)(struct pipe_screen *);
29 } fence;
30
31 struct nouveau_mman *mm_VRAM;
32 struct nouveau_mman *mm_GART;
33 };
34
35 static INLINE struct nouveau_screen *
36 nouveau_screen(struct pipe_screen *pscreen)
37 {
38 return (struct nouveau_screen *)pscreen;
39 }
40
41
42
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.
46 */
47 struct nouveau_bo *
48 nouveau_screen_bo_new(struct pipe_screen *pscreen, unsigned alignment,
49 unsigned usage, unsigned bind, unsigned size);
50 void *
51 nouveau_screen_bo_map(struct pipe_screen *pscreen,
52 struct nouveau_bo *pb,
53 unsigned usage);
54 void *
55 nouveau_screen_bo_map_range(struct pipe_screen *pscreen, struct nouveau_bo *bo,
56 unsigned offset, unsigned length, unsigned usage);
57 void
58 nouveau_screen_bo_map_flush_range(struct pipe_screen *pscreen, struct nouveau_bo *bo,
59 unsigned offset, unsigned length);
60 void
61 nouveau_screen_bo_unmap(struct pipe_screen *pscreen, struct nouveau_bo *bo);
62 void
63 nouveau_screen_bo_release(struct pipe_screen *pscreen, struct nouveau_bo *bo);
64
65 boolean
66 nouveau_screen_bo_get_handle(struct pipe_screen *pscreen,
67 struct nouveau_bo *bo,
68 unsigned stride,
69 struct winsys_handle *whandle);
70 struct nouveau_bo *
71 nouveau_screen_bo_from_handle(struct pipe_screen *pscreen,
72 struct winsys_handle *whandle,
73 unsigned *out_stride);
74
75
76 int nouveau_screen_init(struct nouveau_screen *, struct nouveau_device *);
77 void nouveau_screen_fini(struct nouveau_screen *);
78
79 void nouveau_screen_init_vdec(struct nouveau_screen *);
80
81
82 #ifndef NOUVEAU_NVC0
83 static INLINE unsigned
84 RING_3D(unsigned mthd, unsigned size)
85 {
86 return (7 << 13) | (size << 18) | mthd;
87 }
88
89 static INLINE unsigned
90 RING_3D_NI(unsigned mthd, unsigned size)
91 {
92 return 0x40000000 | (7 << 13) | (size << 18) | mthd;
93 }
94 #endif
95
96 #endif