2 #ifndef __NVC0_RESOURCE_H__
3 #define __NVC0_RESOURCE_H__
5 #include "util/u_transfer.h"
6 #include "util/u_double_list.h"
8 #include "nouveau/nouveau_winsys.h"
9 #include "nouveau/nouveau_fence.h"
10 #include "nouveau/nouveau_buffer.h"
14 nvc0_init_resource_functions(struct pipe_context
*pcontext
);
17 nvc0_screen_init_resource_functions(struct pipe_screen
*pscreen
);
19 #define NVC0_TILE_DIM_SHIFT(m, d) (((m) >> (d * 4)) & 0xf)
21 #define NVC0_TILE_PITCH(m) (64 << NVC0_TILE_DIM_SHIFT(m, 0))
22 #define NVC0_TILE_HEIGHT(m) ( 8 << NVC0_TILE_DIM_SHIFT(m, 1))
23 #define NVC0_TILE_DEPTH(m) ( 1 << NVC0_TILE_DIM_SHIFT(m, 2))
25 #define NVC0_TILE_SIZE_2D(m) (((64 * 8) << \
26 NVC0_TILE_DIM_SHIFT(m, 0)) << \
27 NVC0_TILE_DIM_SHIFT(m, 1))
29 #define NVC0_TILE_SIZE(m) (NVC0_TILE_SIZE_2D(m) << NVC0_TILE_DIM_SHIFT(m, 2))
31 struct nvc0_miptree_level
{
37 #define NVC0_MAX_TEXTURE_LEVELS 16
40 struct nv04_resource base
;
41 struct nvc0_miptree_level level
[NVC0_MAX_TEXTURE_LEVELS
];
43 uint32_t layer_stride
;
44 boolean layout_3d
; /* TRUE if layer count varies with mip level */
47 static INLINE
struct nvc0_miptree
*
48 nvc0_miptree(struct pipe_resource
*pt
)
50 return (struct nvc0_miptree
*)pt
;
53 /* Internal functions:
55 struct pipe_resource
*
56 nvc0_miptree_create(struct pipe_screen
*pscreen
,
57 const struct pipe_resource
*tmp
);
59 struct pipe_resource
*
60 nvc0_miptree_from_handle(struct pipe_screen
*pscreen
,
61 const struct pipe_resource
*template,
62 struct winsys_handle
*whandle
);
65 nvc0_miptree_surface_new(struct pipe_context
*,
66 struct pipe_resource
*,
67 const struct pipe_surface
*templ
);
70 nvc0_miptree_surface_del(struct pipe_context
*, struct pipe_surface
*);
73 nvc0_miptree_zslice_offset(struct nvc0_miptree
*, unsigned l
, unsigned z
);