summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/qxl.h1
-rw-r--r--src/qxl_driver.c21
-rw-r--r--src/qxl_mem.c16
3 files changed, 16 insertions, 22 deletions
diff --git a/src/qxl.h b/src/qxl.h
index dce4b94..3080d97 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -468,6 +468,7 @@ void qxl_drop_image_cache (qxl_screen_t *qxl);
/*
* Malloc
*/
+void qxl_mem_init(void);
int qxl_handle_oom (qxl_screen_t *qxl);
struct qxl_mem * qxl_mem_create (void *base,
unsigned long n_bytes);
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 8e2bf37..535d58b 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -42,8 +42,6 @@
#include <xf86Crtc.h>
#include <xf86RandR12.h>
-#include "mspace.h"
-
#include "qxl.h"
#include "assert.h"
#include "qxl_option_helpers.h"
@@ -274,22 +272,6 @@ qxl_unmap_memory (qxl_screen_t *qxl)
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);
-}
-
#ifdef QXLDRV_RESIZABLE_SURFACE0
static void
qxl_dump_ring_stat (qxl_screen_t *qxl)
@@ -997,8 +979,7 @@ qxl_pre_init (ScrnInfoPtr pScrn, int flags)
CHECK_POINT ();
- mspace_set_abort_func (qxl_mspace_abort_func);
- mspace_set_print_func (qxl_mspace_print_func);
+ qxl_mem_init();
/* zaphod mode is for suckers and i choose not to implement it */
if (xf86IsEntityShared (pScrn->entityList[0]))
diff --git a/src/qxl_mem.c b/src/qxl_mem.c
index 18ff3d9..3c19d1f 100644
--- a/src/qxl_mem.c
+++ b/src/qxl_mem.c
@@ -56,7 +56,7 @@ qxl_mem_unverifiable(struct qxl_mem *mem)
}
#endif
-static void
+static void __attribute__ ((format (gnu_printf, 2, 3)))
errout (void *data, const char *format, ...)
{
va_list va;
@@ -68,6 +68,19 @@ errout (void *data, const char *format, ...)
va_end (va);
}
+static void __attribute__ ((__noreturn__))
+qxl_mspace_abort_func (void *user_data)
+{
+ abort ();
+}
+
+void
+qxl_mem_init(void)
+{
+ mspace_set_print_func (errout);
+ mspace_set_abort_func (qxl_mspace_abort_func);
+}
+
struct qxl_mem *
qxl_mem_create (void *base,
unsigned long n_bytes)
@@ -80,7 +93,6 @@ qxl_mem_create (void *base,
ErrorF ("memory space from %p to %p\n", base, (char *)base + n_bytes);
- mspace_set_print_func (errout);
mem->space = create_mspace_with_base (base, n_bytes, 0, NULL);