[Mesa-dev] [PATCH 11.4/16] i965: Remove brw_bo_map_unsynchronized()
Matt Turner
mattst88 at gmail.com
Thu Jun 1 04:44:21 UTC 2017
Call brw_bo_map() directly.
---
src/mesa/drivers/dri/i965/brw_bufmgr.c | 20 ------------------
src/mesa/drivers/dri/i965/brw_bufmgr.h | 1 -
src/mesa/drivers/dri/i965/brw_program_cache.c | 4 ++--
src/mesa/drivers/dri/i965/intel_buffer_objects.c | 27 +++++++-----------------
4 files changed, 10 insertions(+), 42 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c
index 15610db..9475d2b 100644
--- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
@@ -755,26 +755,6 @@ brw_bo_map_gtt(struct brw_context *brw, struct brw_bo *bo, unsigned flags)
return bo->map_gtt;
}
-/**
- * Performs a mapping of the buffer object like the normal GTT
- * mapping, but avoids waiting for the GPU to be done reading from or
- * rendering to the buffer.
- *
- * This is used in the implementation of GL_ARB_map_buffer_range: The
- * user asks to create a buffer, then does a mapping, fills some
- * space, runs a drawing command, then asks to map it again without
- * synchronizing because it guarantees that it won't write over the
- * data that the GPU is busy using (or, more specifically, that if it
- * does write over the data, it acknowledges that rendering is
- * undefined).
- */
-
-void *
-brw_bo_map_unsynchronized(struct brw_context *brw, struct brw_bo *bo)
-{
- return brw_bo_map_gtt(brw, bo, MAP_READ | MAP_WRITE | MAP_ASYNC);
-}
-
static bool
can_map_cpu(struct brw_bo *bo, unsigned flags)
{
diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.h b/src/mesa/drivers/dri/i965/brw_bufmgr.h
index 099afcf..a11599f 100644
--- a/src/mesa/drivers/dri/i965/brw_bufmgr.h
+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.h
@@ -262,7 +262,6 @@ struct brw_bo *brw_bo_gem_create_from_name(struct brw_bufmgr *bufmgr,
const char *name,
unsigned int handle);
void brw_bufmgr_enable_reuse(struct brw_bufmgr *bufmgr);
-MUST_CHECK void *brw_bo_map_unsynchronized(struct brw_context *brw, struct brw_bo *bo);
int brw_bo_wait(struct brw_bo *bo, int64_t timeout_ns);
diff --git a/src/mesa/drivers/dri/i965/brw_program_cache.c b/src/mesa/drivers/dri/i965/brw_program_cache.c
index ab03969..2fd989a 100644
--- a/src/mesa/drivers/dri/i965/brw_program_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_program_cache.c
@@ -220,7 +220,7 @@ brw_cache_new_bo(struct brw_cache *cache, uint32_t new_size)
if (can_do_exec_capture(brw->screen))
new_bo->kflags = EXEC_OBJECT_CAPTURE;
if (brw->has_llc)
- llc_map = brw_bo_map_unsynchronized(brw, new_bo);
+ llc_map = brw_bo_map(brw, new_bo, MAP_READ | MAP_ASYNC);
/* Copy any existing data that needs to be saved. */
if (cache->next_offset != 0) {
@@ -417,7 +417,7 @@ brw_init_caches(struct brw_context *brw)
if (can_do_exec_capture(brw->screen))
cache->bo->kflags = EXEC_OBJECT_CAPTURE;
if (brw->has_llc)
- cache->map = brw_bo_map_unsynchronized(brw, cache->bo);
+ cache->map = brw_bo_map(brw, cache->bo, MAP_READ | MAP_WRITE | MAP_ASYNC);
}
static void
diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
index 5813989..a9ac29a 100644
--- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
@@ -216,17 +216,13 @@ brw_buffer_subdata(struct gl_context *ctx,
*/
if (offset + size <= intel_obj->gpu_active_start ||
intel_obj->gpu_active_end <= offset) {
- if (brw->has_llc) {
- void *map = brw_bo_map_unsynchronized(brw, intel_obj->buffer);
- memcpy(map + offset, data, size);
- brw_bo_unmap(intel_obj->buffer);
+ void *map = brw_bo_map(brw, intel_obj->buffer, MAP_WRITE | MAP_ASYNC);
+ memcpy(map + offset, data, size);
+ brw_bo_unmap(intel_obj->buffer);
- if (intel_obj->gpu_active_end > intel_obj->gpu_active_start)
- intel_obj->prefer_stall_to_blit = true;
- return;
- } else {
- perf_debug("BufferSubData could be unsynchronized, but !LLC doesn't support it yet\n");
- }
+ if (intel_obj->gpu_active_end > intel_obj->gpu_active_start)
+ intel_obj->prefer_stall_to_blit = true;
+ return;
}
busy =
@@ -400,15 +396,8 @@ brw_map_buffer_range(struct gl_context *ctx,
return obj->Mappings[index].Pointer;
}
- void *map;
- if (access & GL_MAP_UNSYNCHRONIZED_BIT) {
- if (!brw->has_llc && brw->perf_debug &&
- brw_bo_busy(intel_obj->buffer)) {
- perf_debug("MapBufferRange with GL_MAP_UNSYNCHRONIZED_BIT stalling (it's actually synchronized on non-LLC platforms)\n");
- }
- map = brw_bo_map_unsynchronized(brw, intel_obj->buffer);
- } else {
- map = brw_bo_map(brw, intel_obj->buffer, access);
+ void *map = brw_bo_map(brw, intel_obj->buffer, access);
+ if (!(access & GL_MAP_UNSYNCHRONIZED_BIT)) {
mark_buffer_inactive(intel_obj);
}
--
2.10.2
More information about the mesa-dev
mailing list