[Mesa-dev] [PATCH 30/70] i965: Pass can-use-active flag to brw_bo_create()
Chris Wilson
chris at chris-wilson.co.uk
Fri Aug 7 13:13:34 PDT 2015
The introduction of brw_bo_create() allows us to pass a new flag down
when creating a linear buffer to allow the allocator to return a
currently active buffer. (Previously all linear buffers were presumed to
be allocated for CPU access and so the allocator only returned an idle
buffer.)
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
src/mesa/drivers/dri/i965/brw_binding_tables.c | 3 ++-
src/mesa/drivers/dri/i965/brw_performance_monitor.c | 15 +++++++++++----
src/mesa/drivers/dri/i965/brw_program.c | 2 +-
src/mesa/drivers/dri/i965/brw_queryobj.c | 9 ++++++---
src/mesa/drivers/dri/i965/gen6_queryobj.c | 3 ++-
src/mesa/drivers/dri/i965/gen6_sol.c | 6 ++++--
src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 3 ++-
7 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_binding_tables.c b/src/mesa/drivers/dri/i965/brw_binding_tables.c
index 1deed23..a1afdc2 100644
--- a/src/mesa/drivers/dri/i965/brw_binding_tables.c
+++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c
@@ -328,7 +328,8 @@ gen7_enable_hw_binding_tables(struct brw_context *brw)
* "A maximum of 16,383 Binding tables are allowed in any batch buffer"
*/
static const int max_size = 16383 * 4;
- brw->hw_bt_pool.bo = brw_bo_create(&brw->batch, "hw_bt", max_size, 64, 0);
+ brw->hw_bt_pool.bo =
+ brw_bo_create(&brw->batch, "hw_bt", max_size, 64, BO_ALLOC_FOR_RENDER);
brw->hw_bt_pool.next_offset = 0;
}
diff --git a/src/mesa/drivers/dri/i965/brw_performance_monitor.c b/src/mesa/drivers/dri/i965/brw_performance_monitor.c
index 4d54fa2..3168613 100644
--- a/src/mesa/drivers/dri/i965/brw_performance_monitor.c
+++ b/src/mesa/drivers/dri/i965/brw_performance_monitor.c
@@ -1081,6 +1081,12 @@ reinitialize_perf_monitor(struct brw_context *brw,
monitor->pipeline_stats_results = NULL;
}
+#ifdef DEBUG
+#define DBG_BO_ALLOC_FLAG 0
+#else
+#define DBG_BO_ALLOC_FLAG BO_ALLOC_FOR_RENDER
+#endif
+
/**
* Driver hook for glBeginPerformanceMonitorAMD().
*/
@@ -1094,7 +1100,6 @@ brw_begin_perf_monitor(struct gl_context *ctx,
DBG("Begin(%d)\n", m->Name);
reinitialize_perf_monitor(brw, monitor);
-
if (monitor_needs_oa(brw, m)) {
/* If the global OA bookend BO doesn't exist, allocate it. This should
* only happen once, but we delay until BeginPerfMonitor time to avoid
@@ -1102,11 +1107,12 @@ brw_begin_perf_monitor(struct gl_context *ctx,
*/
if (!brw->perfmon.bookend_bo) {
brw->perfmon.bookend_bo = brw_bo_create(&brw->batch, "OA bookend BO",
- BOOKEND_BO_SIZE_BYTES, 64, 0);
+ BOOKEND_BO_SIZE_BYTES, 64,
+ DBG_BO_ALLOC_FLAG);
}
monitor->oa_bo = brw_bo_create(&brw->batch, "perf. monitor OA bo",
- 4096, 64, 0);
+ 4096, 64, DBG_BO_ALLOC_FLAG);
#ifdef DEBUG
/* Pre-filling the BO helps debug whether writes landed. */
drm_intel_bo_map(monitor->oa_bo, true);
@@ -1141,7 +1147,8 @@ brw_begin_perf_monitor(struct gl_context *ctx,
if (monitor_needs_statistics_registers(brw, m)) {
monitor->pipeline_stats_bo =
- brw_bo_create(&brw->batch, "perf. monitor stats bo", 4096, 64, 0);
+ brw_bo_create(&brw->batch, "perf. monitor stats bo",
+ 4096, 64, BO_ALLOC_FOR_RENDER);
/* Take starting snapshots. */
snapshot_statistics_registers(brw, monitor, 0);
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 22abea7..cd9cfc6 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -301,7 +301,7 @@ brw_init_shader_time(struct brw_context *brw)
const int max_entries = 2048;
brw->shader_time.bo = brw_bo_create(&brw->batch, "shader time",
max_entries * SHADER_TIME_STRIDE * 3,
- 4096, 0);
+ 4096, BO_ALLOC_FOR_RENDER);
brw->shader_time.names = rzalloc_array(brw, const char *, max_entries);
brw->shader_time.ids = rzalloc_array(brw, int, max_entries);
brw->shader_time.types = rzalloc_array(brw, enum shader_time_shader_type,
diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c
index 29ec56a..51ba2d6 100644
--- a/src/mesa/drivers/dri/i965/brw_queryobj.c
+++ b/src/mesa/drivers/dri/i965/brw_queryobj.c
@@ -236,7 +236,8 @@ brw_begin_query(struct gl_context *ctx, struct gl_query_object *q)
* the system was doing other work, such as running other applications.
*/
brw_bo_put(query->bo);
- query->bo = brw_bo_create(&brw->batch, "timer query", 4096, 4096, 0);
+ query->bo = brw_bo_create(&brw->batch, "timer query",
+ 4096, 4096, BO_ALLOC_FOR_RENDER);
brw_write_timestamp(brw, query->bo, 0);
break;
@@ -394,7 +395,8 @@ ensure_bo_has_space(struct gl_context *ctx, struct brw_query_object *query)
brw_queryobj_get_results(ctx, query);
}
- query->bo = brw_bo_create(&brw->batch, "query", 4096, 0, 0);
+ query->bo = brw_bo_create(&brw->batch, "query",
+ 4096, 0, BO_ALLOC_FOR_RENDER);
query->last_index = 0;
}
}
@@ -480,7 +482,8 @@ brw_query_counter(struct gl_context *ctx, struct gl_query_object *q)
assert(q->Target == GL_TIMESTAMP);
brw_bo_put(query->bo);
- query->bo = brw_bo_create(&brw->batch, "timestamp query", 4096, 4096, 0);
+ query->bo = brw_bo_create(&brw->batch, "timestamp query",
+ 4096, 4096, BO_ALLOC_FOR_RENDER);
brw_write_timestamp(brw, query->bo, 0);
query->flushed = false;
diff --git a/src/mesa/drivers/dri/i965/gen6_queryobj.c b/src/mesa/drivers/dri/i965/gen6_queryobj.c
index 23b9514..dfacfbd 100644
--- a/src/mesa/drivers/dri/i965/gen6_queryobj.c
+++ b/src/mesa/drivers/dri/i965/gen6_queryobj.c
@@ -279,7 +279,8 @@ gen6_begin_query(struct gl_context *ctx, struct gl_query_object *q)
/* Since we're starting a new query, we need to throw away old results. */
brw_bo_put(query->bo);
- query->bo = brw_bo_create(&brw->batch, "query results", 4096, 4096, 0);
+ query->bo = brw_bo_create(&brw->batch, "query results",
+ 4096, 4096, BO_ALLOC_FOR_RENDER);
switch (query->Base.Target) {
case GL_TIME_ELAPSED:
diff --git a/src/mesa/drivers/dri/i965/gen6_sol.c b/src/mesa/drivers/dri/i965/gen6_sol.c
index 0a27d9e..99db3d8 100644
--- a/src/mesa/drivers/dri/i965/gen6_sol.c
+++ b/src/mesa/drivers/dri/i965/gen6_sol.c
@@ -204,9 +204,11 @@ brw_new_transform_feedback(struct gl_context *ctx, GLuint name)
_mesa_init_transform_feedback_object(&brw_obj->base, name);
brw_obj->offset_bo =
- brw_bo_create(&brw->batch, "transform feedback offsets", 4096, 64, 0);
+ brw_bo_create(&brw->batch, "transform feedback offsets",
+ 4096, 64, BO_ALLOC_FOR_RENDER);
brw_obj->prim_count_bo =
- brw_bo_create(&brw->batch, "xfb primitive counts", 4096, 64, 0);
+ brw_bo_create(&brw->batch, "xfb primitive counts",
+ 4096, 64, BO_ALLOC_FOR_RENDER);
return &brw_obj->base;
}
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index e7e6a02..17c5f33 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -668,7 +668,8 @@ intel_miptree_create(struct brw_context *brw,
uint64_t size;
size = intel_get_yf_ys_bo_size(mt, &alignment, &pitch);
assert(size);
- mt->bo = brw_bo_create(&brw->batch, "miptree", size, alignment, 0);
+ mt->bo = brw_bo_create(&brw->batch, "miptree",
+ size, alignment, alloc_flags);
} else {
mt->bo = brw_bo_create_tiled(&brw->batch, "miptree",
total_width, total_height, mt->cpp,
--
2.5.0
More information about the mesa-dev
mailing list