summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/nouveau/nouveau_winsys.h
blob: a274e23af5f20af1c0f3ffeac2050ffa0f4402ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef NOUVEAU_WINSYS_H
#define NOUVEAU_WINSYS_H

#include <stdint.h>
#include "pipe/p_winsys.h"
#include "pipe/p_defines.h"

#include "pipe/nouveau/nouveau_bo.h"
#include "pipe/nouveau/nouveau_channel.h"
#include "pipe/nouveau/nouveau_class.h"
#include "pipe/nouveau/nouveau_grobj.h"
#include "pipe/nouveau/nouveau_notifier.h"

struct nouveau_resource {
	struct nouveau_resource *prev;
	struct nouveau_resource *next;

	boolean in_use;
	void *priv;

	uint start;
	uint size;
};

struct nouveau_winsys {
	struct nouveau_context *nv;

	struct nouveau_channel *channel;

	int  (*res_init)(struct nouveau_resource **heap, int size);
	int  (*res_alloc)(struct nouveau_resource *heap, int size, void *priv,
			  struct nouveau_resource **);
	void (*res_free)(struct nouveau_resource **);

	/*XXX: this is crappy, and bound to be slow.. however, it's nice and
	 *     simple, it'll do for the moment*/
	uint32_t *(*begin_ring)(struct nouveau_grobj *, int mthd, int size);
	void      (*out_reloc)(struct nouveau_channel *, void *ptr,
			       struct nouveau_bo *, uint32_t data,
			       uint32_t flags, uint32_t vor, uint32_t tor);
	void      (*fire_ring)(struct nouveau_channel *);
			       
	int       (*grobj_alloc)(struct nouveau_winsys *, int grclass,
				 struct nouveau_grobj **);
	void      (*grobj_free)(struct nouveau_grobj **);

	int       (*notifier_alloc)(struct nouveau_winsys *, int count,
				    struct nouveau_notifier **);
	void      (*notifier_free)(struct nouveau_notifier **);
	void      (*notifier_reset)(struct nouveau_notifier *, int id);
	uint32_t  (*notifier_status)(struct nouveau_notifier *, int id);
	uint32_t  (*notifier_retval)(struct nouveau_notifier *, int id);
	int       (*notifier_wait)(struct nouveau_notifier *, int id,
				   int status, int timeout);

	int (*surface_copy)(struct nouveau_winsys *, struct pipe_surface *,
			    unsigned, unsigned, struct pipe_surface *,
			    unsigned, unsigned, unsigned, unsigned);
	int (*surface_fill)(struct nouveau_winsys *, struct pipe_surface *,
			    unsigned, unsigned, unsigned, unsigned, unsigned);
	int (*surface_data)(struct nouveau_winsys *, struct pipe_surface *,
			    unsigned, unsigned, const void *, unsigned,
			    unsigned, unsigned, unsigned, unsigned);
};

extern struct pipe_context *
nv40_create(struct pipe_winsys *, struct nouveau_winsys *, unsigned chipset);

extern struct pipe_context *
nv50_create(struct pipe_winsys *, struct nouveau_winsys *, unsigned chipset);

#endif