I don't see any other way to speed this up the way it's being synced now,
the
question is however, whether the apps really _should_ modify the bitmap on windows too (don't know whether they would try to draw controls onto the window and then it would be overdrawn by the opengl image; application like Steam are trying to achieve similar, but they seemed to work well before)
Does this very rough&ready patch work any better?
I'm getting undefined references to `___tls_get_addr' when trying to build with this patch. However my ld has this symbol for sure... $ nm /lib/ld-2.3.5.so | grep __tls_get_addr 0000dfc0 T ___tls_get_addr 0000d9d0 T __tls_get_addr 0000dfc0 t ___tls_get_addr_internal
If this patch improves performance I'll fix it to use Win32 TLS instead of ELF TLS, it'll be interesting to see if that changes makes a difference too.
perhaps it will compile on my machine then...
Leon
On Thu, 16 Mar 2006 09:27:42 +0100, Leon Freitag wrote:
I'm getting undefined references to `___tls_get_addr' when trying to build with this patch. However my ld has this symbol for sure...
Odd. Worked for me, but it's probably something to do with the Wine build system.
Here's a version that properly uses the TEB. Does it work any better?
diff --git a/dlls/opengl32/Makefile.in b/dlls/opengl32/Makefile.in diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 56c8ad1..71f7511 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -31,6 +31,8 @@ #include "winerror.h" #include "winreg.h" #include "wingdi.h" +#include "winternl.h" +#include "winnt.h"
#include "wgl_ext.h" #include "opengl_ext.h" @@ -82,6 +84,7 @@ typedef struct wine_glcontext { XVisualInfo *vis; GLXFBConfig fb_conf; GLXContext ctx; + BOOL do_escape; struct wine_glcontext *next; struct wine_glcontext *prev; } Wine_GLContext; @@ -96,18 +99,13 @@ static inline Wine_GLContext *get_contex
void enter_gl(void) { - GLXContext gl_ctx; - Wine_GLContext *ctx; - enum x11drv_escape_codes escape = X11DRV_SYNC_PIXMAP; - - wine_tsx11_lock_ptr(); - gl_ctx = glXGetCurrentContext(); - if(!gl_ctx) return; - ctx = get_context_from_GLXContext(gl_ctx); - wine_tsx11_unlock_ptr(); /* unlock before calling GDI apis */ - - if(ctx && GetObjectType(ctx->hdc) == OBJ_MEMDC) - ExtEscape(ctx->hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape, 0, NULL); + Wine_GLContext *curctx = (Wine_GLContext *) NtCurrentTeb()->glContext; + + if (curctx && curctx->do_escape) + { + enum x11drv_escape_codes escape = X11DRV_SYNC_PIXMAP; + ExtEscape(curctx->hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape, 0, NULL); + }
wine_tsx11_lock_ptr(); return; @@ -541,6 +539,7 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, ENTER_GL(); if (hglrc == NULL) { ret = glXMakeCurrent(default_display, None, NULL); + NtCurrentTeb()->glContext = NULL; } else { Wine_GLContext *ctx = (Wine_GLContext *) hglrc; Drawable drawable = get_drawable( hdc ); @@ -571,8 +570,12 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, } TRACE(" make current for dis %p, drawable %p, ctx %p\n", ctx->display, (void*) drawable, ctx->ctx); ret = glXMakeCurrent(ctx->display, drawable, ctx->ctx); + NtCurrentTeb()->glContext = ctx; if(ret && type == OBJ_MEMDC) + { + ctx->do_escape = TRUE; glDrawBuffer(GL_FRONT_LEFT); + } } LEAVE_GL(); TRACE(" returning %s\n", (ret ? "True" : "False"));
There's a new patch to try here:
http://plan99.net/~mike/files/glteb.patch
Does that work any better?
On Fri, Mar 17, 2006 at 11:47:14AM +0000, Mike Hearn wrote:
There's a new patch to try here:
http://plan99.net/~mike/files/glteb.patch
Does that work any better?
Well, to make this work better, one would need a two-tiered approach:
= use thread-local variables to check if it's a 'special' buffer or not (like this patch does)
= only do this check on GL APIs that actually modify or read from the frame buffer (basically stuff like glClear, glEnd, gl(Read|Write)Buffer, ...).
The last is easy to do for 'core' stuff, a bit harder for extensions though. But anyway, this is mandatory if one day we want to fix the 'windowed' OpenGL code properly (whatever the method we choose as long as we do not have the GLX extension exporting the clip list feature to the application).
Lionel