forked from pool/xorg-x11-server
92 lines
2.8 KiB
Diff
92 lines
2.8 KiB
Diff
|
From 37a36a6b5b887d5c5a17a6931ceba8ad5d1bb6d5 Mon Sep 17 00:00:00 2001
|
||
|
From: Kyle Brenneman <kbrenneman@nvidia.com>
|
||
|
Date: Thu, 19 Oct 2017 15:14:51 -0600
|
||
|
Subject: [PATCH] GLX: Add a per-client vendor mapping.
|
||
|
|
||
|
Each client now has its own (screen, vendor) mapping.
|
||
|
|
||
|
Currently, it's just a copy of the global mapping, but later changes will allow
|
||
|
it to change.
|
||
|
|
||
|
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
|
||
|
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
|
||
|
Reviewed-by: Adam Jackson <ajax@redhat.com>
|
||
|
---
|
||
|
glx/vndext.c | 11 ++++++++++-
|
||
|
glx/vndserver.h | 5 +++++
|
||
|
glx/vndservermapping.c | 19 +++++++++++++++----
|
||
|
3 files changed, 30 insertions(+), 5 deletions(-)
|
||
|
|
||
|
diff --git a/glx/vndext.c b/glx/vndext.c
|
||
|
index d7936467b..20c0648cc 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);
|
||
|
}
|
||
|
}
|
||
|
diff --git a/glx/vndserver.h b/glx/vndserver.h
|
||
|
index a175656ae..78246d212 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;
|
||
|
diff --git a/glx/vndservermapping.c b/glx/vndservermapping.c
|
||
|
index fd3be92d9..778656bb6 100644
|
||
|
--- a/glx/vndservermapping.c
|
||
|
+++ b/glx/vndservermapping.c
|
||
|
@@ -187,10 +187,21 @@ Bool GlxSetScreenVendor(ScreenPtr screen, GlxServerVendor *vendor)
|
||
|
|
||
|
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;
|
||
|
+ }
|
||
|
}
|
||
|
}
|
||
|
--
|
||
|
2.16.4
|
||
|
|