On Tue, 14 Mar 2006 17:18:21 +0100, Leon Freitag wrote:
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?
--- wgl.c~ 2006-02-11 01:58:59.000000000 +0000 +++ wgl.c 2006-02-16 19:11:33.000000000 +0000 @@ -77,11 +77,14 @@ XVisualInfo *vis; GLXFBConfig fb_conf; GLXContext ctx; + BOOL needs_escape; struct wine_glcontext *next; struct wine_glcontext *prev; } Wine_GLContext; static Wine_GLContext *context_list;
+Wine_GLContext __thread *curctx = NULL; + static inline Wine_GLContext *get_context_from_GLXContext(GLXContext ctx) { Wine_GLContext *ret; @@ -91,18 +94,14 @@
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); + if (curctx && curctx->needs_escape) + { + ERR("foo\n"); + ExtEscape(curctx->hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape, 0, NULL); + } +
wine_tsx11_lock_ptr(); return; @@ -536,6 +535,7 @@ ENTER_GL(); if (hglrc == NULL) { ret = glXMakeCurrent(default_display, None, NULL); + curctx = NULL; } else { Wine_GLContext *ctx = (Wine_GLContext *) hglrc; Drawable drawable = get_drawable( hdc ); @@ -566,8 +566,12 @@ } TRACE(" make current for dis %p, drawable %p, ctx %p\n", ctx->display, (void*) drawable, ctx->ctx); ret = glXMakeCurrent(ctx->display, drawable, ctx->ctx); + curctx = ctx; if(ret && type == OBJ_MEMDC) + { + curctx->needs_escape = TRUE; glDrawBuffer(GL_FRONT_LEFT); + } } LEAVE_GL(); TRACE(" returning %s\n", (ret ? "True" : "False"));