[xorg-x11-drv-qxl] Add patches for server managed fd support

Hans de Goede jwrdegoede at fedoraproject.org
Mon Apr 28 10:48:38 UTC 2014


commit 5a965596bb7c9a3195bf1c73c741f6dad66f2eee
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Thu Apr 24 11:25:58 2014 +0200

    Add patches for server managed fd support
    
    - Rebuild for xserver 1.15.99.902

 0001-Add-support-for-XSERVER_PLATFORM_BUS.patch    |  117 ++++++++++++++++++++
 ...-Fix-qxl_driver_func-to-adhere-to-the-API.patch |   77 +++++++++++++
 0003-Add-support-for-server-managed-fds.patch      |   86 ++++++++++++++
 xorg-x11-drv-qxl.spec                              |   16 ++-
 4 files changed, 293 insertions(+), 3 deletions(-)
---
diff --git a/0001-Add-support-for-XSERVER_PLATFORM_BUS.patch b/0001-Add-support-for-XSERVER_PLATFORM_BUS.patch
new file mode 100644
index 0000000..6d0188f
--- /dev/null
+++ b/0001-Add-support-for-XSERVER_PLATFORM_BUS.patch
@@ -0,0 +1,117 @@
+From 463084aa8e73fbafb8dc404e2bd458548d04e9dc Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Wed, 23 Apr 2014 17:28:28 +0200
+Subject: [PATCH xf86-video-qxl 1/4] Add support for XSERVER_PLATFORM_BUS
+
+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
+
diff --git a/0002-Fix-qxl_driver_func-to-adhere-to-the-API.patch b/0002-Fix-qxl_driver_func-to-adhere-to-the-API.patch
new file mode 100644
index 0000000..5e31ae8
--- /dev/null
+++ b/0002-Fix-qxl_driver_func-to-adhere-to-the-API.patch
@@ -0,0 +1,77 @@
+From a7115f636bc1054c350b7a6a9557ecb944188596 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Wed, 23 Apr 2014 17:35:24 +0200
+Subject: [PATCH xf86-video-qxl 2/4] Fix qxl_driver_func to adhere to the API
+
+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
+
diff --git a/0003-Add-support-for-server-managed-fds.patch b/0003-Add-support-for-server-managed-fds.patch
new file mode 100644
index 0000000..12ba0a2
--- /dev/null
+++ b/0003-Add-support-for-server-managed-fds.patch
@@ -0,0 +1,86 @@
+From cbe70e99136eca3f1eb00048e98ccad653897dd5 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Wed, 23 Apr 2014 17:50:41 +0200
+Subject: [PATCH xf86-video-qxl 3/4] Add support for server managed fds
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ src/qxl_driver.c |  4 ++++
+ src/qxl_kms.c    | 32 +++++++++++++++++++++++++++-----
+ 2 files changed, 31 insertions(+), 5 deletions(-)
+
+diff --git a/src/qxl_driver.c b/src/qxl_driver.c
+index c81b243..b9aa0e9 100644
+--- a/src/qxl_driver.c
++++ b/src/qxl_driver.c
+@@ -1432,6 +1432,10 @@ qxl_driver_func(ScrnInfoPtr pScrn, xorgDriverFuncOp op, void *data)
+         *hw_flags = HW_IO | HW_MMIO;
+ #endif
+         return TRUE;
++#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,15,99,902,0)
++    case SUPPORTS_SERVER_FDS:
++        return TRUE;
++#endif
+     default:
+         return FALSE;
+     }
+diff --git a/src/qxl_kms.c b/src/qxl_kms.c
+index d6dfcee..c31c62d 100644
+--- a/src/qxl_kms.c
++++ b/src/qxl_kms.c
+@@ -46,6 +46,17 @@ static Bool qxl_open_drm_master(ScrnInfoPtr pScrn)
+     drmSetVersion sv;
+     int err;
+ 
++#if defined(ODEV_ATTRIB_FD)
++    if (qxl->platform_dev) {
++        qxl->drm_fd = xf86_get_platform_device_int_attrib(qxl->platform_dev,
++                                                          ODEV_ATTRIB_FD, -1);
++        if (qxl->drm_fd != -1) {
++            qxl->drmmode.fd = qxl->drm_fd;
++            return TRUE;
++        }
++    }
++#endif
++
+ #if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,9,99,901,0)
+     XNFasprintf(&busid, "pci:%04x:%02x:%02x.%d",
+                 dev->domain, dev->bus, dev->dev, dev->func);
+@@ -218,11 +229,17 @@ qxl_enter_vt_kms (VT_FUNC_ARGS_DECL)
+     qxl_screen_t *qxl = pScrn->driverPrivate;
+     int ret;
+ 
+-    ret = drmSetMaster(qxl->drm_fd);
+-    if (ret) {
+-	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+-		   "drmSetMaster failed: %s\n",
+-		   strerror(errno));
++#ifdef XF86_PDEV_SERVER_FD
++    if (!(qxl->platform_dev &&
++            (qxl->platform_dev->flags & XF86_PDEV_SERVER_FD)))
++#endif
++    {
++        ret = drmSetMaster(qxl->drm_fd);
++        if (ret) {
++            xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
++                       "drmSetMaster failed: %s\n",
++                       strerror(errno));
++        }
+     }
+ 
+     if (!xf86SetDesiredModes(pScrn))
+@@ -241,6 +258,11 @@ qxl_leave_vt_kms (VT_FUNC_ARGS_DECL)
+     xf86_hide_cursors (pScrn);
+     //    pScrn->EnableDisableFBAccess (XF86_SCRN_ARG (pScrn), FALSE);
+ 
++#ifdef XF86_PDEV_SERVER_FD
++    if (qxl->platform_dev && (qxl->platform_dev->flags & XF86_PDEV_SERVER_FD))
++        return;
++#endif
++
+     ret = drmDropMaster(qxl->drm_fd);
+     if (ret) {
+ 	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+-- 
+1.9.0
+
diff --git a/xorg-x11-drv-qxl.spec b/xorg-x11-drv-qxl.spec
index f55fc92..044faf4 100644
--- a/xorg-x11-drv-qxl.spec
+++ b/xorg-x11-drv-qxl.spec
@@ -22,7 +22,7 @@ Name:      xorg-x11-drv-qxl
 
 Version:   0.1.1
 
-Release:   8%{?gver}%{?dist}
+Release:   9%{?gver}%{?dist}
 URL:       http://www.x.org
 Source0:   http://xorg.freedesktop.org/releases/individual/driver/%{tarball}-%{version}.tar.bz2
 
@@ -42,6 +42,11 @@ Patch8: 0008-Xspice-cleanup-non-regular-files-too.patch
 Patch9: 0009-Xspice-fix-cleanup-when-some-processes-are-already-d.patch
 Patch10: 0010-Xspice-cleanup-vdagent-files.patch
 
+# Support for server managed fds
+Patch11:           0001-Add-support-for-XSERVER_PLATFORM_BUS.patch
+Patch12:           0002-Fix-qxl_driver_func-to-adhere-to-the-API.patch
+Patch13:           0003-Add-support-for-server-managed-fds.patch
+
 # Support for old revision 1 qxl device (which won't go upstream)
 # These aren't currently being applied, because they're not compatible with
 # xserver 1.15.  They could be if someone wanted, but it's been 2.5 years,
@@ -97,6 +102,9 @@ XSpice is both an X and a Spice server.
 %patch8 -p1
 %patch9 -p1
 %patch10 -p1
+%patch11 -p1
+%patch12 -p1
+%patch13 -p1
 
 %build
 autoreconf -f -i
@@ -129,13 +137,11 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/X11/spiceqxl.xorg.conf
 
 
 %files
-%defattr(-,root,root,-)
 %doc COPYING README
 %{driverdir}/qxl_drv.so
 
 %if %{with_xspice}
 %files -n xorg-x11-server-Xspice
-%defattr(-,root,root,-)
 %doc COPYING README.xspice README examples/spiceqxl.xorg.conf.example
 %config(noreplace) %{_sysconfdir}/X11/spiceqxl.xorg.conf
 %{_bindir}/Xspice
@@ -144,6 +150,10 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/X11/spiceqxl.xorg.conf
 
 
 %changelog
+* Mon Apr 28 2014 Hans de Goede <hdegoede at redhat.com> - 0.1.1-9
+- Add patches for server managed fd support
+- xserver 1.15.99-20140428 git snapshot ABI rebuild
+
 * Tue Jan 14 2014 Dave Airlie <airlied at redhat.com> 0.1.1-8
 - grab patches from F20 - fix dates
 


More information about the scm-commits mailing list