intel: add alignment helper for aux map

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23198>
This commit is contained in:
Lionel Landwerlin
2023-05-23 10:10:21 +03:00
committed by Marge Bot
parent b772499a09
commit 195fbffac8
2 changed files with 15 additions and 0 deletions

View File

@@ -185,6 +185,7 @@ struct intel_aux_map_context {
uint64_t *level3_map; uint64_t *level3_map;
uint32_t tail_offset, tail_remaining; uint32_t tail_offset, tail_remaining;
uint32_t state_num; uint32_t state_num;
enum intel_aux_map_format format_enum;
const struct aux_format_info *format; const struct aux_format_info *format;
}; };
@@ -344,6 +345,7 @@ intel_aux_map_init(void *driver_ctx,
if (pthread_mutex_init(&ctx->mutex, NULL)) if (pthread_mutex_init(&ctx->mutex, NULL))
return NULL; return NULL;
ctx->format_enum = format;
ctx->format = get_format(format); ctx->format = get_format(format);
ctx->driver_ctx = driver_ctx; ctx->driver_ctx = driver_ctx;
ctx->buffer_alloc = buffer_alloc; ctx->buffer_alloc = buffer_alloc;
@@ -383,6 +385,16 @@ intel_aux_map_finish(struct intel_aux_map_context *ctx)
ralloc_free(ctx); ralloc_free(ctx);
} }
uint32_t
intel_aux_map_get_alignment(struct intel_aux_map_context *ctx)
{
switch (ctx->format_enum) {
case INTEL_AUX_MAP_GFX12_64KB: return 64 * 1024;
case INTEL_AUX_MAP_GFX125_1MB: return 1 * 1024 * 1024;
default: unreachable("Invalid AUX map format");
}
}
uint64_t uint64_t
intel_aux_map_get_base(struct intel_aux_map_context *ctx) intel_aux_map_get_base(struct intel_aux_map_context *ctx)
{ {

View File

@@ -50,6 +50,9 @@ intel_aux_map_init(void *driver_ctx,
struct intel_mapped_pinned_buffer_alloc *buffer_alloc, struct intel_mapped_pinned_buffer_alloc *buffer_alloc,
const struct intel_device_info *devinfo); const struct intel_device_info *devinfo);
uint32_t
intel_aux_map_get_alignment(struct intel_aux_map_context *ctx);
void void
intel_aux_map_finish(struct intel_aux_map_context *ctx); intel_aux_map_finish(struct intel_aux_map_context *ctx);