diff options
Diffstat (limited to 'xorg-server/dix/dispatch.c')
-rw-r--r-- | xorg-server/dix/dispatch.c | 70 |
1 files changed, 45 insertions, 25 deletions
diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c index 2f8b3d69c..b4f5f437f 100644 --- a/xorg-server/dix/dispatch.c +++ b/xorg-server/dix/dispatch.c @@ -251,6 +251,7 @@ long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL; long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL; long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE; long SmartScheduleTime; +int SmartScheduleLatencyLimited = 0; static ClientPtr SmartLastClient; static int SmartLastIndex[SMART_MAX_PRIORITY-SMART_MIN_PRIORITY+1]; @@ -321,7 +322,7 @@ SmartScheduleClient (int *clientReady, int nready) /* * Adjust slice */ - if (nready == 1) + if (nready == 1 && SmartScheduleLatencyLimited == 0) { /* * If it's been a long time since another client @@ -341,6 +342,23 @@ SmartScheduleClient (int *clientReady, int nready) return best; } +void +EnableLimitedSchedulingLatency(void) +{ + ++SmartScheduleLatencyLimited; + SmartScheduleSlice = SmartScheduleInterval; +} + +void +DisableLimitedSchedulingLatency(void) +{ + --SmartScheduleLatencyLimited; + + /* protect against bugs */ + if (SmartScheduleLatencyLimited < 0) + SmartScheduleLatencyLimited = 0; +} + #define MAJOROP ((xReq *)client->requestBuffer)->reqType void @@ -360,6 +378,7 @@ Dispatch(void) if (!clientReady) return; + SmartScheduleSlice = SmartScheduleInterval; while (!dispatchException) { if (*icheck[0] != *icheck[1]) @@ -470,6 +489,7 @@ Dispatch(void) KillAllClients(); xfree(clientReady); dispatchException &= ~DE_RESET; + SmartScheduleLatencyLimited = 0; } #undef MAJOROP @@ -1123,11 +1143,11 @@ ProcQueryFont(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); client->errorValue = stuff->id; /* EITHER font or gc */ - rc = dixLookupResource((pointer *)&pFont, stuff->id, RT_FONT, client, - DixGetAttrAccess); + rc = dixLookupResourceByType((pointer *)&pFont, stuff->id, RT_FONT, client, + DixGetAttrAccess); if (rc == BadValue) { - rc = dixLookupResource((pointer *)&pGC, stuff->id, RT_GC, client, - DixGetAttrAccess); + rc = dixLookupResourceByType((pointer *)&pGC, stuff->id, RT_GC, client, + DixGetAttrAccess); if (rc == Success) pFont = pGC->font; } @@ -1181,10 +1201,10 @@ ProcQueryTextExtents(ClientPtr client) REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq); client->errorValue = stuff->fid; /* EITHER font or gc */ - rc = dixLookupResource((pointer *)&pFont, stuff->fid, RT_FONT, client, - DixGetAttrAccess); + rc = dixLookupResourceByType((pointer *)&pFont, stuff->fid, RT_FONT, client, + DixGetAttrAccess); if (rc == BadValue) { - rc = dixLookupResource((pointer *)&pGC, stuff->fid, RT_GC, client, + rc = dixLookupResourceByType((pointer *)&pGC, stuff->fid, RT_GC, client, DixGetAttrAccess); if (rc == Success) pFont = pGC->font; @@ -1329,7 +1349,7 @@ ProcFreePixmap(ClientPtr client) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupResource((pointer *)&pMap, stuff->id, RT_PIXMAP, client, + rc = dixLookupResourceByType((pointer *)&pMap, stuff->id, RT_PIXMAP, client, DixDestroyAccess); if (rc == Success) { @@ -2275,7 +2295,7 @@ ProcFreeColormap(ClientPtr client) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupResource((pointer *)&pmap, stuff->id, RT_COLORMAP, client, + rc = dixLookupResourceByType((pointer *)&pmap, stuff->id, RT_COLORMAP, client, DixDestroyAccess); if (rc == Success) { @@ -2303,7 +2323,7 @@ ProcCopyColormapAndFree(ClientPtr client) REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq); mid = stuff->mid; LEGAL_NEW_RESOURCE(mid, client); - rc = dixLookupResource((pointer *)&pSrcMap, stuff->srcCmap, RT_COLORMAP, + rc = dixLookupResourceByType((pointer *)&pSrcMap, stuff->srcCmap, RT_COLORMAP, client, DixReadAccess|DixRemoveAccess); if (rc == Success) { @@ -2328,7 +2348,7 @@ ProcInstallColormap(ClientPtr client) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupResource((pointer *)&pcmp, stuff->id, RT_COLORMAP, client, + rc = dixLookupResourceByType((pointer *)&pcmp, stuff->id, RT_COLORMAP, client, DixInstallAccess); if (rc != Success) goto out; @@ -2353,7 +2373,7 @@ ProcUninstallColormap(ClientPtr client) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupResource((pointer *)&pcmp, stuff->id, RT_COLORMAP, client, + rc = dixLookupResourceByType((pointer *)&pcmp, stuff->id, RT_COLORMAP, client, DixUninstallAccess); if (rc != Success) goto out; @@ -2420,7 +2440,7 @@ ProcAllocColor (ClientPtr client) REQUEST(xAllocColorReq); REQUEST_SIZE_MATCH(xAllocColorReq); - rc = dixLookupResource((pointer *)&pmap, stuff->cmap, RT_COLORMAP, client, + rc = dixLookupResourceByType((pointer *)&pmap, stuff->cmap, RT_COLORMAP, client, DixAddAccess); if (rc == Success) { @@ -2461,7 +2481,7 @@ ProcAllocNamedColor (ClientPtr client) REQUEST(xAllocNamedColorReq); REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes); - rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, DixAddAccess); if (rc == Success) { @@ -2512,7 +2532,7 @@ ProcAllocColorCells (ClientPtr client) REQUEST(xAllocColorCellsReq); REQUEST_SIZE_MATCH(xAllocColorCellsReq); - rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, DixAddAccess); if (rc == Success) { @@ -2579,7 +2599,7 @@ ProcAllocColorPlanes(ClientPtr client) REQUEST(xAllocColorPlanesReq); REQUEST_SIZE_MATCH(xAllocColorPlanesReq); - rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, DixAddAccess); if (rc == Success) { @@ -2644,7 +2664,7 @@ ProcFreeColors(ClientPtr client) REQUEST(xFreeColorsReq); REQUEST_AT_LEAST_SIZE(xFreeColorsReq); - rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, DixRemoveAccess); if (rc == Success) { @@ -2679,7 +2699,7 @@ ProcStoreColors (ClientPtr client) REQUEST(xStoreColorsReq); REQUEST_AT_LEAST_SIZE(xStoreColorsReq); - rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, DixWriteAccess); if (rc == Success) { @@ -2713,7 +2733,7 @@ ProcStoreNamedColor (ClientPtr client) REQUEST(xStoreNamedColorReq); REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes); - rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, DixWriteAccess); if (rc == Success) { @@ -2747,7 +2767,7 @@ ProcQueryColors(ClientPtr client) REQUEST(xQueryColorsReq); REQUEST_AT_LEAST_SIZE(xQueryColorsReq); - rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, DixReadAccess); if (rc == Success) { @@ -2799,7 +2819,7 @@ ProcLookupColor(ClientPtr client) REQUEST(xLookupColorReq); REQUEST_FIXED_SIZE(xLookupColorReq, stuff->nbytes); - rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, DixReadAccess); if (rc == Success) { @@ -2848,14 +2868,14 @@ ProcCreateCursor (ClientPtr client) REQUEST_SIZE_MATCH(xCreateCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); - rc = dixLookupResource((pointer *)&src, stuff->source, RT_PIXMAP, client, + rc = dixLookupResourceByType((pointer *)&src, stuff->source, RT_PIXMAP, client, DixReadAccess); if (rc != Success) { client->errorValue = stuff->source; return (rc == BadValue) ? BadPixmap : rc; } - rc = dixLookupResource((pointer *)&msk, stuff->mask, RT_PIXMAP, client, + rc = dixLookupResourceByType((pointer *)&msk, stuff->mask, RT_PIXMAP, client, DixReadAccess); if (rc != Success) { @@ -2953,7 +2973,7 @@ ProcFreeCursor (ClientPtr client) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupResource((pointer *)&pCursor, stuff->id, RT_CURSOR, client, + rc = dixLookupResourceByType((pointer *)&pCursor, stuff->id, RT_CURSOR, client, DixDestroyAccess); if (rc == Success) { |