From 5bd022739511104e4978bdfd2f4a1f60b9206723 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 14 May 2010 15:47:09 +0100 Subject: [PATCH] i830: Teardown batch entries on reset. By not cleaning up the batch entries when resetting the X server, we left the pointers in an inconsistent state and caused X to crash. --- src/i830_batchbuffer.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/i830_batchbuffer.c b/src/i830_batchbuffer.c index 492472e7..6481384e 100644 --- a/src/i830_batchbuffer.c +++ b/src/i830_batchbuffer.c @@ -89,6 +89,40 @@ void intel_batch_teardown(ScrnInfoPtr scrn) dri_bo_unreference(intel->last_batch_bo); intel->last_batch_bo = NULL; } + + while (!list_is_empty(&intel->batch_pixmaps)) { + struct intel_pixmap *entry; + + entry = list_first_entry(&intel->batch_pixmaps, + struct intel_pixmap, + batch); + + entry->batch_read_domains = entry->batch_write_domain = 0; + list_del(&entry->batch); + } + + while (!list_is_empty(&intel->flush_pixmaps)) { + struct intel_pixmap *entry; + + entry = list_first_entry(&intel->flush_pixmaps, + struct intel_pixmap, + flush); + + entry->flush_read_domains = entry->flush_write_domain = 0; + list_del(&entry->flush); + } + + while (!list_is_empty(&intel->in_flight)) { + struct intel_pixmap *entry; + + entry = list_first_entry(&intel->in_flight, + struct intel_pixmap, + in_flight); + + dri_bo_unreference(entry->bo); + list_del(&entry->in_flight); + xfree(entry); + } } void intel_batch_emit_flush(ScrnInfoPtr scrn)