[Spice-devel] [PATCH 03/11] spicec: fix non-doublebuffer drawing

Marc-André Lureau marcandre.lureau at gmail.com
Tue Sep 24 04:42:14 PDT 2013


First, context must set it, then Draw/ReadBuffer must be set to FRONT,
and then explicit Flush is needed.

This patch is mostly for future reference, it is mostly discarded in
following patch using double-buffer.
---
 client/x11/platform.cpp      | 1 +
 client/x11/red_drawable.cpp  | 1 +
 client/x11/red_pixmap_gl.cpp | 2 ++
 spice-common                 | 2 +-
 4 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index 14c6e0c..da6b634 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -3224,6 +3224,7 @@ void Platform::init()
         int num_configs;
         int attrlist[] = {
             GLX_RENDER_TYPE, GLX_RGBA_BIT,
+            GLX_DOUBLEBUFFER, False,
             GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT | GLX_WINDOW_BIT,
             GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR,
             GLX_RED_SIZE, 8,
diff --git a/client/x11/red_drawable.cpp b/client/x11/red_drawable.cpp
index 54e53f8..19532c7 100644
--- a/client/x11/red_drawable.cpp
+++ b/client/x11/red_drawable.cpp
@@ -85,6 +85,7 @@ static inline void copy_to_gldrawable_from_gltexture(const RedDrawable_p* dest,
     if (rendertype == RENDER_TYPE_FBO) {
         GLuint fbo;
 
+        glFlush();
         fbo = source->gl.fbo;
         glBindFramebuffer(GL_FRAMEBUFFER_EXT, fbo);
     } else {
diff --git a/client/x11/red_pixmap_gl.cpp b/client/x11/red_pixmap_gl.cpp
index 1a58628..693b67d 100644
--- a/client/x11/red_pixmap_gl.cpp
+++ b/client/x11/red_pixmap_gl.cpp
@@ -79,6 +79,8 @@ RedPixmapGL::RedPixmapGL(int width, int height, RedDrawable::Format format,
             glXDestroyContext(XPlatform::get_display(), _glcont);
             THROW("no GL_EXT_framebuffer_object extension");
         }
+        glDrawBuffer(GL_FRONT);
+        glReadBuffer(GL_FRONT);
 
         glGenTextures(1, &tex);
         glBindTexture(GL_TEXTURE_2D, tex);
diff --git a/spice-common b/spice-common
index 3363fe7..08818b7 160000
--- a/spice-common
+++ b/spice-common
@@ -1 +1 @@
-Subproject commit 3363fe79f9d450774dd018a794c0b4381c1ef0a7
+Subproject commit 08818b72ba5ccb26683e5473f8fe5964537747cd
-- 
1.8.3.1



More information about the Spice-devel mailing list