diff options
Diffstat (limited to 'src/freedreno/fdl/freedreno_layout.h')
-rw-r--r-- | src/freedreno/fdl/freedreno_layout.h | 108 |
1 files changed, 103 insertions, 5 deletions
diff --git a/src/freedreno/fdl/freedreno_layout.h b/src/freedreno/fdl/freedreno_layout.h index a2c81227f7f..4b45b5d08ce 100644 --- a/src/freedreno/fdl/freedreno_layout.h +++ b/src/freedreno/fdl/freedreno_layout.h @@ -31,6 +31,10 @@ #include "util/u_debug.h" #include "util/u_math.h" +#include "common/freedreno_common.h" + +BEGINC; + /* Shared freedreno mipmap layout helper * * It does *not* attempt to track surface transitions, in particular @@ -89,6 +93,17 @@ struct fdl_explicit_layout { }; /** + * Metadata shared between vk and gallium driver for interop. + * + * NOTE: EXT_external_objects requires app to check device and driver + * UUIDs to ensure that the vk and gl driver are compatible. So for + * now we don't need any additional versioning of the metadata. + */ +struct fdl_metadata { + uint64_t modifier; +}; + +/** * Encapsulates the layout of a resource, including position of given 2d * surface (layer, level) within. Or rather all the information needed * to derive this. @@ -98,8 +113,8 @@ struct fdl_layout { struct fdl_slice ubwc_slices[FDL_MAX_MIP_LEVELS]; uint32_t pitch0; uint32_t ubwc_width0; - uint32_t layer_size; - uint32_t ubwc_layer_size; /* in bytes */ + uint64_t layer_size; + uint64_t ubwc_layer_size; /* in bytes */ bool ubwc : 1; bool layer_first : 1; /* see above description */ bool tile_all : 1; @@ -124,10 +139,11 @@ struct fdl_layout { uint8_t cpp_shift; uint32_t width0, height0, depth0; + uint32_t mip_levels; uint32_t nr_samples; enum pipe_format format; - uint32_t size; /* Size of the whole image, in bytes. */ + uint64_t size; /* Size of the whole image, in bytes. */ uint32_t base_align; /* Alignment of the base address, in bytes. */ uint8_t pitchalign; /* log2(pitchalign) */ }; @@ -252,7 +268,89 @@ fdl_set_pitchalign(struct fdl_layout *layout, unsigned pitchalign) void fdl_dump_layout(struct fdl_layout *layout); -void fdl6_get_ubwc_blockwidth(struct fdl_layout *layout, uint32_t *blockwidth, - uint32_t *blockheight); +void fdl6_get_ubwc_blockwidth(const struct fdl_layout *layout, + uint32_t *blockwidth, uint32_t *blockheight); + +enum fdl_view_type { + FDL_VIEW_TYPE_1D = 0, + FDL_VIEW_TYPE_2D = 1, + FDL_VIEW_TYPE_CUBE = 2, + FDL_VIEW_TYPE_3D = 3, + FDL_VIEW_TYPE_BUFFER = 4, +}; + +enum fdl_chroma_location { + FDL_CHROMA_LOCATION_COSITED_EVEN = 0, + FDL_CHROMA_LOCATION_MIDPOINT = 1, +}; + +struct fdl_view_args { + uint32_t chip; + uint64_t iova; + uint32_t base_miplevel; + uint32_t level_count; + uint32_t base_array_layer; + uint32_t layer_count; + float min_lod_clamp; + unsigned char swiz[4]; + enum pipe_format format; + enum fdl_view_type type; + enum fdl_chroma_location chroma_offsets[2]; +}; + +#define FDL6_TEX_CONST_DWORDS 16 + +struct fdl6_view { + uint64_t base_addr; + uint64_t ubwc_addr; + uint32_t layer_size; + uint32_t ubwc_layer_size; + + uint32_t offset; + + uint32_t width, height; + bool need_y2_align; + + bool ubwc_enabled; + + enum pipe_format format; + + uint32_t descriptor[FDL6_TEX_CONST_DWORDS]; + + /* Descriptor for use as a storage image as opposed to a sampled image. + * This has a few differences for cube maps (e.g. type). + */ + uint32_t storage_descriptor[FDL6_TEX_CONST_DWORDS]; + + uint32_t pitch; + + /* pre-filled register values */ + uint32_t FLAG_BUFFER_PITCH; + + uint32_t RB_MRT_BUF_INFO; + uint32_t SP_FS_MRT_REG; + + uint32_t SP_PS_2D_SRC_INFO; + uint32_t SP_PS_2D_SRC_SIZE; + + uint32_t RB_2D_DST_INFO; + + uint32_t RB_BLIT_DST_INFO; + + uint32_t GRAS_LRZ_DEPTH_VIEW; +}; + +void +fdl6_view_init(struct fdl6_view *view, const struct fdl_layout **layouts, + const struct fdl_view_args *args, bool has_z24uint_s8uint); +void +fdl6_buffer_view_init(uint32_t *descriptor, enum pipe_format format, + const uint8_t *swiz, uint64_t iova, uint32_t size); + +void +fdl6_format_swiz(enum pipe_format format, bool has_z24uint_s8uint, + unsigned char *format_swiz); + +ENDC; #endif /* FREEDRENO_LAYOUT_H_ */ |