[PATCH xserver] glx: Fix attribute handling for GLX_TEXTURE_FORMAT_EXT
Adam Jackson
ajax at redhat.com
Mon Apr 2 18:52:28 UTC 2018
Initialize it correctly to GLX_TEXTURE_FORMAT_NONE_EXT, and report it in
GLXGetDrawableAttributes. Note that it and TEXTURE_TARGET are only
meaningful attributes for GLXPixmaps.
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
glx/glxcmds.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 6785e9db38..847271e9e3 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1173,6 +1173,9 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen * pGlxScreen,
!AddResource(pDraw->id, __glXDrawableRes, pGlxDraw))
return BadAlloc;
+ if (type == GLX_DRAWABLE_PIXMAP)
+ pGlxDraw->format = GLX_TEXTURE_FORMAT_NONE_EXT;
+
return Success;
}
@@ -1737,6 +1740,9 @@ __glXDisp_BindTexImageEXT(__GLXclientState * cl, GLbyte * pc)
DixReadAccess, &pGlxDraw, &error))
return error;
+ if (pGlxDraw->format == GLX_TEXTURE_FORMAT_NONE_EXT)
+ return BadMatch;
+
if (!context->bindTexImage)
return __glXError(GLXUnsupportedPrivateRequest);
@@ -1851,7 +1857,7 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
xGLXGetDrawableAttributesReply reply;
__GLXdrawable *pGlxDraw = NULL;
DrawablePtr pDraw;
- CARD32 attributes[18];
+ CARD32 attributes[19];
int num = 0, error;
if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
@@ -1876,11 +1882,14 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId)
ATTRIB(GLX_HEIGHT, pDraw->height);
ATTRIB(GLX_SCREEN, pDraw->pScreen->myNum);
if (pGlxDraw) {
- ATTRIB(GLX_TEXTURE_TARGET_EXT,
- pGlxDraw->target == GL_TEXTURE_2D ?
- GLX_TEXTURE_2D_EXT : GLX_TEXTURE_RECTANGLE_EXT);
ATTRIB(GLX_EVENT_MASK, pGlxDraw->eventMask);
ATTRIB(GLX_FBCONFIG_ID, pGlxDraw->config->fbconfigID);
+ if (pGlxDraw->type == GLX_DRAWABLE_PIXMAP) {
+ ATTRIB(GLX_TEXTURE_TARGET_EXT,
+ pGlxDraw->target == GL_TEXTURE_2D ?
+ GLX_TEXTURE_2D_EXT : GLX_TEXTURE_RECTANGLE_EXT);
+ ATTRIB(GLX_TEXTURE_FORMAT_EXT, pGlxDraw->format);
+ }
if (pGlxDraw->type == GLX_DRAWABLE_PBUFFER) {
ATTRIB(GLX_PRESERVED_CONTENTS, GL_TRUE);
}
--
2.16.2
More information about the xorg-devel
mailing list