Merge commit 'origin/gallium-master-merge'
[mesa.git] / src / gallium / drivers / nouveau / nouveau_winsys.h
1 #ifndef NOUVEAU_WINSYS_H
2 #define NOUVEAU_WINSYS_H
3
4 #include <stdint.h>
5 #include "pipe/internal/p_winsys_screen.h"
6 #include "pipe/p_defines.h"
7
8 #include "nouveau/nouveau_bo.h"
9 #include "nouveau/nouveau_channel.h"
10 #include "nouveau/nouveau_class.h"
11 #include "nouveau/nouveau_device.h"
12 #include "nouveau/nouveau_grobj.h"
13 #include "nouveau/nouveau_notifier.h"
14 #include "nouveau/nouveau_resource.h"
15 #include "nouveau/nouveau_pushbuf.h"
16
17 #define NOUVEAU_CAP_HW_VTXBUF (0xbeef0000)
18 #define NOUVEAU_CAP_HW_IDXBUF (0xbeef0001)
19
20 #define NOUVEAU_TEXTURE_USAGE_LINEAR (1 << 16)
21
22 #define NOUVEAU_BUFFER_USAGE_TEXTURE (1 << 16)
23 #define NOUVEAU_BUFFER_USAGE_ZETA (1 << 17)
24
25 struct nouveau_winsys {
26 struct nouveau_context *nv;
27
28 struct nouveau_channel *channel;
29
30 int (*res_init)(struct nouveau_resource **heap, unsigned start,
31 unsigned size);
32 int (*res_alloc)(struct nouveau_resource *heap, int size, void *priv,
33 struct nouveau_resource **);
34 void (*res_free)(struct nouveau_resource **);
35
36 int (*push_reloc)(struct nouveau_winsys *, void *ptr,
37 struct pipe_buffer *, uint32_t data,
38 uint32_t flags, uint32_t vor, uint32_t tor);
39 int (*push_flush)(struct nouveau_winsys *, unsigned size,
40 struct pipe_fence_handle **fence);
41
42 int (*grobj_alloc)(struct nouveau_winsys *, int grclass,
43 struct nouveau_grobj **);
44 void (*grobj_free)(struct nouveau_grobj **);
45
46 int (*notifier_alloc)(struct nouveau_winsys *, int count,
47 struct nouveau_notifier **);
48 void (*notifier_free)(struct nouveau_notifier **);
49 void (*notifier_reset)(struct nouveau_notifier *, int id);
50 uint32_t (*notifier_status)(struct nouveau_notifier *, int id);
51 uint32_t (*notifier_retval)(struct nouveau_notifier *, int id);
52 int (*notifier_wait)(struct nouveau_notifier *, int id,
53 int status, double timeout);
54
55 int (*surface_copy)(struct nouveau_winsys *, struct pipe_surface *,
56 unsigned, unsigned, struct pipe_surface *,
57 unsigned, unsigned, unsigned, unsigned);
58 int (*surface_fill)(struct nouveau_winsys *, struct pipe_surface *,
59 unsigned, unsigned, unsigned, unsigned, unsigned);
60
61 struct nouveau_bo *(*get_bo)(struct pipe_buffer *);
62 };
63
64 extern struct pipe_screen *
65 nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
66
67 extern struct pipe_context *
68 nv04_create(struct pipe_screen *, unsigned pctx_id);
69
70 extern struct pipe_screen *
71 nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
72
73 extern struct pipe_context *
74 nv10_create(struct pipe_screen *, unsigned pctx_id);
75
76 extern struct pipe_screen *
77 nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
78
79 extern struct pipe_context *
80 nv20_create(struct pipe_screen *, unsigned pctx_id);
81
82 extern struct pipe_screen *
83 nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
84
85 extern struct pipe_context *
86 nv30_create(struct pipe_screen *, unsigned pctx_id);
87
88 extern struct pipe_screen *
89 nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
90
91 extern struct pipe_context *
92 nv40_create(struct pipe_screen *, unsigned pctx_id);
93
94 extern struct pipe_screen *
95 nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
96
97 extern struct pipe_context *
98 nv50_create(struct pipe_screen *, unsigned pctx_id);
99
100 #endif