From bb73cf9ec093d734cbed956d843ef6c2982141ef Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 15 Jan 2008 10:23:15 -0500 Subject: [i915] Prevent recursive batchbuffer flushing. Workaround for recursive batchbuffer flushing: If the window is moved, we can get into a case where we try to flush during a flush. What happens is that when we try to grab the lock for the first flush, we detect that the window moved which then causes another flush (from the intel_draw_buffer() call in intelUpdatePageFlipping()). To work around this we reset the batchbuffer tail pointer before trying to get the lock. This prevent the nested buffer flush, but a better fix would be to avoid that in the first place. --- src/mesa/drivers/dri/intel/intel_batchbuffer.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index cff15d253d..d6cd4ca6c7 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -216,6 +216,17 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file, used += 8; } + /* Workaround for recursive batchbuffer flushing: If the window is + * moved, we can get into a case where we try to flush during a + * flush. What happens is that when we try to grab the lock for + * the first flush, we detect that the window moved which then + * causes another flush (from the intel_draw_buffer() call in + * intelUpdatePageFlipping()). To work around this we reset the + * batchbuffer tail pointer before trying to get the lock. This + * prevent the nested buffer flush, but a better fix would be to + * avoid that in the first place. */ + batch->ptr = batch->map; + /* TODO: Just pass the relocation list and dma buffer up to the * kernel. */ -- cgit v1.2.3