diff mbox

[Branch,~glmark2-dev/glmark2/trunk] Rev 79: gles2: Ensure our screen updates are not synchronized with the vertical retrace (LP: 761855).

Message ID 20110721123635.17019.77346.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

alexandros.frantzis@linaro.org July 21, 2011, 12:36 p.m. UTC
------------------------------------------------------------
revno: 79
committer: Alexandros Frantzis <alexandros.frantzis@linaro.org>
timestamp: Fri 2011-04-15 21:20:15 +0300
message:
  gles2: Ensure our screen updates are not synchronized with the vertical retrace (LP: 761855).
modified:
  src/screen-sdl-glesv2.cpp
  src/sdlgles/SDL_gles.c
  src/sdlgles/SDL_gles.h


--
lp:glmark2
https://code.launchpad.net/~glmark2-dev/glmark2/trunk

You are subscribed to branch lp:glmark2.
To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'src/screen-sdl-glesv2.cpp'
--- src/screen-sdl-glesv2.cpp	2011-04-15 17:36:47 +0000
+++ src/screen-sdl-glesv2.cpp	2011-04-15 18:20:15 +0000
@@ -45,6 +45,11 @@ 
         return;
     }
 
+    if (SDL_GLES_SetSwapInterval(0) != 0) {
+        fprintf(stderr, "[ Fail ] - GLES set swap interval: %s\n", SDL_GetError());
+        return;
+    }
+
 #ifdef _DEBUG
     {
     int buf, red, green, blue, alpha, depth;

=== modified file 'src/sdlgles/SDL_gles.c'
--- src/sdlgles/SDL_gles.c	2010-07-12 13:37:04 +0000
+++ src/sdlgles/SDL_gles.c	2011-04-15 18:20:15 +0000
@@ -377,6 +377,17 @@ 
 	return 0;
 }
 
+int SDL_GLES_SetSwapInterval(int interval)
+{
+	if (!eglSwapInterval(egl_display, interval)) {
+		SDL_SetError("EGL failed to set swap interval: %s",
+			get_error_string(eglGetError()));
+		return -1;
+	}
+
+	return 0;
+}
+
 void SDL_GLES_SwapBuffers()
 {
 	eglSwapBuffers(egl_display, egl_surface);

=== modified file 'src/sdlgles/SDL_gles.h'
--- src/sdlgles/SDL_gles.h	2010-07-12 13:37:04 +0000
+++ src/sdlgles/SDL_gles.h	2011-04-15 18:20:15 +0000
@@ -93,6 +93,12 @@ 
   */
 extern DECLSPEC int SDLCALL SDL_GLES_MakeCurrent(SDL_GLES_Context *context);
 
+/** Sets the swap interval for the current SDL_GLES context
+  * @param interval 0 for immediate updates, 1 for updates synchronized with the vertical retrace.
+  * @return 0 if everything went OK.
+  */
+extern DECLSPEC int SDLCALL SDL_GLES_SetSwapInterval(int interval);
+
 /** Equivalent to SDL_Flip(). Call when you're finished issuing GL calls
   * and want to draw the color buffer contents to the window surface.
   */