xserver: Branch 'server-1.20-branch' - 5 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 13 22:32:41 UTC 2020


 hw/dmx/dmxinit.c                        |    9 +++++++++
 hw/kdrive/ephyr/ephyrinit.c             |    9 +++++++++
 hw/vfb/InitOutput.c                     |    9 +++++++++
 hw/xfree86/common/xf86Init.c            |   10 ++++++++++
 hw/xfree86/os-support/bsd/bsd_init.c    |    6 ++++++
 hw/xfree86/os-support/hurd/hurd_init.c  |    6 ++++++
 hw/xfree86/os-support/linux/lnx_init.c  |    6 ++++++
 hw/xfree86/os-support/solaris/sun_vid.c |   21 +++++++++------------
 hw/xfree86/os-support/xf86_OSproc.h     |    1 +
 hw/xnest/Init.c                         |    9 +++++++++
 hw/xwayland/xwayland.c                  |    9 +++++++++
 hw/xwin/InitOutput.c                    |    9 +++++++++
 include/os.h                            |    2 ++
 os/inputthread.c                        |    2 ++
 os/ospoll.c                             |   24 +++++++++++++++---------
 15 files changed, 111 insertions(+), 21 deletions(-)

New commits:
commit 279789183ed377127073955d21d44ee3b01ac763
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Sep 23 15:12:01 2019 -0700

    ospoll: Fix Solaris ports implementation to build on Solaris 11.4
    
    Wrong version got committed, but wasn't noticed since it only builds
    with meson, not autoconf.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit 0e8c0d2f238e5d50daaf4672bd80ad519673b5e3)

diff --git a/os/ospoll.c b/os/ospoll.c
index db9e73811..c68aabc87 100644
--- a/os/ospoll.c
+++ b/os/ospoll.c
@@ -40,6 +40,7 @@
 
 #if !HAVE_OSPOLL && defined(HAVE_PORT_CREATE)
 #include <port.h>
+#include <poll.h>
 #define PORT            1
 #define HAVE_OSPOLL     1
 #endif
@@ -78,7 +79,6 @@ struct ospoll {
 #endif
 
 #if EPOLL || PORT
-#include <sys/epoll.h>
 
 /* epoll-based implementation */
 struct ospollfd {
@@ -468,10 +468,10 @@ epoll_mod(struct ospoll *ospoll, struct ospollfd *osfd)
 {
     int events = 0;
     if (osfd->xevents & X_NOTIFY_READ)
-        events |= EPOLLIN;
+        events |= POLLIN;
     if (osfd->xevents & X_NOTIFY_WRITE)
-        events |= EPOLLOUT;
-    port_associate(ospool->epoll_fd, PORT_SOURCE_FD, osfd->fd, events, osfd);
+        events |= POLLOUT;
+    port_associate(ospoll->epoll_fd, PORT_SOURCE_FD, osfd->fd, events, osfd);
 }
 #endif
 
@@ -601,9 +601,14 @@ ospoll_wait(struct ospoll *ospoll, int timeout)
 #define MAX_EVENTS      256
     port_event_t events[MAX_EVENTS];
     uint_t nget = 1;
+    timespec_t port_timeout = {
+        .tv_sec = timeout / 1000,
+        .tv_nsec = (timeout % 1000) * 1000000
+    };
 
     nready = 0;
-    if (port_getn(ospoll->epoll_fd, events, MAX_EVENTS, &nget, &timeout) == 0) {
+    if (port_getn(ospoll->epoll_fd, events, MAX_EVENTS, &nget, &port_timeout)
+        == 0) {
         nready = nget;
     }
     for (int i = 0; i < nready; i++) {
@@ -612,17 +617,18 @@ ospoll_wait(struct ospoll *ospoll, int timeout)
         uint32_t revents = ev->portev_events;
         int xevents = 0;
 
-        if (revents & EPOLLIN)
+        if (revents & POLLIN)
             xevents |= X_NOTIFY_READ;
-        if (revents & EPOLLOUT)
+        if (revents & POLLOUT)
             xevents |= X_NOTIFY_WRITE;
-        if (revents & (~(EPOLLIN|EPOLLOUT)))
+        if (revents & (~(POLLIN|POLLOUT)))
             xevents |= X_NOTIFY_ERROR;
 
         if (osfd->callback)
             osfd->callback(osfd->fd, xevents, osfd->data);
 
-        if (osfd->trigger == ospoll_trigger_level && !osfd->deleted) {
+        if (osfd->trigger == ospoll_trigger_level &&
+            !xorg_list_is_empty(&osfd->deleted)) {
             epoll_mod(ospoll, osfd);
         }
     }
commit cc503031c32496efb28ed81d32a547ded46a0815
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu Feb 21 15:38:07 2019 -0800

    os-support/solaris: Set IOPL for input thread too
    
    Since the Solaris kernel tracks IOPL per thread, and doesn't inherit
    raised IOPL levels when creating a new thread, we need to turn it on
    in the input thread for input drivers like vmmouse that need register
    access to work correctly.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit 12769c516d9356bd92f90e2f53a4853dbfdc4aed)

diff --git a/hw/xfree86/os-support/solaris/sun_vid.c b/hw/xfree86/os-support/solaris/sun_vid.c
index 553010cc1..edb0a1172 100644
--- a/hw/xfree86/os-support/solaris/sun_vid.c
+++ b/hw/xfree86/os-support/solaris/sun_vid.c
@@ -76,7 +76,11 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
 void
 xf86OSInputThreadInit()
 {
-    return;
+    /*
+     * Need to enable in input thread as well, as Solaris kernel tracks
+     * IOPL per-thread and doesn't inherit when creating a new thread.
+     */
+    xf86EnableIO();
 }
 
 Bool
commit f778e76eb4bc6b9219a8b1a903a2fb1a30c2c92a
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu Feb 21 15:35:38 2019 -0800

    Add xf86OSInputThreadInit call from common layer into os-support layer
    
    Allows os backends to run additional code as necessary to set up the
    input thread.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit ea1527a8a662dcc5ac3ed49135740aa5f24f74bc)

diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 0b5724d67..2ec6b2f8b 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1451,5 +1451,6 @@ ddxBeforeReset(void)
 void
 ddxInputThreadInit(void)
 {
+    xf86OSInputThreadInit();
 }
 #endif
diff --git a/hw/xfree86/os-support/bsd/bsd_init.c b/hw/xfree86/os-support/bsd/bsd_init.c
index 75a719fc2..2cd2b57c7 100644
--- a/hw/xfree86/os-support/bsd/bsd_init.c
+++ b/hw/xfree86/os-support/bsd/bsd_init.c
@@ -661,3 +661,9 @@ xf86UseMsg()
     ErrorF("don't detach controlling tty (for debugging only)\n");
     return;
 }
+
+void
+xf86OSInputThreadInit()
+{
+    return;
+}
diff --git a/hw/xfree86/os-support/hurd/hurd_init.c b/hw/xfree86/os-support/hurd/hurd_init.c
index fe1a76413..ee8fe92c0 100644
--- a/hw/xfree86/os-support/hurd/hurd_init.c
+++ b/hw/xfree86/os-support/hurd/hurd_init.c
@@ -87,3 +87,9 @@ xf86CloseConsole()
     close(xf86Info.consoleFd);
     return;
 }
+
+void
+xf86OSInputThreadInit()
+{
+    return;
+}
diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index 039dc4a4d..5c0367c6f 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -397,3 +397,9 @@ xf86UseMsg(void)
     ErrorF("don't detach controlling tty (for debugging only)\n");
     ErrorF("-masterfd <fd>         use the specified fd as the DRM master fd (not if setuid/gid)\n");
 }
+
+void
+xf86OSInputThreadInit()
+{
+    return;
+}
diff --git a/hw/xfree86/os-support/solaris/sun_vid.c b/hw/xfree86/os-support/solaris/sun_vid.c
index 9601d039b..553010cc1 100644
--- a/hw/xfree86/os-support/solaris/sun_vid.c
+++ b/hw/xfree86/os-support/solaris/sun_vid.c
@@ -73,6 +73,12 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
 /* I/O Permissions section						   */
 /***************************************************************************/
 
+void
+xf86OSInputThreadInit()
+{
+    return;
+}
+
 Bool
 xf86EnableIO(void)
 {
diff --git a/hw/xfree86/os-support/xf86_OSproc.h b/hw/xfree86/os-support/xf86_OSproc.h
index 99ca90249..17607b04b 100644
--- a/hw/xfree86/os-support/xf86_OSproc.h
+++ b/hw/xfree86/os-support/xf86_OSproc.h
@@ -136,6 +136,7 @@ extern _X_EXPORT int xf86GetSerialModemState(int fd);
 extern _X_EXPORT int xf86SerialModemSetBits(int fd, int bits);
 extern _X_EXPORT int xf86SerialModemClearBits(int fd, int bits);
 extern _X_EXPORT int xf86LoadKernelModule(const char *pathname);
+extern _X_EXPORT void xf86OSInputThreadInit(void);
 
 /* AGP GART interface */
 
commit e3f26605d85d987da434640f52646d728f1fe919
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu Feb 21 15:22:57 2019 -0800

    Add ddxInputThread call from os layer into ddx layer
    
    Allows ddx's to run additional code as necessary to set up the
    input thread.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit 4ad21c3247d98ac6c5ad71fa36be60ed04f7c92c)

diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index 07154d648..ddb331090 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -838,6 +838,15 @@ ddxGiveUp(enum ExitCode error)
     AbortDDX(error);
 }
 
+#if INPUTTHREAD
+/** This function is called in Xserver/os/inputthread.c when starting
+    the input thread. */
+void
+ddxInputThreadInit(void)
+{
+}
+#endif
+
 /** This function is called in Xserver/os/osinit.c from \a OsInit(). */
 void
 OsVendorInit(void)
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index abc35dfca..47bd97ade 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -100,6 +100,15 @@ CloseInput(void)
     KdCloseInput();
 }
 
+#if INPUTTHREAD
+/** This function is called in Xserver/os/inputthread.c when starting
+    the input thread. */
+void
+ddxInputThreadInit(void)
+{
+}
+#endif
+
 #ifdef DDXBEFORERESET
 void
 ddxBeforeReset(void)
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index 407f2afcd..d9f23f360 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -232,6 +232,15 @@ ddxBeforeReset(void)
 }
 #endif
 
+#if INPUTTHREAD
+/** This function is called in Xserver/os/inputthread.c when starting
+    the input thread. */
+void
+ddxInputThreadInit(void)
+{
+}
+#endif
+
 void
 ddxUseMsg(void)
 {
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index fc60f68d3..0b5724d67 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1444,3 +1444,12 @@ ddxBeforeReset(void)
 {
 }
 #endif
+
+#if INPUTTHREAD
+/** This function is called in Xserver/os/inputthread.c when starting
+    the input thread. */
+void
+ddxInputThreadInit(void)
+{
+}
+#endif
diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
index b45685216..c3afadf8c 100644
--- a/hw/xnest/Init.c
+++ b/hw/xnest/Init.c
@@ -169,3 +169,12 @@ ddxBeforeReset(void)
     return;
 }
 #endif
+
+#if INPUTTHREAD
+/** This function is called in Xserver/os/inputthread.c when starting
+    the input thread. */
+void
+ddxInputThreadInit(void)
+{
+}
+#endif
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index baa08d87b..324c68ccf 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -72,6 +72,15 @@ ddxBeforeReset(void)
 {
     return;
 }
+#endif
+
+#if INPUTTHREAD
+/** This function is called in Xserver/os/inputthread.c when starting
+    the input thread. */
+void
+ddxInputThreadInit(void)
+{
+}
 #endif
 
  _X_NORETURN
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 9560c5684..1c6fa9fd9 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -151,6 +151,15 @@ ddxBeforeReset(void)
 }
 #endif
 
+#if INPUTTHREAD
+/** This function is called in Xserver/os/inputthread.c when starting
+    the input thread. */
+void
+ddxInputThreadInit(void)
+{
+}
+#endif
+
 int
 main(int argc, char *argv[], char *envp[])
 {
diff --git a/include/os.h b/include/os.h
index 3646194a0..2a1c29ef3 100644
--- a/include/os.h
+++ b/include/os.h
@@ -556,6 +556,8 @@ extern _X_EXPORT void
 AbortDDX(enum ExitCode error);
 extern _X_EXPORT void
 ddxGiveUp(enum ExitCode error);
+extern _X_EXPORT void
+ddxInputThreadInit(void);
 extern _X_EXPORT int
 TimeSinceLastInputEvent(void);
 
diff --git a/os/inputthread.c b/os/inputthread.c
index 97e59d21f..e6694afda 100644
--- a/os/inputthread.c
+++ b/os/inputthread.c
@@ -318,6 +318,8 @@ InputThreadDoWork(void *arg)
     sigfillset(&set);
     pthread_sigmask(SIG_BLOCK, &set, NULL);
 
+    ddxInputThreadInit();
+
     inputThreadInfo->running = TRUE;
 
 #if defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID)
commit bb405cdc85b6e31c0beef60a07a2cfe5b87dcde6
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu Feb 21 14:51:22 2019 -0800

    os-support/solaris: Drop ExtendedEnabled global variable
    
    Keeping track of kernel state in user space doesn't buy us anything,
    and introduces bugs, as we were keeping global state but the Solaris
    kernel tracks IOPL per thread.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit 7533fa9bd5a4a0f7743d553be186514d684308c8)

diff --git a/hw/xfree86/os-support/solaris/sun_vid.c b/hw/xfree86/os-support/solaris/sun_vid.c
index 25f76181c..9601d039b 100644
--- a/hw/xfree86/os-support/solaris/sun_vid.c
+++ b/hw/xfree86/os-support/solaris/sun_vid.c
@@ -73,22 +73,14 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
 /* I/O Permissions section						   */
 /***************************************************************************/
 
-#if defined(__i386__) || defined(__i386) || defined(__x86)
-static Bool ExtendedEnabled = FALSE;
-#endif
-
 Bool
 xf86EnableIO(void)
 {
 #if defined(__i386__) || defined(__i386) || defined(__x86)
-    if (ExtendedEnabled)
-        return TRUE;
-
     if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) {
         xf86Msg(X_WARNING, "xf86EnableIOPorts: Failed to set IOPL for I/O\n");
         return FALSE;
     }
-    ExtendedEnabled = TRUE;
 #endif                          /* i386 */
     return TRUE;
 }
@@ -97,11 +89,6 @@ void
 xf86DisableIO(void)
 {
 #if defined(__i386__) || defined(__i386) || defined(__x86)
-    if (!ExtendedEnabled)
-        return;
-
     sysi86(SI86V86, V86SC_IOPL, 0);
-
-    ExtendedEnabled = FALSE;
 #endif                          /* i386 */
 }


More information about the xorg-commit mailing list