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