[Spice-devel] [PATCH 7/7] qxl: move mspace setup to qxl_mem.c
airlied at gmail.com
airlied at gmail.com
Sun Feb 24 21:31:15 PST 2013
From: Dave Airlie <airlied at gmail.com>
removes mspace stuff from main qxl_driver.c
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/qxl.h | 1 +
src/qxl_driver.c | 21 +--------------------
src/qxl_mem.c | 16 ++++++++++++++--
3 files changed, 16 insertions(+), 22 deletions(-)
diff --git a/src/qxl.h b/src/qxl.h
index 84a4e56..941a2ad 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -478,6 +478,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 eac0faf..e488020 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"
@@ -272,22 +270,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)
@@ -986,8 +968,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 fe7cff0..17a44ec 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);
--
1.8.1.2
More information about the Spice-devel
mailing list