Mesa (master): iris: add a iris_context reference to iris_batch
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Feb 2 01:34:43 UTC 2021
Module: Mesa
Branch: master
Commit: b338bb70e0df3839718315140f217d173cc6d460
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b338bb70e0df3839718315140f217d173cc6d460
Author: Mark Janes <markjanes at swizzler.org>
Date: Wed Oct 28 14:13:48 2020 -0700
iris: add a iris_context reference to iris_batch
This eliminates the need to use container_of in error handling code.
INTEL_MEASURE will need to access the iris context from each batch.
suggested-by: Kenneth Graunke <kenneth at whitecape.org>
Acked-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7354>
---
src/gallium/drivers/iris/iris_batch.c | 1 +
src/gallium/drivers/iris/iris_batch.h | 1 +
src/gallium/drivers/iris/iris_context.c | 8 +-------
src/gallium/drivers/iris/iris_state.c | 2 +-
4 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c
index 5f885f5dd54..70f40bee1f9 100644
--- a/src/gallium/drivers/iris/iris_batch.c
+++ b/src/gallium/drivers/iris/iris_batch.c
@@ -180,6 +180,7 @@ iris_init_batch(struct iris_context *ice,
batch->reset = &ice->reset;
batch->state_sizes = ice->state.sizes;
batch->name = name;
+ batch->ice = ice;
batch->fine_fences.uploader =
u_upload_create(&ice->ctx, 4096, PIPE_BIND_CUSTOM,
diff --git a/src/gallium/drivers/iris/iris_batch.h b/src/gallium/drivers/iris/iris_batch.h
index 76927ebf3f7..302ebd5f360 100644
--- a/src/gallium/drivers/iris/iris_batch.h
+++ b/src/gallium/drivers/iris/iris_batch.h
@@ -58,6 +58,7 @@ enum iris_batch_name {
#define IRIS_BATCH_COUNT 2
struct iris_batch {
+ struct iris_context *ice;
struct iris_screen *screen;
struct pipe_debug_callback *dbg;
struct pipe_device_reset_callback *reset;
diff --git a/src/gallium/drivers/iris/iris_context.c b/src/gallium/drivers/iris/iris_context.c
index 391e0d15da2..80b666dc60d 100644
--- a/src/gallium/drivers/iris/iris_context.c
+++ b/src/gallium/drivers/iris/iris_context.c
@@ -78,17 +78,11 @@ iris_lost_context_state(struct iris_batch *batch)
* we do need to inform the context of batch catastrophe. We know the
* batch is one of our context's, so hackily claw our way back.
*/
- struct iris_context *ice = NULL;
+ struct iris_context *ice = batch->ice;
if (batch->name == IRIS_BATCH_RENDER) {
- ice = container_of(batch, struct iris_context, batches[IRIS_BATCH_RENDER]);
- assert(&ice->batches[IRIS_BATCH_RENDER] == batch);
-
batch->screen->vtbl.init_render_context(batch);
} else if (batch->name == IRIS_BATCH_COMPUTE) {
- ice = container_of(batch, struct iris_context, batches[IRIS_BATCH_COMPUTE]);
- assert(&ice->batches[IRIS_BATCH_COMPUTE] == batch);
-
batch->screen->vtbl.init_compute_context(batch);
} else {
unreachable("unhandled batch reset");
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index 882b112a3f8..33c5b2c523b 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -812,7 +812,7 @@ iris_upload_slice_hashing_state(struct iris_batch *batch)
if (subslices_delta == 0)
return;
- struct iris_context *ice = container_of(batch, struct iris_context, batches[IRIS_BATCH_RENDER]);
+ struct iris_context *ice = batch->ice;
assert(&ice->batches[IRIS_BATCH_RENDER] == batch);
unsigned size = GENX(SLICE_HASH_TABLE_length) * 4;
More information about the mesa-commit
mailing list