glx: Stash a copy of the XExtCodes in the glx_display
Instead of a pointer into xlib's state for it. Mostly because it lets us remove our copy of majorOpcode from the display without taking another pointer indirection. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10418>
This commit is contained in:
@@ -716,7 +716,7 @@ unsigned dri2GetSwapEventType(Display* dpy, XID drawable)
|
|||||||
pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, drawable);
|
pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, drawable);
|
||||||
if (!pdraw || !(pdraw->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
|
if (!pdraw || !(pdraw->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
|
||||||
return 0;
|
return 0;
|
||||||
return glx_dpy->codes->first_event + GLX_BufferSwapComplete;
|
return glx_dpy->codes.first_event + GLX_BufferSwapComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_fps(struct dri2_drawable *draw)
|
static void show_fps(struct dri2_drawable *draw)
|
||||||
|
@@ -51,13 +51,13 @@ __glXSendError(Display * dpy, int_fast8_t errorCode, uint_fast32_t resourceID,
|
|||||||
error.errorCode = errorCode;
|
error.errorCode = errorCode;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
error.errorCode = glx_dpy->codes->first_error + errorCode;
|
error.errorCode = glx_dpy->codes.first_error + errorCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
error.sequenceNumber = dpy->request;
|
error.sequenceNumber = dpy->request;
|
||||||
error.resourceID = resourceID;
|
error.resourceID = resourceID;
|
||||||
error.minorCode = minorCode;
|
error.minorCode = minorCode;
|
||||||
error.majorCode = glx_dpy->majorOpcode;
|
error.majorCode = glx_dpy->codes.major_opcode;
|
||||||
|
|
||||||
_XError(dpy, &error);
|
_XError(dpy, &error);
|
||||||
|
|
||||||
|
@@ -558,21 +558,16 @@ struct glx_screen
|
|||||||
*/
|
*/
|
||||||
struct glx_display
|
struct glx_display
|
||||||
{
|
{
|
||||||
/* The extension protocol codes */
|
|
||||||
XExtCodes *codes;
|
|
||||||
struct glx_display *next;
|
struct glx_display *next;
|
||||||
|
|
||||||
|
/* The extension protocol codes */
|
||||||
|
XExtCodes codes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Back pointer to the display
|
* Back pointer to the display
|
||||||
*/
|
*/
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
|
|
||||||
/**
|
|
||||||
* The \c majorOpcode is common to all connections to the same server.
|
|
||||||
* It is also copied into the context structure.
|
|
||||||
*/
|
|
||||||
int majorOpcode;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \name Minor Version
|
* \name Minor Version
|
||||||
*
|
*
|
||||||
|
@@ -150,7 +150,7 @@ __glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire)
|
|||||||
if (glx_dpy == NULL)
|
if (glx_dpy == NULL)
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
switch ((wire->u.u.type & 0x7f) - glx_dpy->codes->first_event) {
|
switch ((wire->u.u.type & 0x7f) - glx_dpy->codes.first_event) {
|
||||||
case GLX_PbufferClobber:
|
case GLX_PbufferClobber:
|
||||||
{
|
{
|
||||||
GLXPbufferClobberEvent *aevent = (GLXPbufferClobberEvent *)event;
|
GLXPbufferClobberEvent *aevent = (GLXPbufferClobberEvent *)event;
|
||||||
@@ -702,7 +702,7 @@ getVisualConfigs(struct glx_screen *psc,
|
|||||||
|
|
||||||
psc->visuals = NULL;
|
psc->visuals = NULL;
|
||||||
GetReq(GLXGetVisualConfigs, req);
|
GetReq(GLXGetVisualConfigs, req);
|
||||||
req->reqType = priv->majorOpcode;
|
req->reqType = priv->codes.major_opcode;
|
||||||
req->glxCode = X_GLXGetVisualConfigs;
|
req->glxCode = X_GLXGetVisualConfigs;
|
||||||
req->screen = screen;
|
req->screen = screen;
|
||||||
|
|
||||||
@@ -739,7 +739,7 @@ getFBConfigs(struct glx_screen *psc, struct glx_display *priv, int screen)
|
|||||||
psc->configs = NULL;
|
psc->configs = NULL;
|
||||||
if (priv->minorVersion >= 3) {
|
if (priv->minorVersion >= 3) {
|
||||||
GetReq(GLXGetFBConfigs, fb_req);
|
GetReq(GLXGetFBConfigs, fb_req);
|
||||||
fb_req->reqType = priv->majorOpcode;
|
fb_req->reqType = priv->codes.major_opcode;
|
||||||
fb_req->glxCode = X_GLXGetFBConfigs;
|
fb_req->glxCode = X_GLXGetFBConfigs;
|
||||||
fb_req->screen = screen;
|
fb_req->screen = screen;
|
||||||
}
|
}
|
||||||
@@ -748,7 +748,7 @@ getFBConfigs(struct glx_screen *psc, struct glx_display *priv, int screen)
|
|||||||
sz_xGLXGetFBConfigsSGIXReq -
|
sz_xGLXGetFBConfigsSGIXReq -
|
||||||
sz_xGLXVendorPrivateWithReplyReq, vpreq);
|
sz_xGLXVendorPrivateWithReplyReq, vpreq);
|
||||||
sgi_req = (xGLXGetFBConfigsSGIXReq *) vpreq;
|
sgi_req = (xGLXGetFBConfigsSGIXReq *) vpreq;
|
||||||
sgi_req->reqType = priv->majorOpcode;
|
sgi_req->reqType = priv->codes.major_opcode;
|
||||||
sgi_req->glxCode = X_GLXVendorPrivateWithReply;
|
sgi_req->glxCode = X_GLXVendorPrivateWithReply;
|
||||||
sgi_req->vendorCode = X_GLXvop_GetFBConfigsSGIX;
|
sgi_req->vendorCode = X_GLXvop_GetFBConfigsSGIX;
|
||||||
sgi_req->screen = screen;
|
sgi_req->screen = screen;
|
||||||
@@ -889,21 +889,16 @@ __glXInitialize(Display * dpy)
|
|||||||
if (!dpyPriv)
|
if (!dpyPriv)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dpyPriv->codes = XInitExtension(dpy, __glXExtensionName);
|
dpyPriv->codes = *XInitExtension(dpy, __glXExtensionName);
|
||||||
if (!dpyPriv->codes) {
|
|
||||||
free(dpyPriv);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
dpyPriv->dpy = dpy;
|
dpyPriv->dpy = dpy;
|
||||||
dpyPriv->majorOpcode = dpyPriv->codes->major_opcode;
|
|
||||||
dpyPriv->serverGLXvendor = 0x0;
|
dpyPriv->serverGLXvendor = 0x0;
|
||||||
dpyPriv->serverGLXversion = 0x0;
|
dpyPriv->serverGLXversion = 0x0;
|
||||||
|
|
||||||
/* This GLX implementation requires X_GLXQueryExtensionsString
|
/* This GLX implementation requires X_GLXQueryExtensionsString
|
||||||
* and X_GLXQueryServerString, which are new in GLX 1.1.
|
* and X_GLXQueryServerString, which are new in GLX 1.1.
|
||||||
*/
|
*/
|
||||||
if (!QueryVersion(dpy, dpyPriv->majorOpcode,
|
if (!QueryVersion(dpy, dpyPriv->codes.major_opcode,
|
||||||
&majorVersion, &dpyPriv->minorVersion)
|
&majorVersion, &dpyPriv->minorVersion)
|
||||||
|| (majorVersion != 1)
|
|| (majorVersion != 1)
|
||||||
|| (majorVersion == 1 && dpyPriv->minorVersion < 1)) {
|
|| (majorVersion == 1 && dpyPriv->minorVersion < 1)) {
|
||||||
@@ -912,12 +907,12 @@ __glXInitialize(Display * dpy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < __GLX_NUMBER_EVENTS; i++) {
|
for (i = 0; i < __GLX_NUMBER_EVENTS; i++) {
|
||||||
XESetWireToEvent(dpy, dpyPriv->codes->first_event + i, __glXWireToEvent);
|
XESetWireToEvent(dpy, dpyPriv->codes.first_event + i, __glXWireToEvent);
|
||||||
XESetEventToWire(dpy, dpyPriv->codes->first_event + i, __glXEventToWire);
|
XESetEventToWire(dpy, dpyPriv->codes.first_event + i, __glXEventToWire);
|
||||||
}
|
}
|
||||||
|
|
||||||
XESetCloseDisplay(dpy, dpyPriv->codes->extension, __glXCloseDisplay);
|
XESetCloseDisplay(dpy, dpyPriv->codes.extension, __glXCloseDisplay);
|
||||||
XESetErrorString (dpy, dpyPriv->codes->extension, __glXErrorString);
|
XESetErrorString (dpy, dpyPriv->codes.extension, __glXErrorString);
|
||||||
|
|
||||||
dpyPriv->glXDrawHash = __glxHashCreate();
|
dpyPriv->glXDrawHash = __glxHashCreate();
|
||||||
|
|
||||||
@@ -1023,7 +1018,7 @@ __glXSetupForCommand(Display * dpy)
|
|||||||
if (!priv) {
|
if (!priv) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return priv->majorOpcode;
|
return priv->codes.major_opcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -42,7 +42,6 @@ public:
|
|||||||
{
|
{
|
||||||
this->next = 0;
|
this->next = 0;
|
||||||
this->dpy = dpy;
|
this->dpy = dpy;
|
||||||
this->majorOpcode = 0;
|
|
||||||
this->minorVersion = minor;
|
this->minorVersion = minor;
|
||||||
this->serverGLXvendor = 0;
|
this->serverGLXvendor = 0;
|
||||||
this->serverGLXversion = 0;
|
this->serverGLXversion = 0;
|
||||||
|
Reference in New Issue
Block a user