[Spice-devel] [PATCH xf86-video-qxl 2/3] Fix qxl_driver_func to adhere to the API

Hans de Goede hdegoede at redhat.com
Thu Apr 24 02:27:03 PDT 2014


The driverFunc callback MUST check the passed in operand and only return
TRUE it if understands it and has handled it. It must NOT blindly assume the
op is GET_REQUIRED_HW_INTERFACES.

While at also always define driverFunc, and welcome qxl to the 21st century.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 src/qxl_driver.c | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 8aef838..c81b243 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -1302,12 +1302,6 @@ qxl_probe (struct _DriverRec *drv, int flags)
     return TRUE;
 }
 
-static Bool qxl_driver_func (ScrnInfoPtr screen_info_ptr, xorgDriverFuncOp xorg_driver_func_op, pointer hw_flags)
-{
-    *(xorgHWFlags*)hw_flags = (xorgHWFlags)HW_SKIP_CONSOLE;
-    return TRUE;
-}
-
 #else /* normal, not XSPICE */
 #ifndef XSERVER_LIBPCIACCESS
 static Bool
@@ -1424,6 +1418,25 @@ qxl_platform_probe(DriverPtr driver, int entity, int flags,
 
 #endif /* XSPICE */
 
+static Bool
+qxl_driver_func(ScrnInfoPtr pScrn, xorgDriverFuncOp op, void *data)
+{
+    xorgHWFlags *hw_flags;
+
+    switch (op) {
+    case GET_REQUIRED_HW_INTERFACES:
+        hw_flags = data;
+#ifdef XSPICE
+        *hw_flags = HW_SKIP_CONSOLE;
+#else
+        *hw_flags = HW_IO | HW_MMIO;
+#endif
+        return TRUE;
+    default:
+        return FALSE;
+    }
+}
+
 static DriverRec qxl_driver = {
     0,
     driver_name,
@@ -1432,13 +1445,12 @@ static DriverRec qxl_driver = {
     qxl_available_options,
     NULL,
     0,
-#ifdef XSPICE
     qxl_driver_func,
+#ifdef XSPICE
     NULL,
     NULL,
     NULL,
 #else
-    NULL,
 #ifdef XSERVER_LIBPCIACCESS
     qxl_device_match,
     qxl_pci_probe,
-- 
1.9.0



More information about the Spice-devel mailing list