[Mesa-dev] [PATCH 1/3] glx: Move vertex array protocol state into the indirect backend (v2)
Emil Velikov
emil.l.velikov at gmail.com
Wed Dec 6 14:50:11 UTC 2017
Hi Adam,
On 5 December 2017 at 21:22, Adam Jackson <ajax at redhat.com> wrote:
> Only relevant for indirect contexts, so let's get that code out of the
> common path.
>
> v2: Add the necessary context setup before calling GetString
>
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
> src/glx/glxcurrent.c | 12 ------------
> src/glx/indirect_glx.c | 26 ++++++++++++++++++++++----
> 2 files changed, 22 insertions(+), 16 deletions(-)
>
> diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
> index fd04929b89..9f8bf7cee1 100644
> --- a/src/glx/glxcurrent.c
> +++ b/src/glx/glxcurrent.c
> @@ -238,18 +238,6 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
>
> __glXUnlock();
>
> - /* The indirect vertex array state must to be initialised after we
> - * have setup the context, as it needs to query server attributes.
> - */
> - if (gc && !gc->isDirect) {
> - __GLXattribute *state = gc->client_state_private;
> - if (state && state->array_state == NULL) {
> - glGetString(GL_EXTENSIONS);
> - glGetString(GL_VERSION);
> - __glXInitVertexArrayState(gc);
> - }
> - }
> -
> return GL_TRUE;
> }
>
> diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c
> index cfae12f6c0..5482d768ff 100644
> --- a/src/glx/indirect_glx.c
> +++ b/src/glx/indirect_glx.c
> @@ -34,7 +34,7 @@
>
> #include "glapi.h"
> #include "glxclient.h"
> -
> +#include "indirect.h"
> #include "util/debug.h"
>
> #ifndef GLX_USE_APPLEGL
> @@ -148,9 +148,27 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old,
> sent = SendMakeCurrentRequest(dpy, gc->xid, tag, draw, read,
> &gc->currentContextTag);
>
> - if (!IndirectAPI)
> - IndirectAPI = __glXNewIndirectAPI();
> - _glapi_set_dispatch(IndirectAPI);
> + if (sent) {
> + if (!IndirectAPI)
> + IndirectAPI = __glXNewIndirectAPI();
Add blank new line.
> + _glapi_set_dispatch(IndirectAPI);
> +
> + /* The indirect vertex array state must to be initialised after we
s/must to be initialised/must be initialised/
> + * have setup the context, as it needs to query server attributes.
> + *
> + * At the point this is called gc->currentDpy is not initialized
> + * nor is the thread's current context actually set. Hence the
> + * cleverness before the GetString calls.
> + */
> + __GLXattribute *state = gc->client_state_private;
> + if (state && state->array_state == NULL) {
> + gc->currentDpy = gc->psc->dpy;
> + __glXSetCurrentContext(gc);
Unless I'm misreading the SendMakeCurrentRequest rework (patch 2/3)
__glXSetCurrentContext() will be called, hence these two lines +
respective comment could be omitted.
-Emil
More information about the mesa-dev
mailing list