Path: blob/21.2-virgl/src/gallium/drivers/nouveau/nvc0/nvc0_resource.h
4574 views
1#ifndef __NVC0_RESOURCE_H__2#define __NVC0_RESOURCE_H__34#include "nv50/nv50_resource.h"5#include "nouveau_screen.h"67#define NVC0_RESOURCE_FLAG_VIDEO (NOUVEAU_RESOURCE_FLAG_DRV_PRIV << 0)89#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)1213#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)1617#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))2021/* it's ok to mask only in the end because max value is 3 * 5 */2223#define NVC0_TILE_SIZE_2D(m) ((64 * 8) << (((m) + ((m) >> 4)) & 0xf))2425#define NVC0_TILE_SIZE(m) ((64 * 8) << (((m) + ((m) >> 4) + ((m) >> 8)) & 0xf))2627static inline uint32_t28nvc0_get_kind_generation(struct pipe_screen *pscreen)29{30if (nouveau_screen(pscreen)->device->chipset >= 0x160)31return 2;32else33return 0;34}3536void37nvc0_init_resource_functions(struct pipe_context *pcontext);3839void40nvc0_screen_init_resource_functions(struct pipe_screen *pscreen);4142/* Internal functions:43*/44uint32_t45nvc0_choose_tiled_storage_type(struct pipe_screen *pscreen,46enum pipe_format format,47unsigned ms,48bool compressed);4950struct pipe_resource *51nvc0_miptree_create(struct pipe_screen *pscreen,52const struct pipe_resource *tmp,53const uint64_t *modifiers, unsigned int count);5455bool56nvc0_miptree_get_handle(struct pipe_screen *pscreen,57struct pipe_context *context,58struct pipe_resource *pt,59struct winsys_handle *whandle,60unsigned usage);6162struct pipe_surface *63nvc0_miptree_surface_new(struct pipe_context *,64struct pipe_resource *,65const struct pipe_surface *templ);6667unsigned68nvc0_mt_zslice_offset(const struct nv50_miptree *, unsigned l, unsigned z);6970void *71nvc0_miptree_transfer_map(struct pipe_context *pctx,72struct pipe_resource *res,73unsigned level,74unsigned usage,75const struct pipe_box *box,76struct pipe_transfer **ptransfer);77void78nvc0_miptree_transfer_unmap(struct pipe_context *pcontext,79struct pipe_transfer *ptx);8081#endif828384