50cc2afdbe138dbae14e32fab28b928ceb07e85f
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"
12 #ifndef __NVC0_RESOURCE_H__ /* make sure we don't use these in nvc0: */
15 nv50_init_resource_functions(struct pipe_context
*pcontext
);
18 nv50_screen_init_resource_functions(struct pipe_screen
*pscreen
);
21 #define NV50_TILE_SHIFT_X(m) 6
22 #define NV50_TILE_SHIFT_Y(m) ((((m) >> 0) & 0xf) + 2)
23 #define NV50_TILE_SHIFT_Z(m) ((((m) >> 4) & 0xf) + 0)
25 #define NV50_TILE_SIZE_X(m) 64
26 #define NV50_TILE_SIZE_Y(m) ( 4 << (((m) >> 0) & 0xf))
27 #define NV50_TILE_SIZE_Z(m) ( 1 << (((m) >> 4) & 0xf))
29 #define NV50_TILE_SIZE_2D(m) (NV50_TILE_SIZE_X(m) << NV50_TILE_SHIFT_Y(m))
31 #define NV50_TILE_SIZE(m) (NV50_TILE_SIZE_2D(m) << NV50_TILE_SHIFT_Z(m))
33 #endif /* __NVC0_RESOURCE_H__ */
36 nvc0_tex_choose_tile_dims(unsigned nx
, unsigned ny
, unsigned nz
);
39 struct nv50_miptree_level
{
45 #define NV50_MAX_TEXTURE_LEVELS 16
48 struct nv04_resource base
;
49 struct nv50_miptree_level level
[NV50_MAX_TEXTURE_LEVELS
];
51 uint32_t layer_stride
;
52 boolean layout_3d
; /* TRUE if layer count varies with mip level */
53 uint8_t ms_x
; /* log2 of number of samples in x/y dimension */
58 static INLINE
struct nv50_miptree
*
59 nv50_miptree(struct pipe_resource
*pt
)
61 return (struct nv50_miptree
*)pt
;
64 /* Internal functions:
67 nv50_miptree_init_layout_linear(struct nv50_miptree
*mt
);
69 struct pipe_resource
*
70 nv50_miptree_create(struct pipe_screen
*pscreen
,
71 const struct pipe_resource
*tmp
);
74 nv50_miptree_destroy(struct pipe_screen
*pscreen
, struct pipe_resource
*pt
);
76 struct pipe_resource
*
77 nv50_miptree_from_handle(struct pipe_screen
*pscreen
,
78 const struct pipe_resource
*template,
79 struct winsys_handle
*whandle
);
82 nv50_miptree_get_handle(struct pipe_screen
*pscreen
,
83 struct pipe_resource
*pt
,
84 struct winsys_handle
*whandle
);
87 struct pipe_surface base
;
94 static INLINE
struct nv50_surface
*
95 nv50_surface(struct pipe_surface
*ps
)
97 return (struct nv50_surface
*)ps
;
100 #ifndef __NVC0_RESOURCE_H__
103 nv50_mt_zslice_offset(const struct nv50_miptree
*mt
, unsigned l
, unsigned z
);
105 struct pipe_surface
*
106 nv50_miptree_surface_new(struct pipe_context
*,
107 struct pipe_resource
*,
108 const struct pipe_surface
*templ
);
110 struct pipe_transfer
*
111 nv50_miptree_transfer_new(struct pipe_context
*pcontext
,
112 struct pipe_resource
*pt
,
115 const struct pipe_box
*box
);
117 nv50_miptree_transfer_del(struct pipe_context
*pcontext
,
118 struct pipe_transfer
*ptx
);
120 nv50_miptree_transfer_map(struct pipe_context
*pcontext
,
121 struct pipe_transfer
*ptx
);
123 nv50_miptree_transfer_unmap(struct pipe_context
*pcontext
,
124 struct pipe_transfer
*ptx
);
126 #endif /* __NVC0_RESOURCE_H__ */
128 struct nv50_surface
*
129 nv50_surface_from_miptree(struct nv50_miptree
*mt
,
130 const struct pipe_surface
*templ
);
132 struct pipe_surface
*
133 nv50_surface_from_buffer(struct pipe_context
*pipe
,
134 struct pipe_resource
*pt
,
135 const struct pipe_surface
*templ
);
138 nv50_surface_destroy(struct pipe_context
*, struct pipe_surface
*);
140 #endif /* __NV50_RESOURCE_H__ */