[PATCH 10/19] qxl_driver: abort on mspace error, don't spin (default abort function)

Alon Levy alevy at redhat.com
Thu May 31 03:24:44 PDT 2012


---
 src/qxl_driver.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 3c8dcca..a3ec1f8 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -41,6 +41,7 @@
 
 #include <xf86Crtc.h>
 
+#include "mspace.h"
 #include "qxl.h"
 #include "assert.h"
 #include "qxl_option_helpers.h"
@@ -430,6 +431,21 @@ qxl_unmap_memory(qxl_screen_t *qxl, int scrnIndex)
     qxl->modes = NULL;
 }
 
+static void __attribute__ ((__noreturn__)) qxl_mspace_abort_func(void *user_data)
+{
+    abort();
+}
+
+static void __attribute__((format(gnu_printf, 2, 3)))
+qxl_mspace_print_func(void *user_data, const char *format, ...)
+{
+    va_list args;
+
+    va_start(args, format);
+    VErrorF(format, args);
+    va_end(args);
+}
+
 static Bool
 qxl_map_memory(qxl_screen_t *qxl, int scrnIndex)
 {
@@ -459,6 +475,9 @@ qxl_map_memory(qxl_screen_t *qxl, int scrnIndex)
 			       qxl->rom->num_pages * getpagesize() - qxl->surface0_size);
     qxl->surf_mem = qxl_mem_create ((void *)((unsigned long)qxl->vram), qxl->vram_size);
 
+    mspace_set_abort_func(qxl_mspace_abort_func);
+    mspace_set_print_func(qxl_mspace_print_func);
+
     return TRUE;
 }
 
-- 
1.7.10.1



More information about the xorg-devel mailing list