| 1 |
|
| 2 |
#ifndef __NVC0_RESOURCE_H__ |
| 3 |
#define __NVC0_RESOURCE_H__ |
| 4 |
|
| 5 |
#include "nv50/nv50_resource.h" |
| 6 |
#include "nouveau_screen.h" |
| 7 |
|
| 8 |
#define NVC0_RESOURCE_FLAG_VIDEO (NOUVEAU_RESOURCE_FLAG_DRV_PRIV << 0) |
| 9 |
|
| 10 |
#define NVC0_TILE_MODE_X(m) (((m) >> 0) & 0xf) |
| 11 |
#define NVC0_TILE_MODE_Y(m) (((m) >> 4) & 0xf) |
| 12 |
#define NVC0_TILE_MODE_Z(m) (((m) >> 8) & 0xf) |
| 13 |
|
| 14 |
#define NVC0_TILE_SHIFT_X(m) (NVC0_TILE_MODE_X(m) + 6) |
| 15 |
#define NVC0_TILE_SHIFT_Y(m) (NVC0_TILE_MODE_Y(m) + 3) |
| 16 |
#define NVC0_TILE_SHIFT_Z(m) (NVC0_TILE_MODE_Z(m) + 0) |
| 17 |
|
| 18 |
#define NVC0_TILE_SIZE_X(m) (64 << NVC0_TILE_MODE_X(m)) |
| 19 |
#define NVC0_TILE_SIZE_Y(m) ( 8 << NVC0_TILE_MODE_Y(m)) |
| 20 |
#define NVC0_TILE_SIZE_Z(m) ( 1 << NVC0_TILE_MODE_Z(m)) |
| 21 |
|
| 22 |
/* it's ok to mask only in the end because max value is 3 * 5 */ |
| 23 |
|
| 24 |
#define NVC0_TILE_SIZE_2D(m) ((64 * 8) << (((m) + ((m) >> 4)) & 0xf)) |
| 25 |
|
| 26 |
#define NVC0_TILE_SIZE(m) ((64 * 8) << (((m) + ((m) >> 4) + ((m) >> 8)) & 0xf)) |
| 27 |
|
| 28 |
static inline uint32_t |
| 29 |
nvc0_get_kind_generation(struct pipe_screen *pscreen) |
| 30 |
{ |
| 31 |
if (nouveau_screen(pscreen)->device->chipset >= 0x160) |
| 32 |
return 2; |
| 33 |
else |
| 34 |
return 0; |
| 35 |
} |
| 36 |
|
| 37 |
void |
| 38 |
nvc0_init_resource_functions(struct pipe_context *pcontext); |
| 39 |
|
| 40 |
void |
| 41 |
nvc0_screen_init_resource_functions(struct pipe_screen *pscreen); |
| 42 |
|
| 43 |
/* Internal functions: |
| 44 |
*/ |
| 45 |
uint32_t |
| 46 |
nvc0_choose_tiled_storage_type(struct pipe_screen *pscreen, |
| 47 |
enum pipe_format format, |
| 48 |
unsigned ms, |
| 49 |
bool compressed); |
| 50 |
|
| 51 |
struct pipe_resource * |
| 52 |
nvc0_miptree_create(struct pipe_screen *pscreen, |
| 53 |
const struct pipe_resource *tmp, |
| 54 |
const uint64_t *modifiers, unsigned int count); |
| 55 |
|
| 56 |
bool |
| 57 |
nvc0_miptree_get_handle(struct pipe_screen *pscreen, |
| 58 |
struct pipe_context *context, |
| 59 |
struct pipe_resource *pt, |
| 60 |
struct winsys_handle *whandle, |
| 61 |
unsigned usage); |
| 62 |
|
| 63 |
struct pipe_surface * |
| 64 |
nvc0_miptree_surface_new(struct pipe_context *, |
| 65 |
struct pipe_resource *, |
| 66 |
const struct pipe_surface *templ); |
| 67 |
|
| 68 |
void |
| 69 |
nvc0_framebuffer_init(struct pipe_context *pctx, |
| 70 |
const struct pipe_framebuffer_state *fb, |
| 71 |
struct pipe_surface **cbufs, |
| 72 |
struct pipe_surface **zsbuf); |
| 73 |
|
| 74 |
unsigned |
| 75 |
nvc0_mt_zslice_offset(const struct nv50_miptree *, unsigned l, unsigned z); |
| 76 |
|
| 77 |
void * |
| 78 |
nvc0_miptree_transfer_map(struct pipe_context *pctx, |
| 79 |
struct pipe_resource *res, |
| 80 |
unsigned level, |
| 81 |
unsigned usage, |
| 82 |
const struct pipe_box *box, |
| 83 |
struct pipe_transfer **ptransfer); |
| 84 |
void |
| 85 |
nvc0_miptree_transfer_unmap(struct pipe_context *pcontext, |
| 86 |
struct pipe_transfer *ptx); |
| 87 |
|
| 88 |
#endif |