i965: Make/use a brw_batch_references() wrapper.

We'll want to change the implementation of this shortly.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Kenneth Graunke
2017-03-28 16:49:35 -07:00
parent 6537a3ca11
commit 6079f4f16e
11 changed files with 21 additions and 14 deletions
@@ -1132,7 +1132,7 @@ brw_wait_perf_query(struct gl_context *ctx, struct gl_perf_query_object *o)
/* If the current batch references our results bo then we need to
* flush first...
*/
if (drm_bacon_bo_references(brw->batch.bo, bo))
if (brw_batch_references(&brw->batch, bo))
intel_batchbuffer_flush(brw);
if (unlikely(brw->perf_debug)) {
@@ -1157,12 +1157,12 @@ brw_is_perf_query_ready(struct gl_context *ctx,
case OA_COUNTERS:
return (obj->oa.results_accumulated ||
(obj->oa.bo &&
!drm_bacon_bo_references(brw->batch.bo, obj->oa.bo) &&
!brw_batch_references(&brw->batch, obj->oa.bo) &&
!drm_bacon_bo_busy(obj->oa.bo)));
case PIPELINE_STATS:
return (obj->pipeline_stats.bo &&
!drm_bacon_bo_references(brw->batch.bo, obj->pipeline_stats.bo) &&
!brw_batch_references(&brw->batch, obj->pipeline_stats.bo) &&
!drm_bacon_bo_busy(obj->pipeline_stats.bo));
}
+2 -2
View File
@@ -137,7 +137,7 @@ brw_queryobj_get_results(struct gl_context *ctx,
* still contributing to it, flush it now so the results will be present
* when mapped.
*/
if (drm_bacon_bo_references(brw->batch.bo, query->bo))
if (brw_batch_references(&brw->batch, query->bo))
intel_batchbuffer_flush(brw);
if (unlikely(brw->perf_debug)) {
@@ -402,7 +402,7 @@ static void brw_check_query(struct gl_context *ctx, struct gl_query_object *q)
* not ready yet on the first time it is queried. This ensures that
* the async query will return true in finite time.
*/
if (query->bo && drm_bacon_bo_references(brw->batch.bo, query->bo))
if (query->bo && brw_batch_references(&brw->batch, query->bo))
intel_batchbuffer_flush(brw);
if (query->bo == NULL || !drm_bacon_bo_busy(query->bo)) {
+1 -1
View File
@@ -467,7 +467,7 @@ flush_batch_if_needed(struct brw_context *brw, struct brw_query_object *query)
* (for example, due to being full). Record that it's been flushed.
*/
query->flushed = query->flushed ||
!drm_bacon_bo_references(brw->batch.bo, query->bo);
!brw_batch_references(&brw->batch, query->bo);
if (!query->flushed)
intel_batchbuffer_flush(brw);
+1 -1
View File
@@ -241,7 +241,7 @@ tally_prims_generated(struct brw_context *brw,
/* If the current batch is still contributing to the number of primitives
* generated, flush it now so the results will be present when mapped.
*/
if (drm_bacon_bo_references(brw->batch.bo, obj->prim_count_bo))
if (brw_batch_references(&brw->batch, obj->prim_count_bo))
intel_batchbuffer_flush(brw);
if (unlikely(brw->perf_debug && drm_bacon_bo_busy(obj->prim_count_bo)))
@@ -576,6 +576,11 @@ _intel_batchbuffer_flush_fence(struct brw_context *brw,
return ret;
}
bool
brw_batch_references(struct intel_batchbuffer *batch, drm_bacon_bo *bo)
{
return drm_bacon_bo_references(batch->bo, bo);
}
/* This is the only way buffers get added to the validate list.
*/
@@ -65,6 +65,8 @@ void intel_batchbuffer_data(struct brw_context *brw,
const void *data, GLuint bytes,
enum brw_gpu_ring ring);
bool brw_batch_references(struct intel_batchbuffer *batch, drm_bacon_bo *bo);
uint64_t brw_emit_reloc(struct intel_batchbuffer *batch, uint32_t batch_offset,
drm_bacon_bo *target, uint32_t target_offset,
uint32_t read_domains, uint32_t write_domain);
@@ -271,7 +271,7 @@ brw_buffer_subdata(struct gl_context *ctx,
busy =
drm_bacon_bo_busy(intel_obj->buffer) ||
drm_bacon_bo_references(brw->batch.bo, intel_obj->buffer);
brw_batch_references(&brw->batch, intel_obj->buffer);
if (busy) {
if (size == intel_obj->Base.Size) {
@@ -330,7 +330,7 @@ brw_get_buffer_subdata(struct gl_context *ctx,
struct brw_context *brw = brw_context(ctx);
assert(intel_obj);
if (drm_bacon_bo_references(brw->batch.bo, intel_obj->buffer)) {
if (brw_batch_references(&brw->batch, intel_obj->buffer)) {
intel_batchbuffer_flush(brw);
}
drm_bacon_bo_get_subdata(intel_obj->buffer, offset, size, data);
@@ -389,7 +389,7 @@ brw_map_buffer_range(struct gl_context *ctx,
* achieve the required synchronization.
*/
if (!(access & GL_MAP_UNSYNCHRONIZED_BIT)) {
if (drm_bacon_bo_references(brw->batch.bo, intel_obj->buffer)) {
if (brw_batch_references(&brw->batch, intel_obj->buffer)) {
if (access & GL_MAP_INVALIDATE_BUFFER_BIT) {
drm_bacon_bo_unreference(intel_obj->buffer);
alloc_buffer_object(brw, intel_obj);
@@ -2457,7 +2457,7 @@ intel_miptree_map_raw(struct brw_context *brw, struct intel_mipmap_tree *mt)
drm_bacon_bo *bo = mt->bo;
if (drm_bacon_bo_references(brw->batch.bo, bo))
if (brw_batch_references(&brw->batch, bo))
intel_batchbuffer_flush(brw);
/* brw_bo_map() uses a WB mmaping of the buffer's backing storage. It
+1 -1
View File
@@ -142,7 +142,7 @@ intel_readpixels_tiled_memcpy(struct gl_context * ctx,
bo = irb->mt->bo;
if (drm_bacon_bo_references(brw->batch.bo, bo)) {
if (brw_batch_references(&brw->batch, bo)) {
perf_debug("Flushing before mapping a referenced bo.\n");
intel_batchbuffer_flush(brw);
}
+1 -1
View File
@@ -527,7 +527,7 @@ intel_gettexsubimage_tiled_memcpy(struct gl_context *ctx,
bo = image->mt->bo;
if (drm_bacon_bo_references(brw->batch.bo, bo)) {
if (brw_batch_references(&brw->batch, bo)) {
perf_debug("Flushing before mapping a referenced bo.\n");
intel_batchbuffer_flush(brw);
}
@@ -143,7 +143,7 @@ intel_texsubimage_tiled_memcpy(struct gl_context * ctx,
bo = image->mt->bo;
if (drm_bacon_bo_references(brw->batch.bo, bo)) {
if (brw_batch_references(&brw->batch, bo)) {
perf_debug("Flushing before mapping a referenced bo.\n");
intel_batchbuffer_flush(brw);
}