[Mesa-dev] [PATCH 5/8] Support of RENDER_TYPE property [5/6] Storing the RENDER_TYPE in indirect rendering.

Ian Romanick idr at freedesktop.org
Mon Jul 15 13:44:45 PDT 2013


On 07/15/2013 07:28 AM, Tomasz Lis wrote:
> The change allows to store RENDER_TYPE value in GLX context
> when indirect rendering is in use.
> ---
>   src/glx/create_context.c |    4 +++-
>   src/glx/glxclient.h      |    7 +++++++
>   src/glx/glxcmds.c        |    1 -
>   src/glx/indirect_glx.c   |   23 ++++++++++++++++++-----
>   4 files changed, 28 insertions(+), 7 deletions(-)
>
> diff --git a/src/glx/create_context.c b/src/glx/create_context.c
> index a755e83..38e949a 100644
> --- a/src/glx/create_context.c
> +++ b/src/glx/create_context.c
> @@ -84,7 +84,9 @@ glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config,
>   #ifdef GLX_USE_APPLEGL
>         gc = applegl_create_context(psc, cfg, share, 0);
>   #else
> -      gc = indirect_create_context(psc, cfg, share, 0);
> +      gc = indirect_create_context_attribs(psc, cfg, share, num_attribs,
> +              (const uint32_t *) attrib_list,
> +              &dummy_err);
>   #endif
>      }
>
> diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
> index 3e9b730..fc8f31c 100644
> --- a/src/glx/glxclient.h
> +++ b/src/glx/glxclient.h
> @@ -817,5 +817,12 @@ extern struct glx_context *
>   indirect_create_context(struct glx_screen *psc,
>   			struct glx_config *mode,
>   			struct glx_context *shareList, int renderType);
> +extern struct glx_context *
> +indirect_create_context_attribs(struct glx_screen *base,
> +				struct glx_config *config_base,
> +				struct glx_context *shareList,
> +				unsigned num_attribs,
> +				const uint32_t *attribs,
> +				unsigned *error);
>
>   #endif /* !__GLX_client_h__ */
> diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
> index 967dab3..99b0218 100644
> --- a/src/glx/glxcmds.c
> +++ b/src/glx/glxcmds.c
> @@ -344,7 +344,6 @@ CreateContext(Display *dpy, int generic_id, struct glx_config *config,
>
>      gc->share_xid = shareList ? shareList->xid : None;
>      gc->imported = GL_FALSE;
> -   gc->renderType = renderType;
>
>      return (GLXContext) gc;
>   }
> diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c
> index ff869e2..fc5107d 100644
> --- a/src/glx/indirect_glx.c
> +++ b/src/glx/indirect_glx.c
> @@ -32,6 +32,7 @@
>
>   #include "glapi.h"
>   #include "glxclient.h"
> +#include "dri_common.h"
>
>   extern struct _glapi_table *__glXNewIndirectAPI(void);
>
> @@ -362,6 +363,8 @@ indirect_create_context(struct glx_screen *psc,
>      gc->isDirect = GL_FALSE;
>      gc->vtable = &indirect_context_vtable;
>      state = calloc(1, sizeof(struct __GLXattributeRec));
> +   gc->renderType = renderType;
> +
>      if (state == NULL) {
>         /* Out of memory */
>         free(gc);
> @@ -430,7 +433,7 @@ indirect_create_context(struct glx_screen *psc,
>      return gc;
>   }
>
> -static struct glx_context *
> +_X_HIDDEN struct glx_context *
>   indirect_create_context_attribs(struct glx_screen *base,
>   				struct glx_config *config_base,
>   				struct glx_context *shareList,
> @@ -438,18 +441,28 @@ indirect_create_context_attribs(struct glx_screen *base,
>   				const uint32_t *attribs,
>   				unsigned *error)
>   {
> +    uint32_t minor_ver = 1;
> +    uint32_t major_ver = 2;
> +    uint32_t renderType = GLX_RGBA_TYPE;
> +    uint32_t flags = 0;
> +    unsigned api;
> +    int reset = __DRI_CTX_RESET_NO_NOTIFICATION;

There should be a blank line between the declarations and the comment.

>      /* All of the attribute validation for indirect contexts is handled on the
> -    * server, so there's not much to do here.
> +    * server, so there's not much to do here. Still, we need to parse the attributes
> +    * to correctly set renderType.
>       */
> -   (void) num_attribs;
> -   (void) attribs;
> +    if (!dri2_convert_glx_attribs(num_attribs, attribs,
> +             &major_ver, &minor_ver, &renderType, &flags,
> +             &api, &reset, error)) {
> +        return NULL;
> +    }
>
>      /* The error parameter is only used on the server so that correct GLX
>       * protocol errors can be generated.  On the client, it can be ignored.
>       */
>      (void) error;

Since error is used now, this should be deleted.

>
> -   return indirect_create_context(base, config_base, shareList, 0);
> +   return indirect_create_context(base, config_base, shareList, renderType);
>   }
>
>   struct glx_screen_vtable indirect_screen_vtable = {
>



More information about the mesa-dev mailing list