diff options
author | Siarhei Siamashka <siarhei.siamashka@gmail.com> | 2011-05-15 22:35:35 +0300 |
---|---|---|
committer | Siarhei Siamashka <siarhei.siamashka@gmail.com> | 2011-05-15 22:35:35 +0300 |
commit | a72b75c23bf56053b901380a6a067cf1324d0011 (patch) | |
tree | 2d46200e579817dc68260b05c094e06d7b7a97e1 | |
parent | ae80834f624b8c9d4f148c63a7894b2e6ab78e3b (diff) |
XSync does not guarantee that XRENDER based rendering really finished.
Apparently lots of compositing operations may be still queued and
the benchmark could report much smaller test execution times than
they actually were.
So try to read from all the surfaces in order to ensure that the
rendering is done and all the pending operations finished for them.
-rw-r--r-- | main.c | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -24,6 +24,7 @@ void xrender_surf_blend(Display *disp, Xrender_Surf *src, Xrender_Surf void populate_from_file(Display *disp, Xrender_Surf *rs, char *file); void main_loop(void); void setup_window(void); +void sync_after_test(void); int win_w = 320; int win_h = 320; @@ -49,7 +50,7 @@ time_test(char *description, void (*func) (void)) printf("Test: %s\n", description); t1 = get_time(); for (i = 0; i < REPS; i++) func(); - XSync(disp, False); + sync_after_test(); t2 = get_time(); t = t2 - t1; printf("Time: %3.3f sec.\n", t); @@ -187,6 +188,27 @@ Imlib_Image im_win = NULL; Imlib_Image im_img = NULL; void +touch_drawable(Display *disp, Drawable draw) +{ + XImage *image = image = XGetImage(disp, draw, 0, 0, 1, 1, 0xffffffff, ZPixmap); + if (image) + XDestroyImage(image); +} + +/* + * Try to read from all the surfaces in order to ensure that the + * rendering is done and all the pending operations finished for them. + */ +void +sync_after_test() +{ + touch_drawable(disp, surf_win->draw); + touch_drawable(disp, surf_off->draw); + touch_drawable(disp, surf_img->draw); + XSync(disp, False); +} + +void test_over_x(void) { int x, y; |