iris: Track valid data range and infer unsynchronized mappings.

Applications frequently call glBufferSubData() to consecutive regions
of a VBO to append new vertex data.  If no data exists there yet, we
can promote these to unsynchronized writes, even if the buffer is busy,
since the GPU can't be doing anything useful with undefined content.
This can avoid a bunch of unnecessary blitting on the GPU.

u_threaded_context would do this for us, and in fact prohibits us from
doing so (see TC_TRANSFER_MAP_NO_INFER_UNSYNCHRONIZED).  But we haven't
hooked that up yet, and it may be useful to disable u_threaded_context
when debugging...at which point we'd still want this optimization.  At
the very least, it would let us measure the benefit of threading
independently from this optimization.  And it's not a lot of code.

Removes most stall avoidance blits in "Total War: WARHAMMER."

On my Skylake GT4e at 1920x1080, this appears to improve performance
in games by the following (but I did not do many runs for proper
statistics gathering):

   ----------------------------------------------
   | DiRT Rally        | +2% (avg) | + 2% (max) |
   | Bioshock Infinite | +3% (avg) | + 9% (max) |
   | Shadow of Mordor  | +7% (avg) | +20% (max) |
   ----------------------------------------------
This commit is contained in:
Kenneth Graunke
2019-04-05 11:54:10 -07:00
parent 768b17a7ad
commit 77449d7c41
5 changed files with 78 additions and 0 deletions

View File

@@ -25,6 +25,7 @@
#include "pipe/p_state.h"
#include "util/u_inlines.h"
#include "util/u_range.h"
#include "intel/isl/isl.h"
struct iris_batch;
@@ -73,6 +74,16 @@ struct iris_resource {
*/
unsigned bind_history;
/**
* For PIPE_BUFFER resources, a range which may contain valid data.
*
* This is a conservative estimate of what part of the buffer contains
* valid data that we have to preserve. The rest of the buffer is
* considered invalid, and we can promote writes to that region to
* be unsynchronized writes, avoiding blit copies.
*/
struct util_range valid_buffer_range;
/**
* Auxiliary buffer information (CCS, MCS, or HiZ).
*/