[Mesa-dev] [PATCH 28/51] i965: Pass can-use-active flag to brw_bo_create()
Chris Wilson
chris at chris-wilson.co.uk
Tue Jan 10 21:23:51 UTC 2017
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_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 ++-
6 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_binding_tables.c b/src/mesa/drivers/dri/i965/brw_binding_tables.c
index 02d053e072..1a0c0b128e 100644
--- a/src/mesa/drivers/dri/i965/brw_binding_tables.c
+++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c
@@ -385,7 +385,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_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 5aa0c8d2ec..97ac270248 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -391,7 +391,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 1bf3416fe5..eacee61d29 100644
--- a/src/mesa/drivers/dri/i965/brw_queryobj.c
+++ b/src/mesa/drivers/dri/i965/brw_queryobj.c
@@ -233,7 +233,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;
@@ -391,7 +392,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;
}
}
@@ -477,7 +479,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 82b8baee79..4640b11566 100644
--- a/src/mesa/drivers/dri/i965/gen6_queryobj.c
+++ b/src/mesa/drivers/dri/i965/gen6_queryobj.c
@@ -277,7 +277,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);
/* For ARB_query_buffer_object: The result is not available */
set_query_availability(brw, query, false);
diff --git a/src/mesa/drivers/dri/i965/gen6_sol.c b/src/mesa/drivers/dri/i965/gen6_sol.c
index 7aac697915..9426b8eb47 100644
--- a/src/mesa/drivers/dri/i965/gen6_sol.c
+++ b/src/mesa/drivers/dri/i965/gen6_sol.c
@@ -195,9 +195,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 e8f94aa65d..3aeb822acf 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -649,7 +649,8 @@ 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 {
if (format == MESA_FORMAT_S_UINT8) {
/* Align to size of W tile, 64x64. */
--
2.11.0
More information about the mesa-dev
mailing list