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 28static inline uint32_t 29nvc0_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 37void 38nvc0_init_resource_functions(struct pipe_context *pcontext); 39 40void 41nvc0_screen_init_resource_functions(struct pipe_screen *pscreen); 42 43/* Internal functions: 44 */ 45uint32_t 46nvc0_choose_tiled_storage_type(struct pipe_screen *pscreen, 47 enum pipe_format format, 48 unsigned ms, 49 bool compressed); 50 51struct pipe_resource * 52nvc0_miptree_create(struct pipe_screen *pscreen, 53 const struct pipe_resource *tmp, 54 const uint64_t *modifiers, unsigned int count); 55 56bool 57nvc0_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 63struct pipe_surface * 64nvc0_miptree_surface_new(struct pipe_context *, 65 struct pipe_resource *, 66 const struct pipe_surface *templ); 67 68unsigned 69nvc0_mt_zslice_offset(const struct nv50_miptree *, unsigned l, unsigned z); 70 71void * 72nvc0_miptree_transfer_map(struct pipe_context *pctx, 73 struct pipe_resource *res, 74 unsigned level, 75 unsigned usage, 76 const struct pipe_box *box, 77 struct pipe_transfer **ptransfer); 78void 79nvc0_miptree_transfer_unmap(struct pipe_context *pcontext, 80 struct pipe_transfer *ptx); 81 82#endif 83