From: José Fonseca Date: Sun, 9 Aug 2009 21:59:12 +0000 (+0100) Subject: xlib: Ensure one screen instance. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=62c91998efad508fe5323f25a7435aa93e718fdc;p=mesa.git xlib: Ensure one screen instance. --- diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index 79c2230588f..f4c5893427d 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -742,7 +742,7 @@ PUBLIC XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) { static GLboolean firstTime = GL_TRUE; - struct pipe_screen *screen; + static struct pipe_screen *screen = NULL; struct pipe_context *pipe; XMesaContext c; GLcontext *mesaCtx; @@ -750,6 +750,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) if (firstTime) { pipe_mutex_init(_xmesa_lock); + screen = driver.create_pipe_screen(); firstTime = GL_FALSE; } @@ -765,9 +766,6 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) c->xm_buffer = NULL; /* set later by XMesaMakeCurrent */ c->xm_read_buffer = NULL; - /* XXX: create once per Xlib Display. - */ - screen = driver.create_pipe_screen(); if (screen == NULL) goto fail; @@ -801,9 +799,6 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) else if (pipe) pipe->destroy(pipe); - if (screen) - screen->destroy( screen ); - FREE(c); return NULL; }