[Spice-devel] [PATCH xf86-video-qxl 1/3] Add support for XSERVER_PLATFORM_BUS

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


This is a preparation patch for adding support for server managed fds.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 src/qxl.h        |  6 ++++++
 src/qxl_driver.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/src/qxl.h b/src/qxl.h
index a44875b..19555ba 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -50,6 +50,9 @@
 #ifdef XSERVER_PCIACCESS
 #include "pciaccess.h"
 #endif
+#ifdef XSERVER_PLATFORM_BUS
+#include "xf86platformBus.h"
+#endif
 #include "fb.h"
 #include "vgaHW.h"
 #endif /* XSPICE */
@@ -66,6 +69,8 @@ typedef struct list xorg_list_t;
 typedef struct xorg_list xorg_list_t;
 #endif
 
+struct xf86_platform_device;
+
 #include "compat-api.h"
 #define hidden _X_HIDDEN
 
@@ -271,6 +276,7 @@ struct _qxl_screen_t
     pciVideoPtr			pci;
     PCITAG			pci_tag;
 #endif
+    struct xf86_platform_device *platform_dev;
     vgaRegRec                   vgaRegs;
 #endif /* XSPICE */
 
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index aa969e8..8aef838 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -1387,6 +1387,41 @@ qxl_pci_probe (DriverPtr drv, int entity, struct pci_device *dev, intptr_t match
 #define qxl_probe NULL
 
 #endif
+
+#ifdef XSERVER_PLATFORM_BUS
+static Bool
+qxl_platform_probe(DriverPtr driver, int entity, int flags,
+                   struct xf86_platform_device *dev, intptr_t match_data)
+{
+    qxl_screen_t *qxl;
+    ScrnInfoPtr pScrn;
+    int scrnFlag = 0;
+
+    if (!dev->pdev)
+        return FALSE;
+
+    if (flags & PLATFORM_PROBE_GPU_SCREEN)
+        scrnFlag = XF86_ALLOCATE_GPU_SCREEN;
+
+    pScrn = xf86AllocateScreen(driver, scrnFlag);
+    if (!pScrn)
+	return FALSE;
+
+    if (xf86IsEntitySharable(entity))
+        xf86SetEntityShared(entity);
+
+    xf86AddEntityToScreen(pScrn, entity);
+
+    qxl = pScrn->driverPrivate = xnfcalloc (sizeof (qxl_screen_t), 1);
+    qxl->pci = dev->pdev;
+    qxl->platform_dev = dev;
+
+    qxl_init_scrn (pScrn, qxl_kernel_mode_enabled(pScrn, dev->pdev));
+
+    return TRUE;
+}
+#endif /* XSERVER_PLATFORM_BUS */
+
 #endif /* XSPICE */
 
 static DriverRec qxl_driver = {
@@ -1400,12 +1435,21 @@ static DriverRec qxl_driver = {
 #ifdef XSPICE
     qxl_driver_func,
     NULL,
-    NULL
+    NULL,
+    NULL,
 #else
     NULL,
 #ifdef XSERVER_LIBPCIACCESS
     qxl_device_match,
-    qxl_pci_probe
+    qxl_pci_probe,
+#else
+    NULL,
+    NULL,
+#endif
+#ifdef XSERVER_PLATFORM_BUS
+    qxl_platform_probe,
+#else
+    NULL,
 #endif
 #endif /* XSPICE */
 };
-- 
1.9.0



More information about the Spice-devel mailing list