diff options
author | Eric Anholt <[email protected]> | 2014-04-06 11:16:48 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2014-04-11 13:38:52 -0700 |
commit | 9a5d19d680323dfb9705c6c5ac10ac30d9ccc842 (patch) | |
tree | 9a3f561e3f1a8f40201b9225d22bc91053442135 /src/mesa | |
parent | 3f9440cfbb0b616b81ad9f03814ebab7e2b7b8c2 (diff) |
i965: Skip a bunch of IB BO refcount twiddling.
Improves cairo performance on glamor by 1.64828% +/- 1.04742% (n=65).
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_draw_upload.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index a579025508c..2b56cdedd1c 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -813,7 +813,7 @@ static void brw_upload_indices(struct brw_context *brw) struct gl_context *ctx = &brw->ctx; const struct _mesa_index_buffer *index_buffer = brw->ib.ib; GLuint ib_size; - drm_intel_bo *bo = NULL; + drm_intel_bo *old_bo = brw->ib.bo; struct gl_buffer_object *bufferobj; GLuint offset; GLuint ib_type_size; @@ -831,7 +831,7 @@ static void brw_upload_indices(struct brw_context *brw) /* Get new bufferobj, offset: */ intel_upload_data(brw, index_buffer->ptr, ib_size, ib_type_size, - &bo, &offset); + &brw->ib.bo, &offset); } else { offset = (GLuint) (unsigned long) index_buffer->ptr; @@ -849,13 +849,19 @@ static void brw_upload_indices(struct brw_context *brw) bufferobj, MAP_INTERNAL); - intel_upload_data(brw, map, ib_size, ib_type_size, &bo, &offset); + intel_upload_data(brw, map, ib_size, ib_type_size, + &brw->ib.bo, &offset); ctx->Driver.UnmapBuffer(ctx, bufferobj, MAP_INTERNAL); } else { - bo = intel_bufferobj_buffer(brw, intel_buffer_object(bufferobj), - offset, ib_size); - drm_intel_bo_reference(bo); + drm_intel_bo *bo = + intel_bufferobj_buffer(brw, intel_buffer_object(bufferobj), + offset, ib_size); + if (bo != brw->ib.bo) { + drm_intel_bo_unreference(brw->ib.bo); + brw->ib.bo = bo; + drm_intel_bo_reference(bo); + } } } @@ -865,14 +871,8 @@ static void brw_upload_indices(struct brw_context *brw) */ brw->ib.start_vertex_offset = offset / ib_type_size; - if (brw->ib.bo != bo) { - drm_intel_bo_unreference(brw->ib.bo); - brw->ib.bo = bo; - + if (brw->ib.bo != old_bo) brw->state.dirty.brw |= BRW_NEW_INDEX_BUFFER; - } else { - drm_intel_bo_unreference(bo); - } if (index_buffer->type != brw->ib.type) { brw->ib.type = index_buffer->type; |