[cairo] [patch] boilerplate/gl: use glFlush instead of glFinish

Henry (Yu) Song - SISA henry.song at samsung.com
Thu Aug 29 13:41:57 PDT 2013


>From 73c77248ed95b3f9f6a777d86c368e464f3b49bb Mon Sep 17 00:00:00 2001
From: Henry Song <henry.song at samsung.com>
Date: Thu, 29 Aug 2013 13:35:11 -0700
Subject: [PATCH] boilerplate/gl: use glFlush instead of glFinish for
 synchronization

Use glFlush () is a proper way to indicate a surface/frame finish
instead of a glFinish. Applications very rarely use glFinish ().
For offscreen, a glFlush () should be used to indicate finish drawings
onto a surface.  For onscreen, an eglSwapBuffers/glXSwapBuffers should
be used (internal, it calls glFlush).

Using glFlush () computes performance more accurately folllowing app
usage model.
---
 boilerplate/cairo-boilerplate-egl.c | 2 +-
 boilerplate/cairo-boilerplate-glx.c | 2 +-
 boilerplate/cairo-boilerplate-wgl.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/boilerplate/cairo-boilerplate-egl.c b/boilerplate/cairo-boilerplate-egl.c
index 99bee64..3190728 100644
--- a/boilerplate/cairo-boilerplate-egl.c
+++ b/boilerplate/cairo-boilerplate-egl.c
@@ -156,7 +156,7 @@ _cairo_boilerplate_egl_synchronize (void *closure)
     if (cairo_device_acquire (gltc->device))
 	return;
 
-    glFinish ();
+    glFlush ();
 
     cairo_device_release (gltc->device);
 }
diff --git a/boilerplate/cairo-boilerplate-glx.c b/boilerplate/cairo-boilerplate-glx.c
index 0643644..9baca13 100644
--- a/boilerplate/cairo-boilerplate-glx.c
+++ b/boilerplate/cairo-boilerplate-glx.c
@@ -353,7 +353,7 @@ _cairo_boilerplate_gl_synchronize (void *closure)
     if (cairo_device_acquire (gltc->device))
 	return;
 
-    glFinish ();
+    glFlush ();
 
     cairo_device_release (gltc->device);
 }
diff --git a/boilerplate/cairo-boilerplate-wgl.c b/boilerplate/cairo-boilerplate-wgl.c
index 9088177..ae4dcc2 100644
--- a/boilerplate/cairo-boilerplate-wgl.c
+++ b/boilerplate/cairo-boilerplate-wgl.c
@@ -200,7 +200,7 @@ _cairo_boilerplate_wgl_synchronize (void *closure)
     if (cairo_device_acquire (wgltc->device))
 	return;
 
-    glFinish ();
+    glFlush ();
 
     cairo_device_release (wgltc->device);
 }
-- 
1.8.1.2


More information about the cairo mailing list