Commit 5d667df6 authored by Adam Jackson's avatar Adam Jackson 💣

glx: Fix glXQueryContext for GLX_FBCONFIG_ID and GLX_RENDER_TYPE (v2)

Just never filled in, oops. Seems to have gone unnoticed because
normally glXQueryContext simply returns the values filled in by the
client library when the context was created. The only path by which you
normally get to a GLXQueryContext request is glXImportContext, and then
only if the context is already indirect.

However, that's a statement about Mesa's libGL (and anything else that
inherited that bit of the SGI SI more or less intact). Nothing prevents
a mischeivous client from issuing that request of a direct context, and
if they did we'd be in trouble because we never bothered to preserve the
associated fbconfig in the context state, so we'd crash looking up
GLX_VISUAL_ID_EXT. So let's fix that too.

v2: Fixed missing preservation of the config in DRI2 (Eric Anholt)
Signed-off-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt's avatarEric Anholt <eric@anholt.net>
parent 78b2ce14
......@@ -215,6 +215,7 @@ __glXdirectContextCreate(__GLXscreen * screen,
if (context == NULL)
return NULL;
context->config = modes;
context->destroy = __glXdirectContextDestroy;
context->loseCurrent = __glXdirectContextLoseCurrent;
......@@ -1718,7 +1719,7 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
ClientPtr client = cl->client;
__GLXcontext *ctx;
xGLXQueryContextInfoEXTReply reply;
int nProps = 3;
int nProps = 5;
int sendBuf[nProps * 2];
int nReplyBytes;
int err;
......@@ -1740,6 +1741,10 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
sendBuf[3] = (int) (ctx->config->visualID);
sendBuf[4] = GLX_SCREEN_EXT;
sendBuf[5] = (int) (ctx->pGlxScreen->pScreen->myNum);
sendBuf[6] = GLX_FBCONFIG_ID;
sendBuf[7] = (int) (ctx->config->fbconfigID);
sendBuf[8] = GLX_RENDER_TYPE;
sendBuf[9] = (int) (ctx->config->renderType);
if (client->swapped) {
int length = reply.length;
......
......@@ -552,6 +552,7 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
return NULL;
}
context->base.config = glxConfig;
context->base.destroy = __glXDRIcontextDestroy;
context->base.makeCurrent = __glXDRIcontextMakeCurrent;
context->base.loseCurrent = __glXDRIcontextLoseCurrent;
......
......@@ -231,6 +231,7 @@ __glXDRIscreenCreateContext(__GLXscreen * baseScreen,
if (context == NULL)
return NULL;
context->base.config = glxConfig;
context->base.destroy = __glXDRIcontextDestroy;
context->base.makeCurrent = __glXDRIcontextMakeCurrent;
context->base.loseCurrent = __glXDRIcontextLoseCurrent;
......
......@@ -156,7 +156,7 @@ __glXAquaScreenCreateContext(__GLXscreen *screen,
memset(context, 0, sizeof *context);
context->base.pGlxScreen = screen;
context->base.config = conf;
context->base.destroy = __glXAquaContextDestroy;
context->base.makeCurrent = __glXAquaContextMakeCurrent;
context->base.loseCurrent = __glXAquaContextLoseCurrent;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment