762c3a2a218e9b5c3ba9074d77f58a60cf29c968
[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 #define NOUVEAU_BUFFER_USAGE_TRANSFER (1 << 18)
25
26 struct nouveau_winsys {
27 struct pipe_winsys *ws;
28
29 struct nouveau_channel *channel;
30
31 int (*res_init)(struct nouveau_resource **heap, unsigned start,
32 unsigned size);
33 int (*res_alloc)(struct nouveau_resource *heap, int size, void *priv,
34 struct nouveau_resource **);
35 void (*res_free)(struct nouveau_resource **);
36
37 int (*grobj_alloc)(struct nouveau_winsys *, int grclass,
38 struct nouveau_grobj **);
39 void (*grobj_free)(struct nouveau_grobj **);
40
41 int (*notifier_alloc)(struct nouveau_winsys *, int count,
42 struct nouveau_notifier **);
43 void (*notifier_free)(struct nouveau_notifier **);
44 void (*notifier_reset)(struct nouveau_notifier *, int id);
45 uint32_t (*notifier_status)(struct nouveau_notifier *, int id);
46 uint32_t (*notifier_retval)(struct nouveau_notifier *, int id);
47 int (*notifier_wait)(struct nouveau_notifier *, int id,
48 int status, double timeout);
49
50 int (*surface_copy)(struct nouveau_winsys *, struct pipe_surface *,
51 unsigned, unsigned, struct pipe_surface *,
52 unsigned, unsigned, unsigned, unsigned);
53 int (*surface_fill)(struct nouveau_winsys *, struct pipe_surface *,
54 unsigned, unsigned, unsigned, unsigned, unsigned);
55
56 struct nouveau_bo *(*get_bo)(struct pipe_buffer *);
57 };
58
59 extern struct pipe_screen *
60 nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
61
62 extern struct pipe_context *
63 nv04_create(struct pipe_screen *, unsigned pctx_id);
64
65 extern struct pipe_screen *
66 nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
67
68 extern struct pipe_context *
69 nv10_create(struct pipe_screen *, unsigned pctx_id);
70
71 extern struct pipe_screen *
72 nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
73
74 extern struct pipe_context *
75 nv20_create(struct pipe_screen *, unsigned pctx_id);
76
77 extern struct pipe_screen *
78 nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
79
80 extern struct pipe_context *
81 nv30_create(struct pipe_screen *, unsigned pctx_id);
82
83 extern struct pipe_screen *
84 nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
85
86 extern struct pipe_context *
87 nv40_create(struct pipe_screen *, unsigned pctx_id);
88
89 extern struct pipe_screen *
90 nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
91
92 extern struct pipe_context *
93 nv50_create(struct pipe_screen *, unsigned pctx_id);
94
95 #endif