iris: Report use of any in-flight buffers on first draw call after sync boundary.
authorFrancisco Jerez <currojerez@riseup.net>
Fri, 7 Feb 2020 05:06:17 +0000 (21:06 -0800)
committerMarge Bot <eric+marge@anholt.net>
Wed, 3 Jun 2020 23:12:22 +0000 (23:12 +0000)
This is the main performance trade-off of this cache tracking
mechanism: In order for the seqno vector of buffer objects to be
accurate, they need to be marked as used again every time the batch is
split into a new synchronization section if they remain bound to the
pipeline.  This can be achieved easily by re-using
iris_restore_render_saved_bos() and iris_restore_compute_saved_bos(),
which currently serve a similar purpose across batch buffer
boundaries.

The impact on Piglit drawoverhead results seems to be within a
standard deviation of the current results.

XXX - It might be possible to completely remove the current
      iris_batch::contains_draw flag at a small additional performance
      cost.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

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

index bfea20d268cc66d9c25f49eccd55f716ad2f1ef7..00f62f2fb6f41485746d1c868e4b08c6315bfcc1 100644 (file)
@@ -153,6 +153,9 @@ struct iris_batch {
    /** Have we emitted any draw calls to this batch? */
    bool contains_draw;
 
+   /** Have we emitted any draw calls with next_seqno? */
+   bool contains_draw_with_next_seqno;
+
    /**
     * Number of times iris_batch_sync_region_start() has been called without a
     * matching iris_batch_sync_region_end() on this batch.
@@ -304,6 +307,7 @@ static inline void
 iris_batch_sync_boundary(struct iris_batch *batch)
 {
    if (!batch->sync_region_depth) {
+      batch->contains_draw_with_next_seqno = false;
       batch->next_seqno = p_atomic_inc_return(&batch->screen->last_seqno);
       assert(batch->next_seqno > 0);
    }
index 786a188746e53d0d4e3d1edc4d7286910117bc84..5c8921b704f0048a250040f4d75455bbc65b3781 100644 (file)
@@ -6362,9 +6362,9 @@ iris_upload_render_state(struct iris_context *ice,
    iris_use_pinned_bo(batch, ice->state.binder.bo, false,
                       IRIS_DOMAIN_NONE);
 
-   if (!batch->contains_draw) {
+   if (!batch->contains_draw_with_next_seqno) {
       iris_restore_render_saved_bos(ice, batch, draw);
-      batch->contains_draw = true;
+      batch->contains_draw_with_next_seqno = batch->contains_draw = true;
    }
 
    iris_upload_dirty_render_state(ice, batch, draw);
@@ -6744,9 +6744,9 @@ iris_upload_compute_state(struct iris_context *ice,
 
    iris_emit_cmd(batch, GENX(MEDIA_STATE_FLUSH), msf);
 
-   if (!batch->contains_draw) {
+   if (!batch->contains_draw_with_next_seqno) {
       iris_restore_compute_saved_bos(ice, batch, grid);
-      batch->contains_draw = true;
+      batch->contains_draw_with_next_seqno = batch->contains_draw = true;
    }
 
    iris_batch_sync_region_end(batch);