Rather than have a seperate implementation that discards all of the execobjects for the rare event of destroying the context, recast it as an operation to reset to the saved state of no batch. --- src/mesa/drivers/dri/i965/intel_batchbuffer.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c index 59b142cc75..933812810a 100644 --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c @@ -208,17 +208,18 @@ intel_batchbuffer_reset_to_saved(struct brw_context *brw) void intel_batchbuffer_free(struct intel_batchbuffer *batch) { - free(batch->cpu_map); + struct brw_context *brw = container_of(batch, brw, batch); + + /* Clear out any references from a residual batch */ + memset(&batch->saved, 0, sizeof(batch->saved)); + intel_batchbuffer_reset_to_saved(brw); - for (int i = 0; i < batch->exec_count; i++) { - if (batch->exec_bos[i] != batch->bo) { - brw_bo_unreference(batch->exec_bos[i]); - } - } free(batch->relocs); free(batch->exec_bos); free(batch->exec_objects); + free(batch->cpu_map); + brw_bo_unreference(batch->last_bo); brw_bo_unreference(batch->bo); if (batch->state_batch_sizes) -- 2.13.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev