From 62c91998efad508fe5323f25a7435aa93e718fdc Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Sun, 9 Aug 2009 22:59:12 +0100 Subject: xlib: Ensure one screen instance. --- src/gallium/state_trackers/glx/xlib/xm_api.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/gallium/state_trackers/glx') diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index 79c2230588..f4c5893427 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; } -- cgit v1.2.3