nouveau_winsys.h revision fbb6cc7842ec8a59b60018233275babc4deb6765
1#ifndef NOUVEAU_WINSYS_H
2#define NOUVEAU_WINSYS_H
3
4#include <stdint.h>
5#include "pipe/p_winsys.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_grobj.h"
12#include "nouveau/nouveau_notifier.h"
13#include "nouveau/nouveau_resource.h"
14#include "nouveau/nouveau_pushbuf.h"
15
16#define NOUVEAU_CAP_HW_VTXBUF (0xbeef0000)
17#define NOUVEAU_CAP_HW_IDXBUF (0xbeef0001)
18
19#define NOUVEAU_BUFFER_USAGE_TEXTURE (1 << 16)
20
21struct nouveau_winsys {
22	struct nouveau_context *nv;
23
24	struct nouveau_channel *channel;
25
26	int  (*res_init)(struct nouveau_resource **heap, unsigned start,
27			 unsigned size);
28	int  (*res_alloc)(struct nouveau_resource *heap, int size, void *priv,
29			  struct nouveau_resource **);
30	void (*res_free)(struct nouveau_resource **);
31
32	int  (*push_reloc)(struct nouveau_winsys *, void *ptr,
33			   struct pipe_buffer *, uint32_t data,
34			   uint32_t flags, uint32_t vor, uint32_t tor);
35	int  (*push_flush)(struct nouveau_winsys *, unsigned size,
36			   struct pipe_fence_handle **fence);
37
38	int       (*grobj_alloc)(struct nouveau_winsys *, int grclass,
39				 struct nouveau_grobj **);
40	void      (*grobj_free)(struct nouveau_grobj **);
41
42	int       (*notifier_alloc)(struct nouveau_winsys *, int count,
43				    struct nouveau_notifier **);
44	void      (*notifier_free)(struct nouveau_notifier **);
45	void      (*notifier_reset)(struct nouveau_notifier *, int id);
46	uint32_t  (*notifier_status)(struct nouveau_notifier *, int id);
47	uint32_t  (*notifier_retval)(struct nouveau_notifier *, int id);
48	int       (*notifier_wait)(struct nouveau_notifier *, int id,
49				   int status, int timeout);
50
51	int (*surface_copy)(struct nouveau_winsys *, struct pipe_surface *,
52			    unsigned, unsigned, struct pipe_surface *,
53			    unsigned, unsigned, unsigned, unsigned);
54	int (*surface_fill)(struct nouveau_winsys *, struct pipe_surface *,
55			    unsigned, unsigned, unsigned, unsigned, unsigned);
56};
57
58extern struct pipe_screen *
59nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *,
60		   unsigned chipset);
61
62extern struct pipe_context *
63nv10_create(struct pipe_screen *, unsigned pctx_id);
64
65extern struct pipe_screen *
66nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *,
67		   unsigned chipset);
68
69extern struct pipe_context *
70nv30_create(struct pipe_screen *, unsigned pctx_id);
71
72extern struct pipe_screen *
73nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *,
74		   unsigned chipset);
75
76extern struct pipe_context *
77nv40_create(struct pipe_screen *, unsigned pctx_id);
78
79extern struct pipe_screen *
80nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *,
81		   unsigned chipset);
82
83extern struct pipe_context *
84nv50_create(struct pipe_screen *, unsigned pctx_id);
85
86#endif
87