Tizen 2.0 Release
[profile/ivi/osmesa.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 #include "util/u_double_list.h"
7 #define NOUVEAU_NVC0
8 #include "nouveau/nouveau_winsys.h"
9 #include "nouveau/nouveau_buffer.h"
10 #undef NOUVEAU_NVC0
11
12 void
13 nv50_init_resource_functions(struct pipe_context *pcontext);
14
15 void
16 nv50_screen_init_resource_functions(struct pipe_screen *pscreen);
17
18 #define NV50_TILE_DIM_SHIFT(m, d) (((m) >> (d * 4)) & 0xf)
19
20 #define NV50_TILE_PITCH(m)  (64 << 0)
21 #define NV50_TILE_HEIGHT(m) ( 4 << NV50_TILE_DIM_SHIFT(m, 0))
22 #define NV50_TILE_DEPTH(m)  ( 1 << NV50_TILE_DIM_SHIFT(m, 1))
23
24 #define NV50_TILE_SIZE_2D(m) ((64 * 4) <<                     \
25                               NV50_TILE_DIM_SHIFT(m, 0))
26
27 #define NV50_TILE_SIZE(m) (NV50_TILE_SIZE_2D(m) << NV50_TILE_DIM_SHIFT(m, 1))
28
29 struct nv50_miptree_level {
30    uint32_t offset;
31    uint32_t pitch;
32    uint32_t tile_mode;
33 };
34
35 #define NV50_MAX_TEXTURE_LEVELS 16
36
37 struct nv50_miptree {
38    struct nv04_resource base;
39    struct nv50_miptree_level level[NV50_MAX_TEXTURE_LEVELS];
40    uint32_t total_size;
41    uint32_t layer_stride;
42    boolean layout_3d; /* TRUE if layer count varies with mip level */
43 };
44
45 static INLINE struct nv50_miptree *
46 nv50_miptree(struct pipe_resource *pt)
47 {
48    return (struct nv50_miptree *)pt;
49 }
50
51 /* Internal functions:
52  */
53 struct pipe_resource *
54 nv50_miptree_create(struct pipe_screen *pscreen,
55                     const struct pipe_resource *tmp);
56
57 struct pipe_resource *
58 nv50_miptree_from_handle(struct pipe_screen *pscreen,
59                          const struct pipe_resource *template,
60                          struct winsys_handle *whandle);
61
62 struct pipe_surface *
63 nv50_miptree_surface_new(struct pipe_context *,
64                          struct pipe_resource *,
65                          const struct pipe_surface *templ);
66
67 void
68 nv50_miptree_surface_del(struct pipe_context *, struct pipe_surface *);
69
70 #endif