diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2019-05-17 08:39:50 -0700 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2019-05-17 08:39:50 -0700 |
commit | 29a8baa031a87ef44d1e5320ecec5015d26fd385 (patch) | |
tree | 03a49ad4895efcf7e65023655609f0ea2efa2e95 /glx | |
parent | 2aec5c3c812ffe4a85b5e62452b244819a812dd6 (diff) | |
parent | 56c0a71fdd94a008e5d746261f70a713c4767f93 (diff) |
Merge commit 'refs/merge-requests/194/head' of gitlab.freedesktop.org:xorg/xserver
Diffstat (limited to 'glx')
-rw-r--r-- | glx/vndcmds.c | 13 | ||||
-rw-r--r-- | glx/vndext.c | 12 | ||||
-rw-r--r-- | glx/vndserver.h | 13 | ||||
-rw-r--r-- | glx/vndservermapping.c | 52 |
4 files changed, 79 insertions, 11 deletions
diff --git a/glx/vndcmds.c b/glx/vndcmds.c index f0779d14a..21c6fef9e 100644 --- a/glx/vndcmds.c +++ b/glx/vndcmds.c @@ -468,15 +468,24 @@ void GlxDispatchReset(void) int GlxDispatchRequest(ClientPtr client) { REQUEST(xReq); + int result; + if (GlxExtensionEntry->base == 0) return BadRequest; + + GlxSetRequestClient(client); + if (stuff->data < OPCODE_ARRAY_LEN) { if (dispatchFuncs[stuff->data] == NULL) { // Try to find a dispatch stub. dispatchFuncs[stuff->data] = GetVendorDispatchFunc(stuff->data, 0); } - return dispatchFuncs[stuff->data](client); + result = dispatchFuncs[stuff->data](client); } else { - return dispatch_GLXSingle(client); + result = dispatch_GLXSingle(client); } + + GlxSetRequestClient(NULL); + + return result; } diff --git a/glx/vndext.c b/glx/vndext.c index d7936467b..582e60b6e 100644 --- a/glx/vndext.c +++ b/glx/vndext.c @@ -139,8 +139,17 @@ GlxGetClientData(ClientPtr client) { GlxClientPriv *cl = xglvGetClientPrivate(client); if (cl == NULL) { - cl = calloc(1, sizeof(GlxClientPriv)); + cl = calloc(1, sizeof(GlxClientPriv) + + screenInfo.numScreens * sizeof(GlxServerVendor *)); if (cl != NULL) { + int i; + + cl->vendors = (GlxServerVendor **) (cl + 1); + for (i=0; i<screenInfo.numScreens; i++) + { + cl->vendors[i] = GlxGetVendorForScreen(NULL, screenInfo.screens[i]); + } + xglvSetClientPrivate(client, cl); } } @@ -315,6 +324,7 @@ _X_EXPORT const GlxServerExports glxServer = { .getContextTagPrivate = GlxGetContextTagPrivate, .getVendorForScreen = GlxGetVendorForScreen, .forwardRequest = GlxForwardRequest, + .setClientScreenVendor = GlxSetClientScreenVendor, }; const GlxServerExports * diff --git a/glx/vndserver.h b/glx/vndserver.h index a175656ae..772b458a1 100644 --- a/glx/vndserver.h +++ b/glx/vndserver.h @@ -57,6 +57,11 @@ typedef struct GlxContextTagInfoRec { typedef struct GlxClientPrivRec { GlxContextTagInfo *contextTags; unsigned int contextTagCount; + + /** + * The vendor handles for each screen. + */ + GlxServerVendor **vendors; } GlxClientPriv; extern int GlxErrorBase; @@ -90,11 +95,19 @@ Bool GlxAddXIDMap(XID id, GlxServerVendor *vendor); GlxServerVendor * GlxGetXIDMap(XID id); void GlxRemoveXIDMap(XID id); +/** + * Records the client that sent the current request. This is needed in + * GlxGetXIDMap to know which client's (screen -> vendor) mapping to use for a + * regular X window. + */ +void GlxSetRequestClient(ClientPtr client); + GlxContextTagInfo *GlxAllocContextTag(ClientPtr client, GlxServerVendor *vendor); GlxContextTagInfo *GlxLookupContextTag(ClientPtr client, GLXContextTag tag); void GlxFreeContextTag(GlxContextTagInfo *tagInfo); Bool GlxSetScreenVendor(ScreenPtr screen, GlxServerVendor *vendor); +Bool GlxSetClientScreenVendor(ClientPtr client, ScreenPtr screen, GlxServerVendor *vendor); GlxScreenPriv *GlxGetScreen(ScreenPtr pScreen); GlxServerVendor *GlxGetVendorForScreen(ClientPtr client, ScreenPtr screen); diff --git a/glx/vndservermapping.c b/glx/vndservermapping.c index fd3be92d9..04788ffbd 100644 --- a/glx/vndservermapping.c +++ b/glx/vndservermapping.c @@ -33,6 +33,13 @@ #include "vndservervendor.h" +static ClientPtr requestClient = NULL; + +void GlxSetRequestClient(ClientPtr client) +{ + requestClient = client; +} + static GlxServerVendor *LookupXIDMapResource(XID id) { void *ptr = NULL; @@ -59,10 +66,7 @@ GlxServerVendor *GlxGetXIDMap(XID id) DixGetAttrAccess); if (rv == Success && ptr != NULL) { DrawablePtr draw = (DrawablePtr) ptr; - GlxScreenPriv *screenPriv = GlxGetScreen(draw->pScreen); - if (screenPriv != NULL) { - vendor = screenPriv->vendor; - } + vendor = GlxGetVendorForScreen(requestClient, draw->pScreen); } } return vendor; @@ -185,12 +189,44 @@ Bool GlxSetScreenVendor(ScreenPtr screen, GlxServerVendor *vendor) return TRUE; } +Bool GlxSetClientScreenVendor(ClientPtr client, ScreenPtr screen, GlxServerVendor *vendor) +{ + GlxClientPriv *cl; + + if (screen == NULL || screen->isGPU) { + return FALSE; + } + + cl = GlxGetClientData(client); + if (cl == NULL) { + return FALSE; + } + + if (vendor != NULL) { + cl->vendors[screen->myNum] = vendor; + } else { + cl->vendors[screen->myNum] = GlxGetVendorForScreen(NULL, screen); + } + return TRUE; +} + GlxServerVendor *GlxGetVendorForScreen(ClientPtr client, ScreenPtr screen) { - GlxScreenPriv *priv = GlxGetScreen(screen); - if (priv != NULL) { - return priv->vendor; + // Note that the client won't be sending GPU screen numbers, so we don't + // need per-client mappings for them. + if (client != NULL && !screen->isGPU) { + GlxClientPriv *cl = GlxGetClientData(client); + if (cl != NULL) { + return cl->vendors[screen->myNum]; + } else { + return NULL; + } } else { - return NULL; + GlxScreenPriv *priv = GlxGetScreen(screen); + if (priv != NULL) { + return priv->vendor; + } else { + return NULL; + } } } |