1
0
xorg-x11-server/0003-GLX-Use-the-sending-client-for-looking-up-XID-s.patch
Stefan Dirsch 418936d994 - added patches required for NVIDIA's PRIME render offload support,
which is available since release 435.xx:
  0001-xsync-Add-resource-inside-of-SyncCreate-export-SyncC.patch,
  0002-GLX-Add-a-per-client-vendor-mapping.patch,
  0003-GLX-Use-the-sending-client-for-looking-up-XID-s.patch,
  0004-GLX-Add-a-function-to-change-a-clients-vendor-list.patch,
  0005-GLX-Set-GlxServerExports-major-minor-Version.patch

OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xorg-x11-server?expand=0&rev=742
2019-08-30 09:50:06 +00:00

113 lines
3.7 KiB
Diff

From 8b67ec7cc6fda243480a5a8ca118b66242f3eb2c Mon Sep 17 00:00:00 2001
From: Kyle Brenneman <kbrenneman@nvidia.com>
Date: Wed, 8 May 2019 08:44:54 -0600
Subject: [PATCH] GLX: Use the sending client for looking up XID's
When GlxGetXIDMap looks up an unknown XID, it will now look up a vendor based
on the screen number for the XID and the client that sent the current request.
In GlxGetXIDMap, if the XID is for a regular X window, then it won't be in the
(XID -> vendor) mapping, so we have to look up a vendor by screen number.
With this change, GlxGetXIDMap will use the (screen -> vendor) map for
whichever client sent the current request, instead of using the global
(screen -> vendor) map.
Since GlxGetXIDMap doesn't take a ClientPtr argument, GlxDispatchRequest will
store the client for the current request in a global variable. That way, the
ABI for GLXVND doesn't need to change.
v2: Fix an error check in GlxDispatchRequest.
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
---
glx/vndcmds.c | 13 +++++++++++--
glx/vndserver.h | 7 +++++++
glx/vndservermapping.c | 12 ++++++++----
3 files changed, 26 insertions(+), 6 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/vndserver.h b/glx/vndserver.h
index 78246d212..613fef0fe 100644
--- a/glx/vndserver.h
+++ b/glx/vndserver.h
@@ -95,6 +95,13 @@ 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);
diff --git a/glx/vndservermapping.c b/glx/vndservermapping.c
index 778656bb6..4efab8b81 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;
--
2.16.4