glx: Implement GLX SetClientInfo2ARB protocol

The protocol is almost identical to SetClientInfoARB.  The only
difference is the GL versions include an extra 4 bytes for the supported
profile.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Ian Romanick 2012-07-04 15:21:02 -07:00 committed by Keith Packard
parent 167993254a
commit 09a8a169d5

View File

@ -29,10 +29,10 @@
#include "glxbyteorder.h" #include "glxbyteorder.h"
#include "unpack.h" #include "unpack.h"
int static int
__glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc) set_client_info(__GLXclientState * cl, xGLXSetClientInfoARBReq * req,
unsigned bytes_per_version)
{ {
xGLXSetClientInfoARBReq *req = (xGLXSetClientInfoARBReq *) pc;
char *gl_extensions; char *gl_extensions;
char *glx_extensions; char *glx_extensions;
@ -40,7 +40,7 @@ __glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
* sizes specified for the various fields. * sizes specified for the various fields.
*/ */
const unsigned expected_size = sz_xGLXSetClientInfoARBReq const unsigned expected_size = sz_xGLXSetClientInfoARBReq
+ (req->numVersions * 8) + (req->numVersions * bytes_per_version)
+ __GLX_PAD(req->numGLExtensionBytes) + __GLX_PAD(req->numGLExtensionBytes)
+ __GLX_PAD(req->numGLXExtensionBytes); + __GLX_PAD(req->numGLXExtensionBytes);
@ -50,7 +50,7 @@ __glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
/* Verify that the actual length of the GL extension string matches what's /* Verify that the actual length of the GL extension string matches what's
* encoded in protocol packet. * encoded in protocol packet.
*/ */
gl_extensions = (char *) (req + 1) + (req->numVersions * 8); gl_extensions = (char *) (req + 1) + (req->numVersions * bytes_per_version);
if (req->numGLExtensionBytes != 0 if (req->numGLExtensionBytes != 0
&& memchr(gl_extensions, 0, && memchr(gl_extensions, 0,
__GLX_PAD(req->numGLExtensionBytes)) == NULL) __GLX_PAD(req->numGLExtensionBytes)) == NULL)
@ -71,6 +71,12 @@ __glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
return 0; return 0;
} }
int
__glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
{
return set_client_info(cl, (xGLXSetClientInfoARBReq *) pc, 8);
}
int int
__glXDispSwap_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc) __glXDispSwap_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
{ {
@ -87,11 +93,18 @@ __glXDispSwap_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
int int
__glXDisp_SetClientInfo2ARB(__GLXclientState * cl, GLbyte * pc) __glXDisp_SetClientInfo2ARB(__GLXclientState * cl, GLbyte * pc)
{ {
return BadRequest; return set_client_info(cl, (xGLXSetClientInfoARBReq *) pc, 12);
} }
int int
__glXDispSwap_SetClientInfo2ARB(__GLXclientState * cl, GLbyte * pc) __glXDispSwap_SetClientInfo2ARB(__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_SetClientInfo2ARB(cl, pc);
} }