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

Submitted by Alon Levy on May 31, 2012, 10:24 a.m.

Details

Message ID 1338459893-1980-11-git-send-email-alevy@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Alon Levy May 31, 2012, 10:24 a.m.
---
 src/qxl_driver.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Patch hide | download patch | download mbox

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;
 }