Merge commit 'refs/merge-requests/194/head' of gitlab.freedesktop.org:xorg/xserver
This commit is contained in:
commit
29a8baa031
|
@ -468,15 +468,24 @@ void GlxDispatchReset(void)
|
||||||
int GlxDispatchRequest(ClientPtr client)
|
int GlxDispatchRequest(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
|
int result;
|
||||||
|
|
||||||
if (GlxExtensionEntry->base == 0)
|
if (GlxExtensionEntry->base == 0)
|
||||||
return BadRequest;
|
return BadRequest;
|
||||||
|
|
||||||
|
GlxSetRequestClient(client);
|
||||||
|
|
||||||
if (stuff->data < OPCODE_ARRAY_LEN) {
|
if (stuff->data < OPCODE_ARRAY_LEN) {
|
||||||
if (dispatchFuncs[stuff->data] == NULL) {
|
if (dispatchFuncs[stuff->data] == NULL) {
|
||||||
// Try to find a dispatch stub.
|
// Try to find a dispatch stub.
|
||||||
dispatchFuncs[stuff->data] = GetVendorDispatchFunc(stuff->data, 0);
|
dispatchFuncs[stuff->data] = GetVendorDispatchFunc(stuff->data, 0);
|
||||||
}
|
}
|
||||||
return dispatchFuncs[stuff->data](client);
|
result = dispatchFuncs[stuff->data](client);
|
||||||
} else {
|
} else {
|
||||||
return dispatch_GLXSingle(client);
|
result = dispatch_GLXSingle(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GlxSetRequestClient(NULL);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
12
glx/vndext.c
12
glx/vndext.c
|
@ -139,8 +139,17 @@ GlxGetClientData(ClientPtr client)
|
||||||
{
|
{
|
||||||
GlxClientPriv *cl = xglvGetClientPrivate(client);
|
GlxClientPriv *cl = xglvGetClientPrivate(client);
|
||||||
if (cl == NULL) {
|
if (cl == NULL) {
|
||||||
cl = calloc(1, sizeof(GlxClientPriv));
|
cl = calloc(1, sizeof(GlxClientPriv)
|
||||||
|
+ screenInfo.numScreens * sizeof(GlxServerVendor *));
|
||||||
if (cl != NULL) {
|
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);
|
xglvSetClientPrivate(client, cl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -315,6 +324,7 @@ _X_EXPORT const GlxServerExports glxServer = {
|
||||||
.getContextTagPrivate = GlxGetContextTagPrivate,
|
.getContextTagPrivate = GlxGetContextTagPrivate,
|
||||||
.getVendorForScreen = GlxGetVendorForScreen,
|
.getVendorForScreen = GlxGetVendorForScreen,
|
||||||
.forwardRequest = GlxForwardRequest,
|
.forwardRequest = GlxForwardRequest,
|
||||||
|
.setClientScreenVendor = GlxSetClientScreenVendor,
|
||||||
};
|
};
|
||||||
|
|
||||||
const GlxServerExports *
|
const GlxServerExports *
|
||||||
|
|
|
@ -57,6 +57,11 @@ typedef struct GlxContextTagInfoRec {
|
||||||
typedef struct GlxClientPrivRec {
|
typedef struct GlxClientPrivRec {
|
||||||
GlxContextTagInfo *contextTags;
|
GlxContextTagInfo *contextTags;
|
||||||
unsigned int contextTagCount;
|
unsigned int contextTagCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The vendor handles for each screen.
|
||||||
|
*/
|
||||||
|
GlxServerVendor **vendors;
|
||||||
} GlxClientPriv;
|
} GlxClientPriv;
|
||||||
|
|
||||||
extern int GlxErrorBase;
|
extern int GlxErrorBase;
|
||||||
|
@ -90,11 +95,19 @@ Bool GlxAddXIDMap(XID id, GlxServerVendor *vendor);
|
||||||
GlxServerVendor * GlxGetXIDMap(XID id);
|
GlxServerVendor * GlxGetXIDMap(XID id);
|
||||||
void GlxRemoveXIDMap(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 *GlxAllocContextTag(ClientPtr client, GlxServerVendor *vendor);
|
||||||
GlxContextTagInfo *GlxLookupContextTag(ClientPtr client, GLXContextTag tag);
|
GlxContextTagInfo *GlxLookupContextTag(ClientPtr client, GLXContextTag tag);
|
||||||
void GlxFreeContextTag(GlxContextTagInfo *tagInfo);
|
void GlxFreeContextTag(GlxContextTagInfo *tagInfo);
|
||||||
|
|
||||||
Bool GlxSetScreenVendor(ScreenPtr screen, GlxServerVendor *vendor);
|
Bool GlxSetScreenVendor(ScreenPtr screen, GlxServerVendor *vendor);
|
||||||
|
Bool GlxSetClientScreenVendor(ClientPtr client, ScreenPtr screen, GlxServerVendor *vendor);
|
||||||
GlxScreenPriv *GlxGetScreen(ScreenPtr pScreen);
|
GlxScreenPriv *GlxGetScreen(ScreenPtr pScreen);
|
||||||
GlxServerVendor *GlxGetVendorForScreen(ClientPtr client, ScreenPtr screen);
|
GlxServerVendor *GlxGetVendorForScreen(ClientPtr client, ScreenPtr screen);
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,13 @@
|
||||||
|
|
||||||
#include "vndservervendor.h"
|
#include "vndservervendor.h"
|
||||||
|
|
||||||
|
static ClientPtr requestClient = NULL;
|
||||||
|
|
||||||
|
void GlxSetRequestClient(ClientPtr client)
|
||||||
|
{
|
||||||
|
requestClient = client;
|
||||||
|
}
|
||||||
|
|
||||||
static GlxServerVendor *LookupXIDMapResource(XID id)
|
static GlxServerVendor *LookupXIDMapResource(XID id)
|
||||||
{
|
{
|
||||||
void *ptr = NULL;
|
void *ptr = NULL;
|
||||||
|
@ -59,10 +66,7 @@ GlxServerVendor *GlxGetXIDMap(XID id)
|
||||||
DixGetAttrAccess);
|
DixGetAttrAccess);
|
||||||
if (rv == Success && ptr != NULL) {
|
if (rv == Success && ptr != NULL) {
|
||||||
DrawablePtr draw = (DrawablePtr) ptr;
|
DrawablePtr draw = (DrawablePtr) ptr;
|
||||||
GlxScreenPriv *screenPriv = GlxGetScreen(draw->pScreen);
|
vendor = GlxGetVendorForScreen(requestClient, draw->pScreen);
|
||||||
if (screenPriv != NULL) {
|
|
||||||
vendor = screenPriv->vendor;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return vendor;
|
return vendor;
|
||||||
|
@ -185,12 +189,44 @@ Bool GlxSetScreenVendor(ScreenPtr screen, GlxServerVendor *vendor)
|
||||||
return TRUE;
|
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)
|
GlxServerVendor *GlxGetVendorForScreen(ClientPtr client, ScreenPtr screen)
|
||||||
{
|
{
|
||||||
GlxScreenPriv *priv = GlxGetScreen(screen);
|
// Note that the client won't be sending GPU screen numbers, so we don't
|
||||||
if (priv != NULL) {
|
// need per-client mappings for them.
|
||||||
return priv->vendor;
|
if (client != NULL && !screen->isGPU) {
|
||||||
|
GlxClientPriv *cl = GlxGetClientData(client);
|
||||||
|
if (cl != NULL) {
|
||||||
|
return cl->vendors[screen->myNum];
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
GlxScreenPriv *priv = GlxGetScreen(screen);
|
||||||
|
if (priv != NULL) {
|
||||||
|
return priv->vendor;
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
* will still work.
|
* will still work.
|
||||||
*/
|
*/
|
||||||
#define GLXSERVER_VENDOR_ABI_MAJOR_VERSION 0
|
#define GLXSERVER_VENDOR_ABI_MAJOR_VERSION 0
|
||||||
#define GLXSERVER_VENDOR_ABI_MINOR_VERSION 0
|
#define GLXSERVER_VENDOR_ABI_MINOR_VERSION 1
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -236,6 +236,17 @@ typedef struct GlxServerExportsRec {
|
||||||
* \param client The client.
|
* \param client The client.
|
||||||
*/
|
*/
|
||||||
int (* forwardRequest) (GlxServerVendor *vendor, ClientPtr client);
|
int (* forwardRequest) (GlxServerVendor *vendor, ClientPtr client);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the vendor library to use for a screen for a specific client.
|
||||||
|
*
|
||||||
|
* This function changes which vendor should handle GLX requests for a
|
||||||
|
* screen. Unlike \c setScreenVendor, this function can be called at any
|
||||||
|
* time, and only applies to requests from a single client.
|
||||||
|
*
|
||||||
|
* This function is available in GLXVND version 0.1 or later.
|
||||||
|
*/
|
||||||
|
Bool (* setClientScreenVendor) (ClientPtr client, ScreenPtr screen, GlxServerVendor *vendor);
|
||||||
} GlxServerExports;
|
} GlxServerExports;
|
||||||
|
|
||||||
extern _X_EXPORT const GlxServerExports glxServer;
|
extern _X_EXPORT const GlxServerExports glxServer;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user