i965: store workaround_bo offset
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fri, 21 Feb 2020 16:12:50 +0000 (18:12 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 20 May 2020 15:58:22 +0000 (15:58 +0000)
This offset store the location where we read/write into the
workaround_bo. It 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/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_pipe_control.c
src/mesa/drivers/dri/i965/genX_blorp_exec.c
src/mesa/drivers/dri/i965/genX_pipe_control.c

index d3755eb2e4b699506cedb6a9cd0c6bd8d5ace647..96b7edd3f758e02e3c79690b5cf16f8853b838d4 100644 (file)
@@ -725,6 +725,7 @@ struct brw_context
 
    /** BO for post-sync nonzero writes for gen6 workaround. */
    struct brw_bo *workaround_bo;
+   uint32_t workaround_bo_offset;
    uint8_t pipe_controls_since_last_cs_stall;
 
    /**
index 95fb86bd616ed0a2ca1294a83450dc05bebe3be5..dbeb0acc20e2aa61b0198e50a5bec36f519a0581 100644 (file)
@@ -124,7 +124,8 @@ gen7_emit_vs_workaround_flush(struct brw_context *brw)
    brw_emit_pipe_control_write(brw,
                                PIPE_CONTROL_WRITE_IMMEDIATE
                                | PIPE_CONTROL_DEPTH_STALL,
-                               brw->workaround_bo, 0, 0);
+                               brw->workaround_bo,
+                               brw->workaround_bo_offset, 0);
 }
 
 /**
@@ -192,7 +193,8 @@ gen7_emit_cs_stall_flush(struct brw_context *brw)
    brw_emit_pipe_control_write(brw,
                                PIPE_CONTROL_CS_STALL
                                | PIPE_CONTROL_WRITE_IMMEDIATE,
-                               brw->workaround_bo, 0, 0);
+                               brw->workaround_bo,
+                               brw->workaround_bo_offset, 0);
 }
 
 /**
@@ -240,7 +242,8 @@ brw_emit_post_sync_nonzero_flush(struct brw_context *brw)
                                PIPE_CONTROL_STALL_AT_SCOREBOARD);
 
    brw_emit_pipe_control_write(brw, PIPE_CONTROL_WRITE_IMMEDIATE,
-                               brw->workaround_bo, 0, 0);
+                               brw->workaround_bo,
+                               brw->workaround_bo_offset, 0);
 }
 
 /*
@@ -298,7 +301,8 @@ brw_emit_end_of_pipe_sync(struct brw_context *brw, uint32_t flags)
       brw_emit_pipe_control_write(brw,
                                   flags | PIPE_CONTROL_CS_STALL |
                                   PIPE_CONTROL_WRITE_IMMEDIATE,
-                                  brw->workaround_bo, 0, 0);
+                                  brw->workaround_bo,
+                                  brw->workaround_bo_offset, 0);
 
       if (devinfo->is_haswell) {
          /* Haswell needs addition work-arounds:
@@ -335,7 +339,7 @@ brw_emit_end_of_pipe_sync(struct brw_context *brw, uint32_t flags)
           * 3DPRIMITIVE when needed anyway.
           */
          brw_load_register_mem(brw, GEN7_3DPRIM_START_INSTANCE,
-                               brw->workaround_bo, 0);
+                               brw->workaround_bo, brw->workaround_bo_offset);
       }
    } else {
       /* On gen4-5, a regular pipe control seems to suffice. */
@@ -414,6 +418,7 @@ brw_init_pipe_control(struct brw_context *brw,
    if (brw->workaround_bo == NULL)
       return -ENOMEM;
 
+   brw->workaround_bo_offset = 0;
    brw->pipe_controls_since_last_cs_stall = 0;
 
    return 0;
index 1889cdd83366af05a91e361f79bf30a51497e9a7..219ac585399dfb22061a01374b194b11a0a51a12 100644 (file)
@@ -239,6 +239,7 @@ blorp_get_workaround_address(struct blorp_batch *batch)
 
    return (struct blorp_address) {
       .buffer = brw->workaround_bo,
+      .offset = brw->workaround_bo_offset,
    };
 }
 
index 35a99fa4c28b62ea1a982146dc659f790a08f723..3582df4d66db012af9dcf6a40fbdddb7919915f9 100644 (file)
@@ -147,6 +147,7 @@ genX(emit_raw_pipe_control)(struct brw_context *brw, uint32_t flags,
          post_sync_flags |= PIPE_CONTROL_WRITE_IMMEDIATE;
          non_lri_post_sync_flags |= PIPE_CONTROL_WRITE_IMMEDIATE;
          bo = brw->workaround_bo;
+         offset = brw->workaround_bo_offset;
       }
    }