Alexandre Julliard : winex11: Use ExtEscape to flush the GL drawable to the physdev.

Alexandre Julliard julliard at winehq.org
Wed Oct 10 15:27:21 CDT 2007


Module: wine
Branch: master
Commit: 771d61a8865b56c088d5c6cb00367d262e9e790d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=771d61a8865b56c088d5c6cb00367d262e9e790d

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Oct 10 17:33:35 2007 +0200

winex11: Use ExtEscape to flush the GL drawable to the physdev.

Based on a patch by Chris Robinson.

---

 dlls/winex11.drv/init.c   |    3 +++
 dlls/winex11.drv/opengl.c |   17 +++++++++++++----
 dlls/winex11.drv/x11drv.h |    4 +++-
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c
index 634a95a..8d360c0 100644
--- a/dlls/winex11.drv/init.c
+++ b/dlls/winex11.drv/init.c
@@ -436,6 +436,9 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID
                     return TRUE;
                 }
                 return FALSE;
+            case X11DRV_FLUSH_GL_DRAWABLE:
+                flush_gl_drawable(physDev);
+                return TRUE;
             }
         }
         break;
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 8224f68..c49a804 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1967,7 +1967,7 @@ static void WINAPI X11DRV_wglGetIntegerv(GLenum pname, GLint* params)
     wine_tsx11_unlock();
 }
 
-static inline void update_drawable(X11DRV_PDEVICE *physDev)
+void flush_gl_drawable(X11DRV_PDEVICE *physDev)
 {
     int w, h;
 
@@ -1983,9 +1983,11 @@ static inline void update_drawable(X11DRV_PDEVICE *physDev)
 
         /* The GL drawable may be lagged behind if we don't flush first, so
          * flush the display make sure we copy up-to-date data */
+        wine_tsx11_lock();
         XFlush(gdi_display);
         XCopyArea(gdi_display, src, physDev->drawable, physDev->gc, 0, 0, w, h,
                   physDev->dc_rect.left, physDev->dc_rect.top);
+        wine_tsx11_unlock();
     }
 }
 
@@ -1993,23 +1995,25 @@ static inline void update_drawable(X11DRV_PDEVICE *physDev)
 static void WINAPI X11DRV_wglFinish(void)
 {
     Wine_GLContext *ctx = NtCurrentTeb()->glContext;
+    enum x11drv_escape_codes code = X11DRV_FLUSH_GL_DRAWABLE;
 
     wine_tsx11_lock();
     sync_context(ctx);
     pglFinish();
-    update_drawable(ctx->physDev);
     wine_tsx11_unlock();
+    ExtEscape(ctx->hdc, X11DRV_ESCAPE, sizeof(code), (LPSTR)&code, 0, NULL );
 }
 
 static void WINAPI X11DRV_wglFlush(void)
 {
     Wine_GLContext *ctx = NtCurrentTeb()->glContext;
+    enum x11drv_escape_codes code = X11DRV_FLUSH_GL_DRAWABLE;
 
     wine_tsx11_lock();
     sync_context(ctx);
     pglFlush();
-    update_drawable(ctx->physDev);
     wine_tsx11_unlock();
+    ExtEscape(ctx->hdc, X11DRV_ESCAPE, sizeof(code), (LPSTR)&code, 0, NULL );
 }
 
 /**
@@ -3292,7 +3296,8 @@ BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *physDev)
   }
   else
       pglXSwapBuffers(gdi_display, drawable);
-  update_drawable(physDev);
+
+  flush_gl_drawable(physDev);
   wine_tsx11_unlock();
 
   /* FPS support */
@@ -3375,6 +3380,10 @@ void mark_drawable_dirty(Drawable old, Drawable new)
 {
 }
 
+void flush_gl_drawable(X11DRV_PDEVICE *physDev)
+{
+}
+
 Drawable create_glxpixmap(Display *display, XVisualInfo *vis, Pixmap parent)
 {
     return 0;
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 05f8d1c..2ff4905 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -477,7 +477,8 @@ enum x11drv_escape_codes
     X11DRV_GET_DCE,          /* get the DCE pointer */
     X11DRV_SET_DCE,          /* set the DCE pointer */
     X11DRV_GET_GLX_DRAWABLE, /* get current glx drawable for a DC */
-    X11DRV_SYNC_PIXMAP       /* sync the dibsection to its pixmap */
+    X11DRV_SYNC_PIXMAP,      /* sync the dibsection to its pixmap */
+    X11DRV_FLUSH_GL_DRAWABLE /* flush changes made to the gl drawable */
 };
 
 struct x11drv_escape_set_drawable
@@ -676,6 +677,7 @@ extern int pixelformat_from_fbconfig_id( XID fbconfig_id );
 extern XVisualInfo *visual_from_fbconfig_id( XID fbconfig_id );
 extern void mark_drawable_dirty( Drawable old, Drawable new );
 extern Drawable create_glxpixmap( Display *display, XVisualInfo *vis, Pixmap parent );
+extern void flush_gl_drawable( X11DRV_PDEVICE *physDev );
 
 extern void alloc_window_dce( struct x11drv_win_data *data );
 extern void free_window_dce( struct x11drv_win_data *data );




More information about the wine-cvs mailing list