nv50: fix typo: s/_/./
[mesa.git] / src / gallium / drivers / nv50 / nv50_resource.h
1
2 #ifndef NV50_RESOURCE_H
3 #define NV50_RESOURCE_H
4
5 #include "util/u_transfer.h"
6
7 #include "nouveau/nouveau_winsys.h"
8
9 struct pipe_resource;
10 struct nouveau_bo;
11
12
13 /* This gets further specialized into either buffer or texture
14 * structures. In the future we'll want to remove much of that
15 * distinction, but for now try to keep as close to the existing code
16 * as possible and use the vtbl struct to choose between the two
17 * underlying implementations.
18 */
19 struct nv50_resource {
20 struct pipe_resource base;
21 const struct u_resource_vtbl *vtbl;
22 struct nouveau_bo *bo;
23 };
24
25 struct nv50_miptree_level {
26 int *image_offset;
27 unsigned pitch;
28 unsigned tile_mode;
29 };
30
31 #define NV50_MAX_TEXTURE_LEVELS 16
32
33 struct nv50_miptree {
34 struct nv50_resource base;
35
36 struct nv50_miptree_level level[NV50_MAX_TEXTURE_LEVELS];
37 int image_nr;
38 int total_size;
39 };
40
41 static INLINE struct nv50_miptree *
42 nv50_miptree(struct pipe_resource *pt)
43 {
44 return (struct nv50_miptree *)pt;
45 }
46
47
48 static INLINE
49 struct nv50_resource *nv50_resource(struct pipe_resource *resource)
50 {
51 return (struct nv50_resource *)resource;
52 }
53
54 /* is resource mapped into the GPU's address space (i.e. VRAM or GART) ? */
55 static INLINE boolean
56 nv50_resource_mapped_by_gpu(struct pipe_resource *resource)
57 {
58 return nv50_resource(resource)->bo->handle;
59 }
60
61 void
62 nv50_init_resource_functions(struct pipe_context *pcontext);
63
64 void
65 nv50_screen_init_resource_functions(struct pipe_screen *pscreen);
66
67 /* Internal functions
68 */
69 struct pipe_resource *
70 nv50_miptree_create(struct pipe_screen *pscreen,
71 const struct pipe_resource *tmp);
72
73 struct pipe_resource *
74 nv50_miptree_from_handle(struct pipe_screen *pscreen,
75 const struct pipe_resource *template,
76 struct winsys_handle *whandle);
77
78 struct pipe_resource *
79 nv50_buffer_create(struct pipe_screen *pscreen,
80 const struct pipe_resource *template);
81
82 struct pipe_resource *
83 nv50_user_buffer_create(struct pipe_screen *screen,
84 void *ptr,
85 unsigned bytes,
86 unsigned usage);
87
88
89 struct pipe_surface *
90 nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_resource *pt,
91 unsigned face, unsigned level, unsigned zslice,
92 unsigned flags);
93
94 void
95 nv50_miptree_surface_del(struct pipe_surface *ps);
96
97
98 #endif