mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
iris: Map each surf to it's aux-surf in the aux-map tables
Rework: Nanley Chery Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
d09db2d7b2
commit
f046c6d090
2 changed files with 36 additions and 0 deletions
|
|
@ -395,6 +395,20 @@ alloc_bo_from_cache(struct iris_bufmgr *bufmgr,
|
|||
if (!bo)
|
||||
return NULL;
|
||||
|
||||
if (bo->aux_map_address) {
|
||||
/* This buffer was associated with an aux-buffer range. We make sure
|
||||
* that buffers are not reused from the cache while the buffer is (busy)
|
||||
* being used by an executing batch. Since we are here, the buffer is no
|
||||
* longer being used by a batch and the buffer was deleted (in order to
|
||||
* end up in the cache). Therefore its old aux-buffer range can be
|
||||
* removed from the aux-map.
|
||||
*/
|
||||
if (bo->bufmgr->aux_map_ctx)
|
||||
gen_aux_map_unmap_range(bo->bufmgr->aux_map_ctx, bo->gtt_offset,
|
||||
bo->size);
|
||||
bo->aux_map_address = 0;
|
||||
}
|
||||
|
||||
/* If the cached BO isn't in the right memory zone, or the alignment
|
||||
* isn't sufficient, free the old memory and assign it a new address.
|
||||
*/
|
||||
|
|
@ -730,6 +744,11 @@ bo_close(struct iris_bo *bo)
|
|||
bo->gem_handle, bo->name, strerror(errno));
|
||||
}
|
||||
|
||||
if (bo->aux_map_address && bo->bufmgr->aux_map_ctx) {
|
||||
gen_aux_map_unmap_range(bo->bufmgr->aux_map_ctx, bo->gtt_offset,
|
||||
bo->size);
|
||||
}
|
||||
|
||||
/* Return the VMA for reuse */
|
||||
vma_free(bo->bufmgr, bo->gtt_offset, bo->size);
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@
|
|||
#include "iris_context.h"
|
||||
#include "iris_resource.h"
|
||||
#include "iris_screen.h"
|
||||
#include "intel/common/gen_aux_map.h"
|
||||
#include "intel/dev/gen_debug.h"
|
||||
#include "isl/isl.h"
|
||||
#include "drm-uapi/drm_fourcc.h"
|
||||
|
|
@ -384,6 +385,19 @@ iris_get_aux_clear_color_state_size(struct iris_screen *screen)
|
|||
return devinfo->gen >= 10 ? screen->isl_dev.ss.clear_color_state_size : 0;
|
||||
}
|
||||
|
||||
static void
|
||||
map_aux_addresses(struct iris_screen *screen, struct iris_resource *res)
|
||||
{
|
||||
const struct gen_device_info *devinfo = &screen->devinfo;
|
||||
if (devinfo->gen >= 12 && isl_aux_usage_has_ccs(res->aux.usage)) {
|
||||
void *aux_map_ctx = iris_bufmgr_get_aux_map_context(screen->bufmgr);
|
||||
assert(aux_map_ctx);
|
||||
gen_aux_map_add_image(aux_map_ctx, &res->surf, res->bo->gtt_offset,
|
||||
res->aux.bo->gtt_offset + res->aux.offset);
|
||||
res->bo->aux_map_address = res->aux.bo->gtt_offset;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure aux for the resource, but don't allocate it. For images which
|
||||
* might be shared with modifiers, we must allocate the image and aux data in
|
||||
|
|
@ -560,6 +574,8 @@ iris_resource_alloc_separate_aux(struct iris_screen *screen,
|
|||
iris_get_aux_clear_color_state_size(screen)))
|
||||
return false;
|
||||
|
||||
map_aux_addresses(screen, res);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -846,6 +862,7 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen,
|
|||
res->aux.clear_color_offset += aux_offset;
|
||||
if (!iris_resource_init_aux_buf(res, flags, clear_color_state_size))
|
||||
aux_enabled = false;
|
||||
map_aux_addresses(screen, res);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue