Merge remote branch 'origin/7.8'
[mesa.git] / src / gallium / drivers / nouveau / nouveau_screen.h
1 #ifndef __NOUVEAU_SCREEN_H__
2 #define __NOUVEAU_SCREEN_H__
3
4 struct nouveau_screen {
5 struct pipe_screen base;
6 struct nouveau_device *device;
7 struct nouveau_channel *channel;
8
9 /**
10 * Create a new texture object, using the given template info, but on top of
11 * existing memory.
12 *
13 * It is assumed that the buffer data is layed out according to the expected
14 * by the hardware. NULL will be returned if any inconsistency is found.
15 */
16 struct pipe_texture * (*texture_blanket)(struct pipe_screen *,
17 const struct pipe_texture *templat,
18 const unsigned *stride,
19 struct pipe_buffer *buffer);
20
21 int (*pre_pipebuffer_map_callback) (struct pipe_screen *pscreen,
22 struct pipe_buffer *pb, unsigned usage);
23 };
24
25 static inline struct nouveau_screen *
26 nouveau_screen(struct pipe_screen *pscreen)
27 {
28 return (struct nouveau_screen *)pscreen;
29 }
30
31 static inline struct nouveau_bo *
32 nouveau_bo(struct pipe_buffer *pb)
33 {
34 return pb ? *(struct nouveau_bo **)(pb + 1) : NULL;
35 }
36
37 int nouveau_screen_init(struct nouveau_screen *, struct nouveau_device *);
38 void nouveau_screen_fini(struct nouveau_screen *);
39
40 struct nouveau_miptree {
41 struct pipe_texture base;
42 struct nouveau_bo *bo;
43 };
44
45 static inline struct nouveau_miptree *
46 nouveau_miptree(struct pipe_texture *pt)
47 {
48 return (struct nouveau_miptree *)pt;
49 }
50
51 #endif