diff --git a/clients/simple-egl.c b/clients/simple-egl.c index 9d401f9..b0c0273 100644 --- a/clients/simple-egl.c +++ b/clients/simple-egl.c @@ -99,7 +99,7 @@ struct window { struct ivi_surface *ivi_surface; EGLSurface egl_surface; struct wl_callback *callback; - int fullscreen, opaque, buffer_size, frame_sync; + int fullscreen, opaque, buffer_size, frame_sync, delay; bool wait_for_configure; }; @@ -548,6 +548,7 @@ redraw(void *data, struct wl_callback *callback, uint32_t time) } else { eglSwapBuffers(display->egl.dpy, window->egl_surface); } + usleep(window->delay); window->frames++; } @@ -828,6 +829,7 @@ usage(int error_code) " -o\tCreate an opaque surface\n" " -s\tUse a 16 bpp EGL config\n" " -b\tDon't sync to compositor redraw (eglSwapInterval 0)\n" + " -d \tBuffer swap delay in microseconds\n" " -h\tThis help text\n\n"); exit(error_code); @@ -848,9 +850,12 @@ main(int argc, char **argv) window.window_size = window.geometry; window.buffer_size = 32; window.frame_sync = 1; + window.delay = 0; for (i = 1; i < argc; i++) { - if (strcmp("-f", argv[i]) == 0) + if (strcmp("-d", argv[i]) == 0 && i+1 < argc) + window.delay = atoi(argv[++i]); + else if (strcmp("-f", argv[i]) == 0) window.fullscreen = 1; else if (strcmp("-o", argv[i]) == 0) window.opaque = 1;