intel/aux_map: Add and use INTEL_AUX_MAP_MAIN_SIZE_SCALEDOWN
Introduce a macro so that drivers don't need to rely on the isl_surf struct to determine the size of the CCS buffer on gfx12. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28942>
This commit is contained in:
@@ -144,10 +144,6 @@ struct aux_format_info {
|
||||
* Granularity of main surface in compression. It must be power of 2.
|
||||
*/
|
||||
uint64_t main_page_size;
|
||||
/**
|
||||
* The ratio of main surface to an AUX entry.
|
||||
*/
|
||||
uint64_t main_to_aux_ratio;
|
||||
/**
|
||||
* Page size of level 1 page table. It must be power of 2.
|
||||
*/
|
||||
@@ -165,14 +161,12 @@ struct aux_format_info {
|
||||
static const struct aux_format_info aux_formats[] = {
|
||||
[INTEL_AUX_MAP_GFX12_64KB] = {
|
||||
.main_page_size = 64 * 1024,
|
||||
.main_to_aux_ratio = 256,
|
||||
.l1_page_size = 8 * 1024,
|
||||
.l1_index_mask = 0xff,
|
||||
.l1_index_offset = 16,
|
||||
},
|
||||
[INTEL_AUX_MAP_GFX125_1MB] = {
|
||||
.main_page_size = 1024 * 1024,
|
||||
.main_to_aux_ratio = 256,
|
||||
.l1_page_size = 2 * 1024,
|
||||
.l1_index_mask = 0xf,
|
||||
.l1_index_offset = 20,
|
||||
@@ -225,7 +219,7 @@ get_page_mask(const uint64_t page_size)
|
||||
static inline uint64_t
|
||||
get_meta_page_size(const struct aux_format_info *info)
|
||||
{
|
||||
return info->main_page_size / info->main_to_aux_ratio;
|
||||
return info->main_page_size / INTEL_AUX_MAP_MAIN_SIZE_SCALEDOWN;
|
||||
}
|
||||
|
||||
static inline uint64_t
|
||||
@@ -241,17 +235,11 @@ intel_aux_get_meta_address_mask(struct intel_aux_map_context *ctx)
|
||||
return (~get_page_mask(get_meta_page_size(ctx->format))) & VALID_ADDRESS_MASK;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
intel_aux_get_main_to_aux_ratio(struct intel_aux_map_context *ctx)
|
||||
{
|
||||
return ctx->format->main_to_aux_ratio;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
intel_aux_main_to_aux_offset(struct intel_aux_map_context *ctx,
|
||||
uint64_t main_offset)
|
||||
{
|
||||
return main_offset / ctx->format->main_to_aux_ratio;
|
||||
return main_offset / INTEL_AUX_MAP_MAIN_SIZE_SCALEDOWN;
|
||||
}
|
||||
|
||||
static const struct aux_format_info *
|
||||
|
||||
@@ -55,6 +55,19 @@ struct intel_device_info;
|
||||
*/
|
||||
#define INTEL_AUX_MAP_MAIN_PITCH_SCALEDOWN (512 / 64)
|
||||
|
||||
/**
|
||||
* The ratio between the granularity of main surface and AUX data.
|
||||
*
|
||||
* The value is from Bspec 47709, MCS/CCS Buffers for Render Target(s):
|
||||
*
|
||||
* "CCS is a linear buffer created for storing meta-data (AUX data) for
|
||||
* lossless compression. This buffer related information is mentioned in
|
||||
* Render Surface State. CCS buffer's size is based on the padded main
|
||||
* surface (after following Halign and Valign requirements mentioned in the
|
||||
* Render Surface State). CCS_Buffer_Size = Padded_Main_Surface_Size/256"
|
||||
*/
|
||||
#define INTEL_AUX_MAP_MAIN_SIZE_SCALEDOWN 256
|
||||
|
||||
/**
|
||||
* The alignment at which the AUX data virtual addresses should start.
|
||||
*
|
||||
@@ -98,12 +111,6 @@ intel_aux_map_get_num_buffers(struct intel_aux_map_context *ctx);
|
||||
uint64_t
|
||||
intel_aux_get_meta_address_mask(struct intel_aux_map_context *ctx);
|
||||
|
||||
/**
|
||||
* Returns the ratio between the granularity of main surface and AUX data
|
||||
*/
|
||||
uint64_t
|
||||
intel_aux_get_main_to_aux_ratio(struct intel_aux_map_context *ctx);
|
||||
|
||||
/**
|
||||
* Takes a relative offset in the main surface and returns a relative offset
|
||||
* in the aux surface that maps to the main offset.
|
||||
|
||||
Reference in New Issue
Block a user