From 2793d689cd1e6599403baf7e90c1db97e785c9d5 Mon Sep 17 00:00:00 2001 From: Juha-Pekka Heikkilä Date: Mon, 21 Oct 2013 15:56:31 -0700 Subject: Fix corner case from AMD_performance_monitor If between BeginPerfMonitorAMD and EndPerfMonitorAMD there is nothing causing batch buffer flushing EndPerfMonitorAMD would hit extension's internal assert. This patch fix that problem. --- src/mesa/drivers/dri/i965/brw_performance_monitor.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_performance_monitor.c b/src/mesa/drivers/dri/i965/brw_performance_monitor.c index deccd6d971..1687fd1819 100644 --- a/src/mesa/drivers/dri/i965/brw_performance_monitor.c +++ b/src/mesa/drivers/dri/i965/brw_performance_monitor.c @@ -546,6 +546,10 @@ brw_end_perf_monitor(struct gl_context *ctx, struct brw_context *brw = brw_context(ctx); struct brw_perf_monitor_object *monitor = brw_perf_monitor(m); if (aggregating_counters_needed(brw, m)) { + if (drm_intel_bo_references(brw->batch.bo, monitor->bo)) { + intel_batchbuffer_flush(brw); + } + snapshot_aggregating_counters(brw, monitor->bo, SECOND_SNAPSHOT_OFFSET_IN_BYTES); stop_aggregating_counters(brw); -- cgit v1.2.3