iris: Give up on not passing ice to iris_init_batch
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 1 May 2020 17:17:15 +0000 (10:17 -0700)
committerMarge Bot <eric+marge@anholt.net>
Fri, 1 May 2020 19:00:02 +0000 (19:00 +0000)
We're going to need it to create a uploader in the batch soon.  We still
avoid storing it, to maintain the charade of separation, and make people
think twice about fetching random fields from there and intertwining
things even worse.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3802>

src/gallium/drivers/iris/iris_batch.c
src/gallium/drivers/iris/iris_batch.h
src/gallium/drivers/iris/iris_context.c

index 177ba3a848fb649cadf0e250699da2d79f7dcb40..324ae016ae3ef80945ea72981ef7b15d30595178 100644 (file)
@@ -167,19 +167,17 @@ decode_batch(struct iris_batch *batch)
 }
 
 void
-iris_init_batch(struct iris_batch *batch,
-                struct iris_screen *screen,
-                struct pipe_debug_callback *dbg,
-                struct pipe_device_reset_callback *reset,
-                struct hash_table_u64 *state_sizes,
-                struct iris_batch *all_batches,
+iris_init_batch(struct iris_context *ice,
                 enum iris_batch_name name,
                 int priority)
 {
+   struct iris_batch *batch = &ice->batches[name];
+   struct iris_screen *screen = (void *) ice->ctx.screen;
+
    batch->screen = screen;
-   batch->dbg = dbg;
-   batch->reset = reset;
-   batch->state_sizes = state_sizes;
+   batch->dbg = &ice->dbg;
+   batch->reset = &ice->reset;
+   batch->state_sizes = ice->state.sizes;
    batch->name = name;
 
    batch->hw_ctx_id = iris_create_hw_context(screen->bufmgr);
@@ -205,8 +203,8 @@ iris_init_batch(struct iris_batch *batch,
    memset(batch->other_batches, 0, sizeof(batch->other_batches));
 
    for (int i = 0, j = 0; i < IRIS_BATCH_COUNT; i++) {
-      if (&all_batches[i] != batch)
-         batch->other_batches[j++] = &all_batches[i];
+      if (i != name)
+         batch->other_batches[j++] = &ice->batches[i];
    }
 
    if (unlikely(INTEL_DEBUG)) {
index e285f1d6cfc7f119e1d39320ead5086c70300986..0afab81c8b293e327c619add4cd15d21fcb27ea4 100644 (file)
@@ -35,6 +35,8 @@
 
 #include "iris_fence.h"
 
+struct iris_context;
+
 /* The kernel assumes batchbuffers are smaller than 256kB. */
 #define MAX_BATCH_SIZE (256 * 1024)
 
@@ -141,12 +143,7 @@ struct iris_batch {
    uint32_t last_aux_map_state;
 };
 
-void iris_init_batch(struct iris_batch *batch,
-                     struct iris_screen *screen,
-                     struct pipe_debug_callback *dbg,
-                     struct pipe_device_reset_callback *reset,
-                     struct hash_table_u64 *state_sizes,
-                     struct iris_batch *all_batches,
+void iris_init_batch(struct iris_context *ice,
                      enum iris_batch_name name,
                      int priority);
 void iris_chain_to_new_batch(struct iris_batch *batch);
index 862105b84263375fee152e1d2f0d23200d309973..4d161ac3f411a699f93e06fac84c9c75c38aff85 100644 (file)
@@ -304,9 +304,7 @@ iris_create_context(struct pipe_screen *pscreen, void *priv, unsigned flags)
       ice->state.sizes = _mesa_hash_table_u64_create(ice);
 
    for (int i = 0; i < IRIS_BATCH_COUNT; i++) {
-      iris_init_batch(&ice->batches[i], screen, &ice->dbg,
-                      &ice->reset, ice->state.sizes,
-                      ice->batches, (enum iris_batch_name) i, priority);
+      iris_init_batch(ice, (enum iris_batch_name) i, priority);
    }
 
    screen->vtbl.init_render_context(&ice->batches[IRIS_BATCH_RENDER]);