summaryrefslogtreecommitdiff
path: root/hw/xfree86/dixmods
diff options
context:
space:
mode:
authorLuc Verhaegen <libv@skynet.be>2008-10-09 22:22:53 +0200
committerLuc Verhaegen <libv@skynet.be>2008-10-09 22:22:53 +0200
commit2d9da7a5f384d5f38b2be79b1ea0df5a3deb52d1 (patch)
tree902039f7f3b64096bdacd45e5079ec7d764f0bb8 /hw/xfree86/dixmods
parent322335d5b5b6f155f56fe3c1cbe372f13dc20932 (diff)
DGA: Track client state even when using old style DGA.
This fixes the issue that a badly killed DGA will keep on hogging mode/framebuffer/mouse/keyboard.
Diffstat (limited to 'hw/xfree86/dixmods')
-rw-r--r--hw/xfree86/dixmods/extmod/xf86dga2.c45
1 files changed, 35 insertions, 10 deletions
diff --git a/hw/xfree86/dixmods/extmod/xf86dga2.c b/hw/xfree86/dixmods/extmod/xf86dga2.c
index 100bde9cf..df0030e80 100644
--- a/hw/xfree86/dixmods/extmod/xf86dga2.c
+++ b/hw/xfree86/dixmods/extmod/xf86dga2.c
@@ -725,6 +725,10 @@ ProcXF86DGADirectVideo(ClientPtr client)
if (!DGAAvailable(stuff->screen))
return DGAErrorBase + XF86DGANoDirectVideoMode;
+ if (DGAClients[stuff->screen] &&
+ (DGAClients[stuff->screen] != client))
+ return DGAErrorBase + XF86DGANoDirectVideoMode;
+
if (stuff->enable & XF86DGADirectGraphics) {
if(!(num = DGAGetOldDGAMode(stuff->screen)))
return (DGAErrorBase + XF86DGANoDirectVideoMode);
@@ -738,6 +742,24 @@ ProcXF86DGADirectVideo(ClientPtr client)
(stuff->enable & XF86DGADirectKeyb) != 0,
(stuff->enable & XF86DGADirectMouse) != 0);
+ /* We need to track the client and attach the teardown callback */
+ if (stuff->enable &
+ (XF86DGADirectGraphics | XF86DGADirectKeyb | XF86DGADirectMouse)) {
+ if (!DGAClients[stuff->screen]) {
+ if (DGACallbackRefCount++ == 0)
+ AddCallback (&ClientStateCallback, DGAClientStateChange, NULL);
+ }
+
+ DGAClients[stuff->screen] = client;
+ } else {
+ if (DGAClients[stuff->screen]) {
+ if (--DGACallbackRefCount == 0)
+ DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
+ }
+
+ DGAClients[stuff->screen] = NULL;
+ }
+
return (client->noClientException);
}
@@ -780,22 +802,16 @@ ProcXF86DGASetViewPort(ClientPtr client)
if (stuff->screen > screenInfo.numScreens)
return BadValue;
+ if (DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq);
if (!DGAAvailable(stuff->screen))
return (DGAErrorBase + XF86DGANoDirectVideoMode);
if (!DGAActive(stuff->screen))
- {
- int num;
- PixmapPtr pix;
- XDGAModeRec mode;
-
- if(!(num = DGAGetOldDGAMode(stuff->screen)))
- return (DGAErrorBase + XF86DGANoDirectVideoMode);
- if(Success != DGASetMode(stuff->screen, num, &mode, &pix))
- return (DGAErrorBase + XF86DGAScreenNotActive);
- }
+ return DGAErrorBase + XF86DGADirectNotActivated;
if (DGASetViewport(stuff->screen, stuff->x, stuff->y, DGA_FLIP_RETRACE)
!= Success)
@@ -846,6 +862,12 @@ ProcXF86DGAInstallColormap(ClientPtr client)
ColormapPtr pcmp;
REQUEST(xXF86DGAInstallColormapReq);
+ if (stuff->screen > screenInfo.numScreens)
+ return BadValue;
+
+ if (DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq);
if (!DGAActive(stuff->screen))
@@ -892,6 +914,9 @@ ProcXF86DGAViewPortChanged(ClientPtr client)
if (stuff->screen > screenInfo.numScreens)
return BadValue;
+ if (DGAClients[stuff->screen] != client)
+ return DGAErrorBase + XF86DGADirectNotActivated;
+
REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
if (!DGAActive(stuff->screen))