blorp: Add a blorp_address::local_hint flag
This will be used as a performance hint for XY_BLOCK_COPY_BLT to indicate whether the source/destination surfaces are (likely) in device-local memory or system memory. We don't need to be precise here - it's okay to set the fields to LOCAL even if a buffer has been evicted out to system memory. We should set this from Vulkan too, but I haven't yet. There isn't a convenient anv_bo field like there is in iris... Reviewed-by: Caio Oliveira <caio.oliveira@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14687>
This commit is contained in:

committed by
Marge Bot

parent
5262475242
commit
abd71630fc
@@ -237,6 +237,7 @@ iris_blorp_surf_for_resource(struct isl_device *isl_dev,
|
||||
bool is_dest)
|
||||
{
|
||||
struct iris_resource *res = (void *) p_res;
|
||||
const struct intel_device_info *devinfo = isl_dev->info;
|
||||
|
||||
*surf = (struct blorp_surf) {
|
||||
.surf = &res->surf,
|
||||
@@ -247,6 +248,7 @@ iris_blorp_surf_for_resource(struct isl_device *isl_dev,
|
||||
.mocs = iris_mocs(res->bo, isl_dev,
|
||||
is_dest ? ISL_SURF_USAGE_RENDER_TARGET_BIT
|
||||
: ISL_SURF_USAGE_TEXTURE_BIT),
|
||||
.local_hint = iris_bo_likely_local(res->bo),
|
||||
},
|
||||
.aux_usage = aux_usage,
|
||||
};
|
||||
@@ -258,6 +260,8 @@ iris_blorp_surf_for_resource(struct isl_device *isl_dev,
|
||||
.offset = res->aux.offset,
|
||||
.reloc_flags = is_dest ? EXEC_OBJECT_WRITE : 0,
|
||||
.mocs = iris_mocs(res->bo, isl_dev, 0),
|
||||
.local_hint = devinfo->has_flat_ccs ||
|
||||
iris_bo_likely_local(res->aux.bo),
|
||||
};
|
||||
surf->clear_color = res->aux.clear_color;
|
||||
surf->clear_color_addr = (struct blorp_address) {
|
||||
@@ -265,6 +269,8 @@ iris_blorp_surf_for_resource(struct isl_device *isl_dev,
|
||||
.offset = res->aux.clear_color_offset,
|
||||
.reloc_flags = 0,
|
||||
.mocs = iris_mocs(res->aux.clear_color_bo, isl_dev, 0),
|
||||
.local_hint = devinfo->has_flat_ccs ||
|
||||
iris_bo_likely_local(res->aux.clear_color_bo),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -643,12 +649,14 @@ iris_copy_region(struct blorp_context *blorp,
|
||||
.buffer = src_res->bo, .offset = src_box->x,
|
||||
.mocs = iris_mocs(src_res->bo, &screen->isl_dev,
|
||||
ISL_SURF_USAGE_RENDER_TARGET_BIT),
|
||||
.local_hint = iris_bo_likely_local(src_res->bo),
|
||||
};
|
||||
struct blorp_address dst_addr = {
|
||||
.buffer = dst_res->bo, .offset = dstx,
|
||||
.reloc_flags = EXEC_OBJECT_WRITE,
|
||||
.mocs = iris_mocs(dst_res->bo, &screen->isl_dev,
|
||||
ISL_SURF_USAGE_TEXTURE_BIT),
|
||||
.local_hint = iris_bo_likely_local(dst_res->bo),
|
||||
};
|
||||
|
||||
iris_emit_buffer_barrier_for(batch, src_res->bo,
|
||||
|
@@ -195,6 +195,7 @@ blorp_alloc_vertex_buffer(struct blorp_batch *blorp_batch,
|
||||
.offset = offset,
|
||||
.mocs = iris_mocs(bo, &batch->screen->isl_dev,
|
||||
ISL_SURF_USAGE_VERTEX_BUFFER_BIT),
|
||||
.local_hint = iris_bo_likely_local(bo),
|
||||
};
|
||||
|
||||
return map;
|
||||
@@ -242,6 +243,8 @@ blorp_get_workaround_address(struct blorp_batch *blorp_batch)
|
||||
return (struct blorp_address) {
|
||||
.buffer = batch->screen->workaround_address.bo,
|
||||
.offset = batch->screen->workaround_address.offset,
|
||||
.local_hint =
|
||||
iris_bo_likely_local(batch->screen->workaround_address.bo),
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -414,6 +414,23 @@ iris_bo_is_exported(const struct iris_bo *bo)
|
||||
return bo->real.exported;
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the BO prefers to reside in device-local memory.
|
||||
*
|
||||
* We don't consider eviction here; this is meant to be a performance hint.
|
||||
* It will return true for BOs allocated from the LMEM or LMEM+SMEM heaps,
|
||||
* even if the buffer has been temporarily evicted to system memory.
|
||||
*/
|
||||
static inline bool
|
||||
iris_bo_likely_local(const struct iris_bo *bo)
|
||||
{
|
||||
if (!bo)
|
||||
return false;
|
||||
|
||||
bo = iris_get_backing_bo((struct iris_bo *) bo);
|
||||
return bo->real.heap != IRIS_HEAP_SYSTEM_MEMORY;
|
||||
}
|
||||
|
||||
static inline enum iris_mmap_mode
|
||||
iris_bo_mmap_mode(const struct iris_bo *bo)
|
||||
{
|
||||
|
@@ -106,6 +106,13 @@ struct blorp_address {
|
||||
uint64_t offset;
|
||||
unsigned reloc_flags;
|
||||
uint32_t mocs;
|
||||
|
||||
/**
|
||||
* True if this buffer is intended to live in device-local memory.
|
||||
* This is only a performance hint; it's OK to set it to true even
|
||||
* if eviction has temporarily forced the buffer to system memory.
|
||||
*/
|
||||
bool local_hint;
|
||||
};
|
||||
|
||||
struct blorp_surf
|
||||
|
Reference in New Issue
Block a user