[PATCH 1/4] glx: Implement GLX SetClientInfo2ARB protocol

Dave Airlie airlied at gmail.com
Sun Jun 10 11:10:17 PDT 2012


On Fri, Jun 8, 2012 at 9:10 PM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> The protocol is almost identical to SetClientInfo2ARB.  The only
> difference is the GL versions include an extra 4 bytes for the supported
> profile.

The commit message has typo, I assume almost identical to SetClientInfoARB

Otherwise

Reviewed-by: Dave Airlie <airlied at redhat.com>

>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>  glx/clientinfo.c |   27 ++++++++++++++++++++-------
>  1 files changed, 20 insertions(+), 7 deletions(-)
>
> diff --git a/glx/clientinfo.c b/glx/clientinfo.c
> index b26ac1a..4aaa4c9 100644
> --- a/glx/clientinfo.c
> +++ b/glx/clientinfo.c
> @@ -29,10 +29,10 @@
>  #include "glxbyteorder.h"
>  #include "unpack.h"
>
> -int
> -__glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
> +static int
> +set_client_info(__GLXclientState * cl, xGLXSetClientInfoARBReq * req,
> +                unsigned bytes_per_version)
>  {
> -    xGLXSetClientInfoARBReq *req = (xGLXSetClientInfoARBReq *) pc;
>     char *gl_extensions;
>     char *glx_extensions;
>
> @@ -40,7 +40,7 @@ __glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
>      * sizes specified for the various fields.
>      */
>     const unsigned expected_size = sz_xGLXSetClientInfoARBReq
> -        + (req->numVersions * 8)
> +        + (req->numVersions * bytes_per_version)
>         + __GLX_PAD(req->numGLExtensionBytes)
>         + __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
>      * 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
>         && memchr(gl_extensions, 0,
>                   __GLX_PAD(req->numGLExtensionBytes)) == NULL)
> @@ -72,6 +72,12 @@ __glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
>  }
>
>  int
> +__glXDisp_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
> +{
> +    return set_client_info(cl, (xGLXSetClientInfoARBReq *) pc, 8);
> +}
> +
> +int
>  __glXDispSwap_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
>  {
>     xGLXSetClientInfoARBReq *req = (xGLXSetClientInfoARBReq *) pc;
> @@ -87,11 +93,18 @@ __glXDispSwap_SetClientInfoARB(__GLXclientState * cl, GLbyte * pc)
>  int
>  __glXDisp_SetClientInfo2ARB(__GLXclientState * cl, GLbyte * pc)
>  {
> -    return BadRequest;
> +    return set_client_info(cl, (xGLXSetClientInfoARBReq *) pc, 12);
>  }
>
>  int
>  __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);
>  }
> --
> 1.7.6.5
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel


More information about the xorg-devel mailing list