Re: [gtk-vnc-devel] [PATCH] gtkgl based scaling



Daniel P. Berrange wrote:
On Sat, Feb 02, 2008 at 09:06:41PM +0000, Daniel P. Berrange wrote:
On Sat, Feb 02, 2008 at 02:16:42PM -0600, Anthony Liguori wrote:
I've just committed this patch (it's not in the 0.3.3 release). Please try it out and let me know what you think.

I've modified gvncviewer so that it has a Full Screen and OpenGL Scaling menu option. The dependency on gtkglext is optional and there's also a new optional dependency on libview. This is only used by gvncviewer though so I do not recommend that any distro packages make gtk-vnc depend on libview.
The gtkglext stuff seems to be working prertty nicely - it even works on my
r500 ATI card where I don't even have 3d X driver support, or even 2d accel!

Sometimes though it does not refresh the screen properly. Asan exmaple, if i'm using a xterm and say type 'pwd<enter>', i'll see the 'pwd' characters typed, but not the newline and not the command output - until I type another character or move the mouse. So it seems the screen refreshs may be getting delayed somehow.

This patch fixes it for me...

diff -r 2d87caab4637 src/vncdisplay.c
--- a/src/vncdisplay.c	Sat Feb 02 14:24:08 2008 -0600
+++ b/src/vncdisplay.c	Mon Feb 04 19:55:57 2008 -0500
@@ -144,6 +144,12 @@ static gboolean expose_event(GtkWidget *
 	int x, y, w, h;
 	GdkRectangle drawn;
 	GdkRegion *clear, *copy;
+
+	GVNC_DEBUG("Expose %dx%d @ %d,%d\n",
+		   expose->area.x,
+		   expose->area.y,
+		   expose->area.width,
+		   expose->area.height);
#if WITH_GTKGLEXT
 	if (priv->image == NULL && priv->gl_tex_data == NULL)
@@ -207,6 +213,11 @@ static gboolean expose_event(GtkWidget *
 		glTexCoord2f(rx,ry);  glVertex3f(wx+ww, wy, 0);
 		glEnd();
 		glDisable(GL_TEXTURE_2D);
+		if (gdk_gl_drawable_is_double_buffered(priv->gl_drawable)) {
+			gdk_gl_drawable_swap_buffers(priv->gl_drawable);
+		} else {
+			glFlush ();
+		}
 		gdk_gl_drawable_gl_end(priv->gl_drawable);
 	} else
 #endif


My tests only hit the glFlush() codepath - dunno if the double buffered
path is needed - this code snippet is from the gtkglext examples.

How is performance? I don't have access to the machine that has the problem ATM so I can't test myself. I added a swap_buffers() call myself but it ended up killing performance.

Regards,

Anthony Liguori

Dan.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]