glx: Prepare driFetchDrawable for no-config contexts
When we look up the DRI drawable state we need to associate an fbconfig with the drawable. With GLX_EXT_no_config_context we can no longer infer that from the context and must instead query the server. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
@@ -396,12 +396,25 @@ driDestroyConfigs(const __DRIconfig **configs)
|
|||||||
free(configs);
|
free(configs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct glx_config *
|
||||||
|
driInferDrawableConfig(struct glx_screen *psc, GLXDrawable draw)
|
||||||
|
{
|
||||||
|
unsigned int fbconfig = 0;
|
||||||
|
|
||||||
|
if (__glXGetDrawableAttribute(psc->dpy, draw, GLX_FBCONFIG_ID, &fbconfig)) {
|
||||||
|
return glx_config_find_fbconfig(psc->configs, fbconfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
_X_HIDDEN __GLXDRIdrawable *
|
_X_HIDDEN __GLXDRIdrawable *
|
||||||
driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable)
|
driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable)
|
||||||
{
|
{
|
||||||
struct glx_display *const priv = __glXInitialize(gc->psc->dpy);
|
struct glx_display *const priv = __glXInitialize(gc->psc->dpy);
|
||||||
__GLXDRIdrawable *pdraw;
|
__GLXDRIdrawable *pdraw;
|
||||||
struct glx_screen *psc;
|
struct glx_screen *psc;
|
||||||
|
struct glx_config *config = gc->config;
|
||||||
|
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -418,8 +431,13 @@ driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable)
|
|||||||
return pdraw;
|
return pdraw;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdraw = psc->driScreen->createDrawable(psc, glxDrawable,
|
if (config == NULL)
|
||||||
glxDrawable, gc->config);
|
config = driInferDrawableConfig(gc->psc, glxDrawable);
|
||||||
|
if (config == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
pdraw = psc->driScreen->createDrawable(psc, glxDrawable, glxDrawable,
|
||||||
|
config);
|
||||||
|
|
||||||
if (pdraw == NULL) {
|
if (pdraw == NULL) {
|
||||||
ErrorMessageF("failed to create drawable\n");
|
ErrorMessageF("failed to create drawable\n");
|
||||||
|
@@ -272,9 +272,9 @@ DestroyDRIDrawable(Display *dpy, GLXDrawable drawable, int destroy_xdrawable)
|
|||||||
* 10. Given that, this routine should try to use an array on the stack to
|
* 10. Given that, this routine should try to use an array on the stack to
|
||||||
* capture the reply rather than always calling Xmalloc.
|
* capture the reply rather than always calling Xmalloc.
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
__glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
||||||
int attribute, unsigned int *value)
|
int attribute, unsigned int *value)
|
||||||
{
|
{
|
||||||
struct glx_display *priv;
|
struct glx_display *priv;
|
||||||
xGLXGetDrawableAttributesReply reply;
|
xGLXGetDrawableAttributesReply reply;
|
||||||
@@ -825,7 +825,7 @@ glXQueryDrawable(Display * dpy, GLXDrawable drawable,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
GetDrawableAttribute(dpy, drawable, attribute, value);
|
__glXGetDrawableAttribute(dpy, drawable, attribute, value);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -838,7 +838,7 @@ _GLX_PUBLIC int
|
|||||||
glXQueryGLXPbufferSGIX(Display * dpy, GLXPbufferSGIX drawable,
|
glXQueryGLXPbufferSGIX(Display * dpy, GLXPbufferSGIX drawable,
|
||||||
int attribute, unsigned int *value)
|
int attribute, unsigned int *value)
|
||||||
{
|
{
|
||||||
return GetDrawableAttribute(dpy, drawable, attribute, value);
|
return __glXGetDrawableAttribute(dpy, drawable, attribute, value);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -909,7 +909,7 @@ glXGetSelectedEvent(Display * dpy, GLXDrawable drawable, unsigned long *mask)
|
|||||||
* we could just type-cast the pointer, but why?
|
* we could just type-cast the pointer, but why?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GetDrawableAttribute(dpy, drawable, GLX_EVENT_MASK_SGIX, &value);
|
__glXGetDrawableAttribute(dpy, drawable, GLX_EVENT_MASK_SGIX, &value);
|
||||||
*mask = value;
|
*mask = value;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -841,6 +841,10 @@ indirect_create_context_attribs(struct glx_screen *base,
|
|||||||
const uint32_t *attribs,
|
const uint32_t *attribs,
|
||||||
unsigned *error);
|
unsigned *error);
|
||||||
|
|
||||||
|
|
||||||
|
extern int __glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
||||||
|
int attribute, unsigned int *value);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user