iris: Add a new IRIS_MMAP_NONE map type
This indicates that the buffer can never be mapped. We use this primarily for imported BOs. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11888>
This commit is contained in:

committed by
Marge Bot

parent
e83da2d8e3
commit
188cddfb38
@@ -801,7 +801,7 @@ iris_bo_gem_create_from_name(struct iris_bufmgr *bufmgr,
|
||||
bo->global_name = handle;
|
||||
bo->reusable = false;
|
||||
bo->imported = true;
|
||||
bo->mmap_mode = IRIS_MMAP_WC;
|
||||
bo->mmap_mode = IRIS_MMAP_NONE;
|
||||
bo->kflags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS | EXEC_OBJECT_PINNED;
|
||||
bo->address = vma_alloc(bufmgr, IRIS_MEMZONE_OTHER, bo->size, 1);
|
||||
|
||||
@@ -1051,6 +1051,7 @@ iris_bo_gem_mmap_offset(struct pipe_debug_callback *dbg, struct iris_bo *bo)
|
||||
[IRIS_MMAP_WC] = I915_MMAP_OFFSET_WC,
|
||||
[IRIS_MMAP_WB] = I915_MMAP_OFFSET_WB,
|
||||
};
|
||||
assert(bo->mmap_mode != IRIS_MMAP_NONE);
|
||||
assert(bo->mmap_mode < ARRAY_SIZE(mmap_offset_for_mode));
|
||||
mmap_arg.flags = mmap_offset_for_mode[bo->mmap_mode];
|
||||
|
||||
@@ -1080,6 +1081,10 @@ iris_bo_map(struct pipe_debug_callback *dbg,
|
||||
{
|
||||
struct iris_bufmgr *bufmgr = bo->bufmgr;
|
||||
|
||||
assert(bo->mmap_mode != IRIS_MMAP_NONE);
|
||||
if (bo->mmap_mode == IRIS_MMAP_NONE)
|
||||
return NULL;
|
||||
|
||||
if (!bo->map) {
|
||||
DBG("iris_bo_map: %d (%s)\n", bo->gem_handle, bo->name);
|
||||
void *map = bufmgr->has_mmap_offset ? iris_bo_gem_mmap_offset(dbg, bo)
|
||||
@@ -1306,7 +1311,7 @@ iris_bo_import_dmabuf(struct iris_bufmgr *bufmgr, int prime_fd)
|
||||
bo->name = "prime";
|
||||
bo->reusable = false;
|
||||
bo->imported = true;
|
||||
bo->mmap_mode = IRIS_MMAP_WC;
|
||||
bo->mmap_mode = IRIS_MMAP_NONE;
|
||||
bo->kflags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS | EXEC_OBJECT_PINNED;
|
||||
|
||||
/* From the Bspec, Memory Compression - Gfx12:
|
||||
|
@@ -123,6 +123,7 @@ iris_domain_is_read_only(enum iris_domain access)
|
||||
}
|
||||
|
||||
enum iris_mmap_mode {
|
||||
IRIS_MMAP_NONE, /**< Cannot be mapped */
|
||||
IRIS_MMAP_UC, /**< Fully uncached memory map */
|
||||
IRIS_MMAP_WC, /**< Write-combining map with no caching of reads */
|
||||
IRIS_MMAP_WB, /**< Write-back mapping with CPU caches enabled */
|
||||
|
@@ -2087,7 +2087,7 @@ iris_transfer_map(struct pipe_context *ctx,
|
||||
if (usage & PIPE_MAP_WRITE)
|
||||
util_range_add(&res->base.b, &res->valid_buffer_range, box->x, box->x + box->width);
|
||||
|
||||
if (!res->bo->imported) {
|
||||
if (res->bo->mmap_mode != IRIS_MMAP_NONE) {
|
||||
/* GPU copies are not useful for buffer reads. Instead of stalling to
|
||||
* read from the original buffer, we'd simply copy it to a temporary...
|
||||
* then stall (a bit longer) to read from that buffer.
|
||||
@@ -2257,7 +2257,8 @@ iris_texture_subdata(struct pipe_context *ctx,
|
||||
*/
|
||||
if (surf->tiling == ISL_TILING_LINEAR ||
|
||||
isl_aux_usage_has_compression(res->aux.usage) ||
|
||||
resource_is_busy(ice, res)) {
|
||||
resource_is_busy(ice, res) ||
|
||||
res->bo->mmap_mode == IRIS_MMAP_NONE) {
|
||||
return u_default_texture_subdata(ctx, resource, level, usage, box,
|
||||
data, stride, layer_stride);
|
||||
}
|
||||
|
Reference in New Issue
Block a user