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.
This commit is contained in:
parent
322335d5b5
commit
2d9da7a5f3
|
@ -725,6 +725,10 @@ ProcXF86DGADirectVideo(ClientPtr client)
|
||||||
if (!DGAAvailable(stuff->screen))
|
if (!DGAAvailable(stuff->screen))
|
||||||
return DGAErrorBase + XF86DGANoDirectVideoMode;
|
return DGAErrorBase + XF86DGANoDirectVideoMode;
|
||||||
|
|
||||||
|
if (DGAClients[stuff->screen] &&
|
||||||
|
(DGAClients[stuff->screen] != client))
|
||||||
|
return DGAErrorBase + XF86DGANoDirectVideoMode;
|
||||||
|
|
||||||
if (stuff->enable & XF86DGADirectGraphics) {
|
if (stuff->enable & XF86DGADirectGraphics) {
|
||||||
if(!(num = DGAGetOldDGAMode(stuff->screen)))
|
if(!(num = DGAGetOldDGAMode(stuff->screen)))
|
||||||
return (DGAErrorBase + XF86DGANoDirectVideoMode);
|
return (DGAErrorBase + XF86DGANoDirectVideoMode);
|
||||||
|
@ -738,6 +742,24 @@ ProcXF86DGADirectVideo(ClientPtr client)
|
||||||
(stuff->enable & XF86DGADirectKeyb) != 0,
|
(stuff->enable & XF86DGADirectKeyb) != 0,
|
||||||
(stuff->enable & XF86DGADirectMouse) != 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);
|
return (client->noClientException);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -780,22 +802,16 @@ ProcXF86DGASetViewPort(ClientPtr client)
|
||||||
if (stuff->screen > screenInfo.numScreens)
|
if (stuff->screen > screenInfo.numScreens)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
|
if (DGAClients[stuff->screen] != client)
|
||||||
|
return DGAErrorBase + XF86DGADirectNotActivated;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq);
|
REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq);
|
||||||
|
|
||||||
if (!DGAAvailable(stuff->screen))
|
if (!DGAAvailable(stuff->screen))
|
||||||
return (DGAErrorBase + XF86DGANoDirectVideoMode);
|
return (DGAErrorBase + XF86DGANoDirectVideoMode);
|
||||||
|
|
||||||
if (!DGAActive(stuff->screen))
|
if (!DGAActive(stuff->screen))
|
||||||
{
|
return DGAErrorBase + XF86DGADirectNotActivated;
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DGASetViewport(stuff->screen, stuff->x, stuff->y, DGA_FLIP_RETRACE)
|
if (DGASetViewport(stuff->screen, stuff->x, stuff->y, DGA_FLIP_RETRACE)
|
||||||
!= Success)
|
!= Success)
|
||||||
|
@ -846,6 +862,12 @@ ProcXF86DGAInstallColormap(ClientPtr client)
|
||||||
ColormapPtr pcmp;
|
ColormapPtr pcmp;
|
||||||
REQUEST(xXF86DGAInstallColormapReq);
|
REQUEST(xXF86DGAInstallColormapReq);
|
||||||
|
|
||||||
|
if (stuff->screen > screenInfo.numScreens)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
|
if (DGAClients[stuff->screen] != client)
|
||||||
|
return DGAErrorBase + XF86DGADirectNotActivated;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq);
|
REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq);
|
||||||
|
|
||||||
if (!DGAActive(stuff->screen))
|
if (!DGAActive(stuff->screen))
|
||||||
|
@ -892,6 +914,9 @@ ProcXF86DGAViewPortChanged(ClientPtr client)
|
||||||
if (stuff->screen > screenInfo.numScreens)
|
if (stuff->screen > screenInfo.numScreens)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
|
if (DGAClients[stuff->screen] != client)
|
||||||
|
return DGAErrorBase + XF86DGADirectNotActivated;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
|
REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
|
||||||
|
|
||||||
if (!DGAActive(stuff->screen))
|
if (!DGAActive(stuff->screen))
|
||||||
|
|
Loading…
Reference in New Issue