[Mesa-dev] [PATCH 5/6] i965: Always flush caches after blitting to a GL buffer object.
Kenneth Graunke
kenneth at whitecape.org
Tue Aug 29 21:28:42 UTC 2017
When we blit data into a buffer object, we may need to invalidate any
caches that might contain stale data, so the new data becomes visible.
For example, if the buffer object is bound as a vertex buffer, we need
to invalidate the vertex fetch cache.
While this flushing was missing, it usually happened implicitly for
non-obvious reasons: we're usually on the render ring, and calling
intel_emit_linear_blit() would require switching to the BLT ring,
causing an implicit flush. This likely provoked the kernel to do
PIPE_CONTROLs on our behalf. Although, Gen4-5 wouldn't have this
behavior. At any rate, we should do it ourselves.
---
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 dd6fca12d0b..01443c2b7fc 100644
--- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
@@ -298,6 +298,7 @@ brw_buffer_subdata(struct gl_context *ctx,
intel_obj->buffer, offset,
temp_bo, 0,
size);
+ brw_emit_mi_flush(brw);
brw_bo_unreference(temp_bo);
mark_buffer_valid_data(intel_obj, offset, size);
@@ -541,6 +542,7 @@ brw_flush_mapped_buffer_range(struct gl_context *ctx,
mark_buffer_gpu_usage(intel_obj,
obj->Mappings[index].Offset + offset,
length);
+ brw_emit_mi_flush(brw);
}
@@ -570,6 +572,7 @@ brw_unmap_buffer(struct gl_context *ctx,
obj->Mappings[index].Length);
mark_buffer_gpu_usage(intel_obj, obj->Mappings[index].Offset,
obj->Mappings[index].Length);
+ brw_emit_mi_flush(brw);
}
/* Since we've emitted some blits to buffers that will (likely) be used
@@ -577,7 +580,6 @@ brw_unmap_buffer(struct gl_context *ctx,
* flush. Once again, we wish for a domain tracker in libdrm to cover
* usage inside of a batchbuffer.
*/
- brw_emit_mi_flush(brw);
brw_bo_unreference(intel_obj->range_map_bo[index]);
intel_obj->range_map_bo[index] = NULL;
--
2.14.1
More information about the mesa-dev
mailing list