iris: Move iris_batch i915 specific variables to union

Saves some bytes when Xe kmd fields are added and makes easier to
spot places that are misusing i915 variables.

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22172>
This commit is contained in:
José Roberto de Souza 2023-04-11 12:41:06 -07:00 committed by Marge Bot
parent b6cf4001d3
commit 35d6e830c7
6 changed files with 27 additions and 22 deletions

View file

@ -126,13 +126,13 @@ iris_init_non_engine_contexts(struct iris_context *ice)
struct iris_screen *screen = (void *) ice->ctx.screen;
iris_foreach_batch(ice, batch) {
batch->ctx_id = iris_create_hw_context(screen->bufmgr, ice->protected);
batch->exec_flags = I915_EXEC_RENDER;
assert(batch->ctx_id);
context_set_priority(screen->bufmgr, batch->ctx_id, ice->priority);
batch->i915.ctx_id = iris_create_hw_context(screen->bufmgr, ice->protected);
batch->i915.exec_flags = I915_EXEC_RENDER;
assert(batch->i915.ctx_id);
context_set_priority(screen->bufmgr, batch->i915.ctx_id, ice->priority);
}
ice->batches[IRIS_BATCH_BLITTER].exec_flags = I915_EXEC_BLT;
ice->batches[IRIS_BATCH_BLITTER].i915.exec_flags = I915_EXEC_BLT;
ice->has_engines_context = false;
}
@ -192,8 +192,8 @@ iris_init_engines_context(struct iris_context *ice)
iris_foreach_batch(ice, batch) {
unsigned i = batch - &ice->batches[0];
batch->ctx_id = engines_ctx;
batch->exec_flags = i;
batch->i915.ctx_id = engines_ctx;
batch->i915.exec_flags = i;
}
ice->has_engines_context = true;
@ -216,7 +216,7 @@ clone_hw_context(struct iris_batch *batch)
struct iris_screen *screen = batch->screen;
struct iris_bufmgr *bufmgr = screen->bufmgr;
struct iris_context *ice = batch->ice;
bool protected = iris_hw_context_get_protected(bufmgr, batch->ctx_id);
bool protected = iris_hw_context_get_protected(bufmgr, batch->i915.ctx_id);
uint32_t new_ctx = iris_create_hw_context(bufmgr, protected);
if (new_ctx)
@ -243,12 +243,12 @@ iris_i915_replace_batch(struct iris_batch *batch)
struct iris_context *ice = batch->ice;
if (ice->has_engines_context) {
uint32_t old_ctx = batch->ctx_id;
uint32_t old_ctx = batch->i915.ctx_id;
int new_ctx = iris_create_engines_context(ice);
if (new_ctx < 0)
return false;
iris_foreach_batch(ice, bat) {
bat->ctx_id = new_ctx;
bat->i915.ctx_id = new_ctx;
/* Notify the context that state must be re-initialized. */
iris_lost_context_state(bat);
}
@ -258,8 +258,8 @@ iris_i915_replace_batch(struct iris_batch *batch)
if (!new_ctx)
return false;
iris_destroy_kernel_context(bufmgr, batch->ctx_id);
batch->ctx_id = new_ctx;
iris_destroy_kernel_context(bufmgr, batch->i915.ctx_id);
batch->i915.ctx_id = new_ctx;
/* Notify the context that state must be re-initialized. */
iris_lost_context_state(batch);
@ -279,7 +279,7 @@ void iris_i915_destroy_batch(struct iris_batch *batch)
if (batch->ice->has_engines_context && batch != &batch->ice->batches[0])
return;
iris_destroy_kernel_context(bufmgr, batch->ctx_id);
iris_destroy_kernel_context(bufmgr, batch->i915.ctx_id);
}
void iris_i915_init_batches(struct iris_context *ice)

View file

@ -219,7 +219,7 @@ i915_batch_check_for_reset(struct iris_batch *batch)
{
struct iris_screen *screen = batch->screen;
enum pipe_reset_status status = PIPE_NO_RESET;
struct drm_i915_reset_stats stats = { .ctx_id = batch->ctx_id };
struct drm_i915_reset_stats stats = { .ctx_id = batch->i915.ctx_id };
if (intel_ioctl(screen->fd, DRM_IOCTL_I915_GET_RESET_STATS, &stats))
DBG("DRM_IOCTL_I915_GET_RESET_STATS failed: %s\n", strerror(errno));
@ -316,11 +316,11 @@ i915_batch_submit(struct iris_batch *batch)
.batch_start_offset = 0,
/* This must be QWord aligned. */
.batch_len = ALIGN(batch->primary_batch_size, 8),
.flags = batch->exec_flags |
.flags = batch->i915.exec_flags |
I915_EXEC_NO_RELOC |
I915_EXEC_BATCH_FIRST |
I915_EXEC_HANDLE_LUT,
.rsvd1 = batch->ctx_id, /* rsvd1 is actually the context ID */
.rsvd1 = batch->i915.ctx_id, /* rsvd1 is actually the context ID */
};
if (iris_batch_num_fences(batch)) {

View file

@ -814,10 +814,11 @@ _iris_batch_flush(struct iris_batch *batch, const char *file, int line)
if (basefile)
file = basefile + 5;
uint32_t batch_ctx_id = batch->i915.ctx_id;
fprintf(stderr, "%19s:%-3d: %s batch [%u] flush with %5db (%0.1f%%) "
"(cmds), %4d BOs (%0.1fMb aperture)\n",
file, line, iris_batch_name_to_string(batch->name), batch->ctx_id,
batch->total_chained_batch_size,
file, line, iris_batch_name_to_string(batch->name),
batch_ctx_id, batch->total_chained_batch_size,
100.0f * batch->total_chained_batch_size / BATCH_SZ,
batch->exec_count,
(float) batch->aperture_space / (1024 * 1024));

View file

@ -93,8 +93,12 @@ struct iris_batch {
/** Last binder address set in this hardware context. */
uint64_t last_binder_address;
uint32_t ctx_id;
uint32_t exec_flags;
union {
struct {
uint32_t ctx_id;
uint32_t exec_flags;
} i915;
};
/** A list of all BOs referenced by this batch */
struct iris_bo **exec_bos;

View file

@ -171,7 +171,7 @@ iris_init_monitor_ctx(struct iris_context *ice)
ice,
screen->bufmgr,
screen->devinfo,
ice->batches[IRIS_BATCH_RENDER].ctx_id,
ice->batches[IRIS_BATCH_RENDER].i915.ctx_id,
screen->fd);
}

View file

@ -78,7 +78,7 @@ iris_init_perf_query_info(struct pipe_context *pipe)
ice,
screen->bufmgr,
screen->devinfo,
ice->batches[IRIS_BATCH_RENDER].ctx_id,
ice->batches[IRIS_BATCH_RENDER].i915.ctx_id,
screen->fd);
return perf_cfg->n_queries;