2 #ifndef __NV50_RESOURCE_H__
3 #define __NV50_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_buffer.h"
11 #ifndef __NVC0_RESOURCE_H__ /* make sure we don't use these in nvc0: */
14 nv50_init_resource_functions(struct pipe_context
*pcontext
);
17 nv50_screen_init_resource_functions(struct pipe_screen
*pscreen
);
20 #define NV50_TILE_SHIFT_X(m) 6
21 #define NV50_TILE_SHIFT_Y(m) ((((m) >> 4) & 0xf) + 2)
22 #define NV50_TILE_SHIFT_Z(m) ((((m) >> 8) & 0xf) + 0)
24 #define NV50_TILE_SIZE_X(m) 64
25 #define NV50_TILE_SIZE_Y(m) ( 4 << (((m) >> 4) & 0xf))
26 #define NV50_TILE_SIZE_Z(m) ( 1 << (((m) >> 8) & 0xf))
28 #define NV50_TILE_SIZE_2D(m) (NV50_TILE_SIZE_X(m) << NV50_TILE_SHIFT_Y(m))
30 #define NV50_TILE_SIZE(m) (NV50_TILE_SIZE_2D(m) << NV50_TILE_SHIFT_Z(m))
32 #endif /* __NVC0_RESOURCE_H__ */
35 nvc0_tex_choose_tile_dims(unsigned nx
, unsigned ny
, unsigned nz
);
38 struct nv50_miptree_level
{
44 #define NV50_MAX_TEXTURE_LEVELS 16
47 struct nv04_resource base
;
48 struct nv50_miptree_level level
[NV50_MAX_TEXTURE_LEVELS
];
50 uint32_t layer_stride
;
51 boolean layout_3d
; /* TRUE if layer count varies with mip level */
52 uint8_t ms_x
; /* log2 of number of samples in x/y dimension */
57 static INLINE
struct nv50_miptree
*
58 nv50_miptree(struct pipe_resource
*pt
)
60 return (struct nv50_miptree
*)pt
;
63 /* Internal functions:
66 nv50_miptree_init_layout_linear(struct nv50_miptree
*mt
);
68 struct pipe_resource
*
69 nv50_miptree_create(struct pipe_screen
*pscreen
,
70 const struct pipe_resource
*tmp
);
73 nv50_miptree_destroy(struct pipe_screen
*pscreen
, struct pipe_resource
*pt
);
75 struct pipe_resource
*
76 nv50_miptree_from_handle(struct pipe_screen
*pscreen
,
77 const struct pipe_resource
*template,
78 struct winsys_handle
*whandle
);
81 nv50_miptree_get_handle(struct pipe_screen
*pscreen
,
82 struct pipe_resource
*pt
,
83 struct winsys_handle
*whandle
);
86 struct pipe_surface base
;
93 static INLINE
struct nv50_surface
*
94 nv50_surface(struct pipe_surface
*ps
)
96 return (struct nv50_surface
*)ps
;
99 #ifndef __NVC0_RESOURCE_H__
102 nv50_mt_zslice_offset(const struct nv50_miptree
*mt
, unsigned l
, unsigned z
);
104 struct pipe_surface
*
105 nv50_miptree_surface_new(struct pipe_context
*,
106 struct pipe_resource
*,
107 const struct pipe_surface
*templ
);
109 struct pipe_transfer
*
110 nv50_miptree_transfer_new(struct pipe_context
*pcontext
,
111 struct pipe_resource
*pt
,
114 const struct pipe_box
*box
);
116 nv50_miptree_transfer_del(struct pipe_context
*pcontext
,
117 struct pipe_transfer
*ptx
);
119 nv50_miptree_transfer_map(struct pipe_context
*pcontext
,
120 struct pipe_transfer
*ptx
);
122 nv50_miptree_transfer_unmap(struct pipe_context
*pcontext
,
123 struct pipe_transfer
*ptx
);
125 #endif /* __NVC0_RESOURCE_H__ */
127 struct nv50_surface
*
128 nv50_surface_from_miptree(struct nv50_miptree
*mt
,
129 const struct pipe_surface
*templ
);
131 struct pipe_surface
*
132 nv50_surface_from_buffer(struct pipe_context
*pipe
,
133 struct pipe_resource
*pt
,
134 const struct pipe_surface
*templ
);
137 nv50_surface_destroy(struct pipe_context
*, struct pipe_surface
*);
139 #endif /* __NV50_RESOURCE_H__ */