From ce0ad53281f236424a72ae021f293a3a5ca69217 Mon Sep 17 00:00:00 2001 From: "RALOVICH, Kristóf" Date: Thu, 23 Jul 2009 17:03:54 +0200 Subject: glx: cache DRI configs in __GLXscreenConfigsRec --- src/glx/x11/glxclient.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index bf68d0f891..2778ad878e 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -501,6 +501,8 @@ struct __GLXscreenConfigsRec { __GLXDRIscreen *driScreen; + const __DRIconfig** driver_configs; + #ifdef __DRI_COPY_SUB_BUFFER const __DRIcopySubBufferExtension *driCopySubBuffer; #endif -- cgit v1.2.3 From e32b601e7d79e8fa67b3e9f636125eebc01f3884 Mon Sep 17 00:00:00 2001 From: "RALOVICH, Kristóf" Date: Thu, 23 Jul 2009 17:04:52 +0200 Subject: glx: properly release DRI configs Release per screen DRI driver configs during screen destruction. --- src/glx/x11/glxext.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index b296b7c651..3078662c9d 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -149,6 +149,12 @@ FreeScreenConfigs(__GLXdisplayPrivate * priv) Xfree((char *) psc->serverGLXexts); #ifdef GLX_DIRECT_RENDERING + if (psc->driver_configs) { + for(unsigned int i = 0; psc->driver_configs[i]; i++) + free((__DRIconfig*)psc->driver_configs[i]); + free(psc->driver_configs); + psc->driver_configs = NULL; + } if (psc->driScreen) { psc->driScreen->destroyScreen(psc); __glxHashDestroy(psc->drawHash); -- cgit v1.2.3 From 82f4dc21cc5bce9e64fd53d158f7162770e9b652 Mon Sep 17 00:00:00 2001 From: "RALOVICH, Kristóf" Date: Thu, 23 Jul 2009 17:05:43 +0200 Subject: glx: assign per screen driver configs (DRI2) --- src/glx/x11/dri2_glx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c index fb31898db2..c5635a94ab 100644 --- a/src/glx/x11/dri2_glx.c +++ b/src/glx/x11/dri2_glx.c @@ -481,6 +481,8 @@ static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen, psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs); psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs); + psc->driver_configs = driver_configs; + psp->destroyScreen = dri2DestroyScreen; psp->createContext = dri2CreateContext; psp->createDrawable = dri2CreateDrawable; -- cgit v1.2.3 From d090ba9e00c7c7893109ae763385c2e0a66eb16f Mon Sep 17 00:00:00 2001 From: "RALOVICH, Kristóf" Date: Thu, 23 Jul 2009 17:05:50 +0200 Subject: glx: assign per screen driver configs (DRI) --- src/glx/x11/dri_glx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c index ac2eb05341..d24471c436 100644 --- a/src/glx/x11/dri_glx.c +++ b/src/glx/x11/dri_glx.c @@ -418,6 +418,8 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc, psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs); psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs); + psc->driver_configs = driver_configs; + /* Visuals with depth != screen depth are subject to automatic compositing * in the X server, so DRI1 can't render to them properly. Mark them as * non-conformant to prevent apps from picking them up accidentally. -- cgit v1.2.3 From 45f4e8842e3dae9d8be2a38769a57a524fdc335f Mon Sep 17 00:00:00 2001 From: "RALOVICH, Kristóf" Date: Thu, 23 Jul 2009 17:05:59 +0200 Subject: glx: assign per screen driver configs (DRISW) --- src/glx/x11/drisw_glx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/glx/x11/drisw_glx.c b/src/glx/x11/drisw_glx.c index 1c229dde90..15e1586658 100644 --- a/src/glx/x11/drisw_glx.c +++ b/src/glx/x11/drisw_glx.c @@ -401,7 +401,7 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen, psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs); psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs); - free(driver_configs); + psc->driver_configs = driver_configs; psp->destroyScreen = driDestroyScreen; psp->createContext = driCreateContext; -- cgit v1.2.3 From 4d99e1453552847c2a67f723adc2764443c995d7 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 16 Jul 2009 17:51:02 +0100 Subject: util: _debug_printf should print even when DEBUG is not defined The leading underscore is meaningful... This function is used by _warning and _error functions as well as the more common debug_printf(). debug_printf (without underscore) gets turned off when DEBUG is disabled, but warning/error messages still use this function to get their message out. (cherry picked from commit 0ac879dca797360570543d5bd0fd64f8fb8e566e) --- src/gallium/auxiliary/util/u_debug.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index a5ca0b72bd..96d400c839 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -143,11 +143,9 @@ void _debug_vprintf(const char *format, va_list ap) #elif defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) /* TODO */ #else /* !PIPE_SUBSYSTEM_WINDOWS */ -#ifdef DEBUG fflush(stdout); vfprintf(stderr, format, ap); #endif -#endif } -- cgit v1.2.3 From 2420b283b783751d4def3a3a2a0ed8bf7bb7b6a8 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 28 Jul 2009 18:45:22 +0100 Subject: mesa/st: recognize no-op scissor state when checking clear_with_quads Some apps enable scissor but set the rectangle to the dimensions of the window. Don't let this force us onto a slower clear path. --- src/mesa/state_tracker/st_cb_clear.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 668acbccb8..8a8c99f7e1 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -280,7 +280,11 @@ clear_with_quad(GLcontext *ctx, static INLINE GLboolean check_clear_color_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) { - if (ctx->Scissor.Enabled) + if (ctx->Scissor.Enabled && + (ctx->Scissor.X != 0 || + ctx->Scissor.Y != 0 || + ctx->Scissor.Width < rb->Width || + ctx->Scissor.Height < rb->Height)) return TRUE; if (!ctx->Color.ColorMask[0] || @@ -300,7 +304,11 @@ check_clear_depth_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) GLboolean maskStencil = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax; - if (ctx->Scissor.Enabled) + if (ctx->Scissor.Enabled && + (ctx->Scissor.X != 0 || + ctx->Scissor.Y != 0 || + ctx->Scissor.Width < rb->Width || + ctx->Scissor.Height < rb->Height)) return TRUE; if (maskStencil) @@ -319,7 +327,11 @@ check_clear_depth_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) const struct st_renderbuffer *strb = st_renderbuffer(rb); const GLboolean isDS = pf_is_depth_and_stencil(strb->surface->format); - if (ctx->Scissor.Enabled) + if (ctx->Scissor.Enabled && + (ctx->Scissor.X != 0 || + ctx->Scissor.Y != 0 || + ctx->Scissor.Width < rb->Width || + ctx->Scissor.Height < rb->Height)) return TRUE; if (isDS && @@ -345,7 +357,11 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) if (maskStencil) return TRUE; - if (ctx->Scissor.Enabled) + if (ctx->Scissor.Enabled && + (ctx->Scissor.X != 0 || + ctx->Scissor.Y != 0 || + ctx->Scissor.Width < rb->Width || + ctx->Scissor.Height < rb->Height)) return TRUE; /* This is correct, but it is necessary to look at the depth clear -- cgit v1.2.3 From 684282953937a37541f26c6e51ceec4134c62dfb Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 29 Jul 2009 12:47:23 +0100 Subject: mesa/st: short-circuit glFinish calls on WIN32 only Windows opengl32.dll calls glFinish prior to every swapbuffers, which makes it pretty hard to get decent performance... Work around by mapping finish to flush on PIPE_OS_WINDOWS. This is conformant, though it might confuse poorly-written benchmarks which attempt to measure a single event rather than figuring out the rate of continuous processing. --- src/mesa/state_tracker/st_cb_flush.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c index fbaffd154f..f7de4e7a4d 100644 --- a/src/mesa/state_tracker/st_cb_flush.c +++ b/src/mesa/state_tracker/st_cb_flush.c @@ -152,4 +152,16 @@ void st_init_flush_functions(struct dd_function_table *functions) { functions->Flush = st_glFlush; functions->Finish = st_glFinish; + + /* Windows opengl32.dll calls glFinish prior to every swapbuffers. + * This is unnecessary and degrades performance. Luckily we have some + * scope to work around this, as the externally-visible behaviour of + * Finish() is identical to Flush() in all cases - no differences in + * rendering or ReadPixels are visible if we opt not to wait here. + * + * Only set this up on windows to avoid suprise elsewhere. + */ +#ifdef PIPE_OS_WINDOWS + functions->Finish = st_glFlush; +#endif } -- cgit v1.2.3