2
2
#ifndef __NVC0_RESOURCE_H__
3
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"
5
#include "nv50/nv50_resource.h"
7
#define NVC0_RESOURCE_FLAG_VIDEO (NOUVEAU_RESOURCE_FLAG_DRV_PRIV << 0)
10
#define NVC0_TILE_SHIFT_X(m) ((((m) >> 0) & 0xf) + 6)
11
#define NVC0_TILE_SHIFT_Y(m) ((((m) >> 4) & 0xf) + 3)
12
#define NVC0_TILE_SHIFT_Z(m) ((((m) >> 8) & 0xf) + 0)
14
#define NVC0_TILE_SIZE_X(m) (64 << (((m) >> 0) & 0xf))
15
#define NVC0_TILE_SIZE_Y(m) ( 8 << (((m) >> 4) & 0xf))
16
#define NVC0_TILE_SIZE_Z(m) ( 1 << (((m) >> 8) & 0xf))
18
/* it's ok to mask only in the end because max value is 3 * 5 */
20
#define NVC0_TILE_SIZE_2D(m) ((64 * 8) << (((m) + ((m) >> 4)) & 0xf))
22
#define NVC0_TILE_SIZE(m) ((64 * 8) << (((m) + ((m) >> 4) + ((m) >> 8)) & 0xf))
14
26
nvc0_init_resource_functions(struct pipe_context *pcontext);
17
29
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
31
/* Internal functions:
55
33
struct pipe_resource *
56
34
nvc0_miptree_create(struct pipe_screen *pscreen,
57
35
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);
37
const struct u_resource_vtbl nvc0_miptree_vtbl;
64
39
struct pipe_surface *
65
40
nvc0_miptree_surface_new(struct pipe_context *,
66
41
struct pipe_resource *,
67
42
const struct pipe_surface *templ);
70
nvc0_miptree_surface_del(struct pipe_context *, struct pipe_surface *);
45
nvc0_mt_zslice_offset(const struct nv50_miptree *, unsigned l, unsigned z);
73
nvc0_miptree_zslice_offset(struct nvc0_miptree *, unsigned l, unsigned z);
47
struct pipe_transfer *
48
nvc0_miptree_transfer_new(struct pipe_context *pcontext,
49
struct pipe_resource *pt,
52
const struct pipe_box *box);
54
nvc0_miptree_transfer_del(struct pipe_context *pcontext,
55
struct pipe_transfer *ptx);
57
nvc0_miptree_transfer_map(struct pipe_context *pcontext,
58
struct pipe_transfer *ptx);
60
nvc0_miptree_transfer_unmap(struct pipe_context *pcontext,
61
struct pipe_transfer *ptx);