Commit b338bb70 authored by Mark Janes's avatar Mark Janes
Browse files

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's avatarKenneth Graunke <kenneth@whitecape.org>
Acked-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
Part-of: <mesa/mesa!7354>
parent e67b8f50
......@@ -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,
......
......@@ -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;
......
......@@ -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");
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment