iris: store workaround address
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fri, 21 Feb 2020 16:06:18 +0000 (18:06 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 20 May 2020 15:58:22 +0000 (15:58 +0000)
This will allow to select a different address later, leaving the
beginning of the buffer to some other use.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3203>

src/gallium/drivers/iris/iris_batch.h
src/gallium/drivers/iris/iris_blorp.c
src/gallium/drivers/iris/iris_pipe_control.c
src/gallium/drivers/iris/iris_screen.c
src/gallium/drivers/iris/iris_screen.h
src/gallium/drivers/iris/iris_state.c

index d82782795513210689fd6b6f8a0bd0d7d8bbec20..8323f45eff2ff37b36ce39fabe6b142ac06825bf 100644 (file)
@@ -57,12 +57,6 @@ enum iris_batch_name {
 
 #define IRIS_BATCH_COUNT 2
 
-struct iris_address {
-   struct iris_bo *bo;
-   uint64_t offset;
-   bool write;
-};
-
 struct iris_batch {
    struct iris_screen *screen;
    struct pipe_debug_callback *dbg;
index 028e7c592bebb7976d389be1bf1970bf06cbb539..a295c6cacd3d9afe1f9e9072ae6ebe172f0d9726 100644 (file)
@@ -228,7 +228,10 @@ blorp_get_workaround_address(struct blorp_batch *blorp_batch)
 {
    struct iris_batch *batch = blorp_batch->driver_batch;
 
-   return (struct blorp_address) { .buffer = batch->screen->workaround_bo };
+   return (struct blorp_address) {
+      .buffer = batch->screen->workaround_address.bo,
+      .offset = batch->screen->workaround_address.offset,
+   };
 }
 
 static void
index 59005894bbc4ff9181a24f269764e7d8947a9f6c..193bdef6c266d4560bc631b395792235a932a273 100644 (file)
@@ -148,7 +148,8 @@ iris_emit_end_of_pipe_sync(struct iris_batch *batch,
    iris_emit_pipe_control_write(batch, reason,
                                 flags | PIPE_CONTROL_CS_STALL |
                                 PIPE_CONTROL_WRITE_IMMEDIATE,
-                                batch->screen->workaround_bo, 0, 0);
+                                batch->screen->workaround_address.bo,
+                                batch->screen->workaround_address.offset, 0);
 }
 
 /**
index cd5d9b729517b01fba9811f3e5d1b3f55e91c23b..8f28fc3ab9e9f5de1e3de10f7d16ebf40439b16f 100644 (file)
@@ -718,6 +718,11 @@ iris_screen_create(int fd, const struct pipe_screen_config *config)
    if (!screen->workaround_bo)
       return NULL;
 
+   screen->workaround_address = (struct iris_address) {
+      .bo = screen->workaround_bo,
+      .offset = 0,
+   };
+
    brw_process_intel_debug_variable();
 
    screen->driconf.dual_color_blend_by_location =
index 9ee111c911aa986ed5ea14c9de283983c245c285..1ce0550a6bf854038f778edf34f57275cbfcc771 100644 (file)
@@ -136,6 +136,12 @@ struct iris_vtable {
    void (*lost_genx_state)(struct iris_context *ice, struct iris_batch *batch);
 };
 
+struct iris_address {
+   struct iris_bo *bo;
+   uint64_t offset;
+   bool write;
+};
+
 struct iris_screen {
    struct pipe_screen base;
 
@@ -190,6 +196,7 @@ struct iris_screen {
     * require scratch writes or reads from some unimportant memory.
     */
    struct iris_bo *workaround_bo;
+   struct iris_address workaround_address;
 
    struct disk_cache *disk_cache;
 };
index 136297fd197eb8899e1af85004b4a05ee62529b0..fd44d7046e043aec86579a9f4fc961841b56795a 100644 (file)
@@ -5224,7 +5224,7 @@ setup_constant_buffers(struct iris_context *ice,
       push_bos->buffers[n].length = range->length;
       push_bos->buffers[n].addr =
          res ? ro_bo(res->bo, range->start * 32 + cbuf->buffer_offset)
-         : ro_bo(batch->screen->workaround_bo, 0);
+         : batch->screen->workaround_address;
       n++;
    }
 
@@ -5971,7 +5971,8 @@ iris_upload_dirty_render_state(struct iris_context *ice,
           */
          iris_emit_pipe_control_write(batch, "WA for stencil state",
                                       PIPE_CONTROL_WRITE_IMMEDIATE,
-                                      batch->screen->workaround_bo, 0, 0);
+                                      batch->screen->workaround_address.bo,
+                                      batch->screen->workaround_address.offset, 0);
       }
 
       union isl_color_value clear_value = { .f32 = { 0, } };
@@ -6989,7 +6990,8 @@ iris_emit_raw_pipe_control(struct iris_batch *batch,
          flags |= PIPE_CONTROL_WRITE_IMMEDIATE;
          post_sync_flags |= PIPE_CONTROL_WRITE_IMMEDIATE;
          non_lri_post_sync_flags |= PIPE_CONTROL_WRITE_IMMEDIATE;
-         bo = batch->screen->workaround_bo;
+         bo = batch->screen->workaround_address.bo;
+         offset = batch->screen->workaround_address.offset;
       }
    }