iris: Remove iris_bo::kflags

This field was being set with i915 specific flags, replacing it
by a capture boolean we can have the same behavior with less
i915_drm.h usage in the common code.

This also allow us to implement VM capture in Xe KMD.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27728>
This commit is contained in:
José Roberto de Souza 2024-01-12 10:23:39 -08:00 committed by Marge Bot
parent af22779438
commit c15ae2532d
6 changed files with 17 additions and 16 deletions

View file

@ -303,14 +303,17 @@ i915_batch_submit(struct iris_batch *batch)
validation_list[prev_index].flags |= EXEC_OBJECT_WRITE;
} else {
uint32_t flags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS | EXEC_OBJECT_PINNED;
flags |= bo->real.capture ? EXEC_OBJECT_CAPTURE : 0;
flags |= bo == batch->screen->workaround_bo ? EXEC_OBJECT_ASYNC : 0;
flags |= iris_bo_is_external(bo) ? 0 : EXEC_OBJECT_ASYNC;
flags |= written ? EXEC_OBJECT_WRITE : 0;
index_for_handle[bo->gem_handle] = validation_count;
validation_list[validation_count] =
(struct drm_i915_gem_exec_object2) {
.handle = bo->gem_handle,
.offset = bo->address,
.flags = flags | bo->real.kflags |
(written ? EXEC_OBJECT_WRITE : 0) |
(iris_bo_is_external(bo) ? 0 : EXEC_OBJECT_ASYNC),
.flags = flags,
};
++validation_count;
}

View file

@ -419,7 +419,7 @@ create_batch(struct iris_batch *batch)
batch->bo = iris_bo_alloc(bufmgr, "command buffer",
BATCH_SZ + BATCH_RESERVED, 8,
IRIS_MEMZONE_OTHER, BO_ALLOC_NO_SUBALLOC);
iris_get_backing_bo(batch->bo)->real.kflags |= EXEC_OBJECT_CAPTURE;
iris_get_backing_bo(batch->bo)->real.capture = true;
batch->map = iris_bo_map(NULL, batch->bo, MAP_READ | MAP_WRITE);
batch->map_next = batch->map;

View file

@ -1226,14 +1226,13 @@ iris_bo_alloc(struct iris_bufmgr *bufmgr,
bo->real.reusable = bucket && bufmgr->bo_reuse;
bo->real.protected = flags & BO_ALLOC_PROTECTED;
bo->index = -1;
bo->real.kflags = 0;
bo->real.prime_fd = -1;
/* By default, capture all driver-internal buffers like shader kernels,
* surface states, dynamic states, border colors, and so on.
*/
if (memzone < IRIS_MEMZONE_OTHER || INTEL_DEBUG(DEBUG_CAPTURE_ALL))
bo->real.kflags = EXEC_OBJECT_CAPTURE;
bo->real.capture = true;
assert(bo->real.map == NULL || bo->real.mmap_mode == mmap_mode);
bo->real.mmap_mode = mmap_mode;
@ -1296,7 +1295,7 @@ iris_bo_create_userptr(struct iris_bufmgr *bufmgr, const char *name,
bo->bufmgr = bufmgr;
if (INTEL_DEBUG(DEBUG_CAPTURE_ALL))
bo->real.kflags = EXEC_OBJECT_CAPTURE;
bo->real.capture = true;
simple_mtx_lock(&bufmgr->lock);
bo->address = vma_alloc(bufmgr, memzone, size, 1);
@ -1414,7 +1413,7 @@ iris_bo_gem_create_from_name(struct iris_bufmgr *bufmgr,
bo->real.heap = IRIS_HEAP_SYSTEM_MEMORY_CACHED_COHERENT;
bo->real.mmap_mode = IRIS_MMAP_NONE;
if (INTEL_DEBUG(DEBUG_CAPTURE_ALL))
bo->real.kflags = EXEC_OBJECT_CAPTURE;
bo->real.capture = true;
bo->address = vma_alloc(bufmgr, IRIS_MEMZONE_OTHER, bo->size, 1);
if (bo->address == 0ull)
goto err_free;
@ -1937,7 +1936,7 @@ iris_bo_import_dmabuf(struct iris_bufmgr *bufmgr, int prime_fd,
bo->real.heap = IRIS_HEAP_SYSTEM_MEMORY_CACHED_COHERENT;
bo->real.mmap_mode = IRIS_MMAP_NONE;
if (INTEL_DEBUG(DEBUG_CAPTURE_ALL))
bo->real.kflags = EXEC_OBJECT_CAPTURE;
bo->real.capture = true;
bo->gem_handle = handle;
bo->real.prime_fd = needs_prime_fd(bufmgr) ? dup(prime_fd) : -1;
@ -2209,7 +2208,7 @@ intel_aux_map_buffer_alloc(void *driver_ctx, uint32_t size)
bo->name = "aux-map";
p_atomic_set(&bo->refcount, 1);
bo->index = -1;
bo->real.kflags = EXEC_OBJECT_CAPTURE;
bo->real.capture = true;
bo->real.mmap_mode = heap_to_mmap_mode(bufmgr, bo->real.heap);
bo->real.prime_fd = -1;

View file

@ -287,8 +287,6 @@ struct iris_bo {
union {
struct {
uint64_t kflags;
time_t free_time;
/** Mapped address for the buffer, saved across map/unmap cycles */
@ -327,6 +325,9 @@ struct iris_bo {
/** Boolean of whether this buffer is protected (HW encryption) */
bool protected;
/** Boolean of whether this buffer needs to be captured in error dump */
bool capture;
} real;
struct {
struct pb_slab_entry entry;

View file

@ -549,8 +549,7 @@ ensure_ring_bo(struct iris_context *ice, struct iris_screen *screen)
iris_bo_alloc(bufmgr, "gen ring",
RING_SIZE, 8, IRIS_MEMZONE_OTHER,
BO_ALLOC_NO_SUBALLOC);
iris_get_backing_bo(ice->draw.generation.ring_bo)->real.kflags |= EXEC_OBJECT_CAPTURE;
iris_get_backing_bo(ice->draw.generation.ring_bo)->real.capture = true;
}
struct iris_gen_indirect_params *

View file

@ -743,8 +743,7 @@ iris_init_identifier_bo(struct iris_screen *screen)
assert(iris_bo_is_real(screen->workaround_bo));
screen->workaround_bo->real.kflags |=
EXEC_OBJECT_CAPTURE | EXEC_OBJECT_ASYNC;
screen->workaround_bo->real.capture = true;
screen->workaround_address = (struct iris_address) {
.bo = screen->workaround_bo,
.offset = ALIGN(