[PATCH xserver 3/4] dri2: DRI2 clients are VT clients

Adam Jackson ajax at redhat.com
Thu Jun 29 14:24:35 UTC 2017


The AIGLX code no longer needs to wrap VT switching.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 glx/glxdri2.c             | 52 -----------------------------------------------
 hw/xfree86/dri2/dri2.c    |  1 +
 hw/xfree86/dri2/dri2ext.c |  6 ++++--
 3 files changed, 5 insertions(+), 54 deletions(-)

diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 701944283..8270675f8 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -63,9 +63,6 @@ struct __GLXDRIscreen {
     void *driver;
     int fd;
 
-    xf86EnterVTProc *enterVT;
-    xf86LeaveVTProc *leaveVT;
-
     const __DRIcoreExtension *core;
     const __DRIdri2Extension *dri2;
     const __DRI2flushExtension *flush;
@@ -773,46 +770,6 @@ static const __DRIextension *loader_extensions[] = {
     NULL
 };
 
-static Bool
-glxDRIEnterVT(ScrnInfoPtr scrn)
-{
-    Bool ret;
-    __GLXDRIscreen *screen = (__GLXDRIscreen *)
-        glxGetScreen(xf86ScrnToScreen(scrn));
-
-    LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
-
-    scrn->EnterVT = screen->enterVT;
-
-    ret = scrn->EnterVT(scrn);
-
-    screen->enterVT = scrn->EnterVT;
-    scrn->EnterVT = glxDRIEnterVT;
-
-    if (!ret)
-        return FALSE;
-
-    glxResumeClients();
-
-    return TRUE;
-}
-
-static void
-glxDRILeaveVT(ScrnInfoPtr scrn)
-{
-    __GLXDRIscreen *screen = (__GLXDRIscreen *)
-        glxGetScreen(xf86ScrnToScreen(scrn));
-
-    LogMessageVerbSigSafe(X_INFO, -1, "AIGLX: Suspending AIGLX clients for VT switch\n");
-
-    glxSuspendClients();
-
-    scrn->LeaveVT = screen->leaveVT;
-    (*screen->leaveVT) (scrn);
-    screen->leaveVT = scrn->LeaveVT;
-    scrn->LeaveVT = glxDRILeaveVT;
-}
-
 /**
  * Initialize extension flags in glx_enable_bits when a new screen is created
  *
@@ -910,7 +867,6 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen)
 {
     int i;
 
-    ScrnInfoPtr pScrn = xf86ScreenToScrn(baseScreen->pScreen);
     __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
 
     (*screen->core->destroyScreen) (screen->driScreen);
@@ -925,9 +881,6 @@ __glXDRIscreenDestroy(__GLXscreen * baseScreen)
         free(screen->driConfigs);
     }
 
-    pScrn->EnterVT = screen->enterVT;
-    pScrn->LeaveVT = screen->leaveVT;
-
     free(screen);
 }
 
@@ -1004,11 +957,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
 
     __glXScreenInit(&screen->base, pScreen);
 
-    screen->enterVT = pScrn->EnterVT;
-    pScrn->EnterVT = glxDRIEnterVT;
-    screen->leaveVT = pScrn->LeaveVT;
-    pScrn->LeaveVT = glxDRILeaveVT;
-
     __glXsetGetProcAddress(glXGetProcAddressARB);
 
     LogMessage(X_INFO, "AIGLX: Loaded and initialized %s\n", driverName);
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index f9f9859e1..297783b13 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -1345,6 +1345,7 @@ DRI2Connect(ClientPtr client, ScreenPtr pScreen,
         DRI2ClientPtr dri2_client;
         dri2_client = dri2ClientPrivate(client);
         dri2_client->prime_id = prime_id;
+        xf86SetVTClient(client);
     }
 
     return TRUE;
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 529de7515..ea8c5effb 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -47,13 +47,12 @@
 #include "dri2int.h"
 #include "protocol-versions.h"
 
-/* The only xf86 includes */
+#include "xf86.h"
 #include "xf86Module.h"
 #include "xf86Extensions.h"
 
 static int DRI2EventBase;
 
-
 static Bool
 validDrawable(ClientPtr client, XID drawable, Mask access_mode,
               DrawablePtr *pDrawable, int *status)
@@ -602,6 +601,9 @@ ProcDRI2Dispatch(ClientPtr client)
     if (!client->local)
         return BadRequest;
 
+    if (!xf86VTOwner())
+        return xf86SetAndSleepVTClient(client);
+
     switch (stuff->data) {
     case X_DRI2Connect:
         return ProcDRI2Connect(client);
-- 
2.13.0



More information about the xorg-devel mailing list