1
2#ifndef __NVC0_RESOURCE_H__
3#define __NVC0_RESOURCE_H__
4
5#include "nv50/nv50_resource.h"
6
7#define NVC0_RESOURCE_FLAG_VIDEO (NOUVEAU_RESOURCE_FLAG_DRV_PRIV << 0)
8
9#define NVC0_TILE_MODE_X(m) (((m) >> 0) & 0xf)
10#define NVC0_TILE_MODE_Y(m) (((m) >> 4) & 0xf)
11#define NVC0_TILE_MODE_Z(m) (((m) >> 8) & 0xf)
12
13#define NVC0_TILE_SHIFT_X(m) (NVC0_TILE_MODE_X(m) + 6)
14#define NVC0_TILE_SHIFT_Y(m) (NVC0_TILE_MODE_Y(m) + 3)
15#define NVC0_TILE_SHIFT_Z(m) (NVC0_TILE_MODE_Z(m) + 0)
16
17#define NVC0_TILE_SIZE_X(m) (64 << NVC0_TILE_MODE_X(m))
18#define NVC0_TILE_SIZE_Y(m) ( 8 << NVC0_TILE_MODE_Y(m))
19#define NVC0_TILE_SIZE_Z(m) ( 1 << NVC0_TILE_MODE_Z(m))
20
21/* it's ok to mask only in the end because max value is 3 * 5 */
22
23#define NVC0_TILE_SIZE_2D(m) ((64 * 8) << (((m) + ((m) >> 4)) & 0xf))
24
25#define NVC0_TILE_SIZE(m) ((64 * 8) << (((m) + ((m) >> 4) + ((m) >> 8)) & 0xf))
26
27
28void
29nvc0_init_resource_functions(struct pipe_context *pcontext);
30
31void
32nvc0_screen_init_resource_functions(struct pipe_screen *pscreen);
33
34/* Internal functions:
35 */
36struct pipe_resource *
37nvc0_miptree_create(struct pipe_screen *pscreen,
38                    const struct pipe_resource *tmp,
39                    const uint64_t *modifiers, unsigned int count);
40
41const struct u_resource_vtbl nvc0_miptree_vtbl;
42
43struct pipe_surface *
44nvc0_miptree_surface_new(struct pipe_context *,
45                         struct pipe_resource *,
46                         const struct pipe_surface *templ);
47
48unsigned
49nvc0_mt_zslice_offset(const struct nv50_miptree *, unsigned l, unsigned z);
50
51void *
52nvc0_miptree_transfer_map(struct pipe_context *pctx,
53                          struct pipe_resource *res,
54                          unsigned level,
55                          unsigned usage,
56                          const struct pipe_box *box,
57                          struct pipe_transfer **ptransfer);
58void
59nvc0_miptree_transfer_unmap(struct pipe_context *pcontext,
60                            struct pipe_transfer *ptx);
61
62#endif
63