[Mesa-dev] [PATCH 3/4] i965: Use async maps for BufferSubData to regions with no valid data.

Kenneth Graunke kenneth at whitecape.org
Tue Jun 13 00:33:31 UTC 2017


When writing a region of a buffer via glBufferSubData(), we can write
the data asynchronously if the destination doesn't contain any data.
Even if it's busy, the data was undefined, so the new data is fine too.

Decreases the number of stall avoidance blits in Manhattan 3.1:
- Skylake GT4: -18.3544% +/- 6.76483% (n=13)
- Apollolake:  -12.1095% +/- 5.24458% (n=13)
---
 src/mesa/drivers/dri/i965/intel_buffer_objects.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
index fac6c7564da..09c18db1afe 100644
--- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
@@ -233,7 +233,9 @@ brw_buffer_subdata(struct gl_context *ctx,
     * up with blitting all the time, at the cost of bandwidth)
     */
    if (offset + size <= intel_obj->gpu_active_start ||
-       intel_obj->gpu_active_end <= offset) {
+       intel_obj->gpu_active_end <= offset ||
+       offset + size <= intel_obj->valid_data_start ||
+       intel_obj->valid_data_end <= offset) {
       void *map = brw_bo_map(brw, intel_obj->buffer, MAP_WRITE | MAP_ASYNC);
       memcpy(map + offset, data, size);
       brw_bo_unmap(intel_obj->buffer);
-- 
2.13.1



More information about the mesa-dev mailing list