[PATCH xserver 13/13] glx: Implement GLX_EXT_libglvnd

Eric Anholt eric at anholt.net
Wed Mar 30 05:05:54 UTC 2016


Adam Jackson <ajax at redhat.com> writes:

> For the dri2 backend, we depend on xfree86 already, so we can walk the
> options for the screen looking for a vendor string from xorg.conf.  For
> the swrast backend we don't have that luxury, so just say mesa.  This
> extension isn't really meaningful on Windows or OSX yet (since libglvnd
> isn't really functional there yet), so on those platforms we don't say
> anything and return BadValue for the token from QueryServerString.
>
> Signed-off-by: Adam Jackson <ajax at redhat.com>


> diff --git a/glx/glxdri2.c b/glx/glxdri2.c
> index 15253d1..a3ea273 100644
> --- a/glx/glxdri2.c
> +++ b/glx/glxdri2.c
> @@ -934,12 +934,23 @@ initializeExtensions(__GLXscreen * screen)
>  /* white lie */
>  extern glx_func_ptr glXGetProcAddressARB(const char *);
>  
> +enum {
> +    GLXOPT_VENDOR_LIBRARY,
> +};
> +
> +static const OptionInfoRec GLXOptions[] = {
> +    { GLXOPT_VENDOR_LIBRARY, "GlxVendorLibrary", OPTV_STRING, {0}, FALSE },
> +    { -1, NULL, OPTV_NONE, {0}, FALSE },
> +};
> +
>  static __GLXscreen *
>  __glXDRIscreenProbe(ScreenPtr pScreen)
>  {
>      const char *driverName, *deviceName;
>      __GLXDRIscreen *screen;
>      ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
> +    const char *glvnd = NULL;
> +    OptionInfoPtr options;
>  
>      screen = calloc(1, sizeof *screen);
>      if (screen == NULL)
> @@ -985,6 +996,19 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
>                                                 GLX_PIXMAP_BIT |
>                                                 GLX_PBUFFER_BIT);
>  
> +    options = malloc(sizeof(GLXOptions));
> +    if (options) {
> +        memcpy(options, GLXOptions, sizeof(GLXOptions));
> +        xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
> +        glvnd = xf86GetOptValString(options, GLXOPT_VENDOR_LIBRARY);
> +        if (glvnd)
> +            screen->base.glvnd = strdup(glvnd);
> +        free(options);

I think you want s/strdup/xnfstrdup/g in this patch.  Other than
(optionally) that, this series looks really good to me.  Patch 12/13
made me particularly happy, so this is all:

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20160329/99563ae0/attachment.sig>


More information about the xorg-devel mailing list