glx: Implement GLX SetClientInfoARB protocol

v2: Bump glproto version to 1.4.15.  This patch uses structure names
that only exist in that glproto version and later.  Noticed by
Christopher James Halse Rogers.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
This commit is contained in:
Ian Romanick 2011-12-09 17:28:21 -08:00
parent 8b8cd6f6f4
commit befa76d251
2 changed files with 48 additions and 3 deletions

View File

@ -777,7 +777,7 @@ DRI2PROTO="dri2proto >= 2.6"
XINERAMAPROTO="xineramaproto" XINERAMAPROTO="xineramaproto"
BIGFONTPROTO="xf86bigfontproto >= 1.2.0" BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
DGAPROTO="xf86dgaproto >= 2.0.99.1" DGAPROTO="xf86dgaproto >= 2.0.99.1"
GLPROTO="glproto >= 1.4.14" GLPROTO="glproto >= 1.4.15"
DMXPROTO="dmxproto >= 2.2.99.1" DMXPROTO="dmxproto >= 2.2.99.1"
VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1" VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
WINDOWSWMPROTO="windowswmproto" WINDOWSWMPROTO="windowswmproto"

View File

@ -26,17 +26,62 @@
#include "glxserver.h" #include "glxserver.h"
#include "indirect_dispatch.h" #include "indirect_dispatch.h"
#include "glxbyteorder.h"
#include "unpack.h"
int int
__glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc) __glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
{ {
return BadRequest; xGLXSetClientInfoARBReq *req = (xGLXSetClientInfoARBReq *) pc;
char *gl_extensions;
char *glx_extensions;
/* Verify that the size of the packet matches the size inferred from the
* sizes specified for the various fields.
*/
const unsigned expected_size = sz_xGLXSetClientInfoARBReq
+ (req->numVersions * 8)
+ __GLX_PAD(req->numGLExtensionBytes)
+ __GLX_PAD(req->numGLXExtensionBytes);
if (req->length != (expected_size / 4))
return BadLength;
/* Verify that the actual length of the GL extension string matches what's
* encoded in protocol packet.
*/
gl_extensions = (char *) (req + 1) + (req->numVersions * 8);
if (req->numGLExtensionBytes != 0
&& memchr(gl_extensions, 0,
__GLX_PAD(req->numGLExtensionBytes)) == NULL)
return BadLength;
/* Verify that the actual length of the GLX extension string matches
* what's encoded in protocol packet.
*/
glx_extensions = gl_extensions + __GLX_PAD(req->numGLExtensionBytes);
if (req->numGLXExtensionBytes != 0
&& memchr(glx_extensions, 0,
__GLX_PAD(req->numGLXExtensionBytes)) == NULL)
return BadLength;
free(cl->GLClientextensions);
cl->GLClientextensions = strdup(gl_extensions);
return 0;
} }
int int
__glXDispSwap_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc) __glXDispSwap_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
{ {
return BadRequest; xGLXSetClientInfoARBReq *req = (xGLXSetClientInfoARBReq *) pc;
req->length = bswap_16(req->length);
req->numVersions = bswap_32(req->numVersions);
req->numGLExtensionBytes = bswap_32(req->numGLExtensionBytes);
req->numGLXExtensionBytes = bswap_32(req->numGLXExtensionBytes);
return __glXDisp_SetClientInfoARB(cl, pc);
} }
int int