summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2013-01-29 16:08:36 +0000
committerRobert Bragg <robert@linux.intel.com>2013-02-15 16:31:18 +0000
commit24e6a5376ed3982f5647e2c2df0618272c381636 (patch)
tree83846512214227d0aa9f7780bc96d1df85ec7274 /tests
parent567f049d20554bb8ea4e40fa5e72a9fd0bbd409e (diff)
downloadcogl-24e6a5376ed3982f5647e2c2df0618272c381636.tar.gz
test-journal: use new _add_frame_callback api
This updates test-journal to use the new cogl_onscreen_add_frame_callback() api to use _SYNC events for throttling.
Diffstat (limited to 'tests')
-rw-r--r--tests/micro-perf/test-journal.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/tests/micro-perf/test-journal.c b/tests/micro-perf/test-journal.c
index 42de7a57..dec485b1 100644
--- a/tests/micro-perf/test-journal.c
+++ b/tests/micro-perf/test-journal.c
@@ -120,20 +120,17 @@ paint_cb (void *user_data)
data->frame = 0;
}
- /* If the driver can deliver swap complete events then we can remove
- * the idle paint callback until we next get a swap complete event
- * otherwise we keep the idle paint callback installed and simply
- * paint as fast as the driver will allow... */
- if (cogl_has_feature (data->ctx, COGL_FEATURE_ID_SWAP_BUFFERS_EVENT))
- return FALSE; /* remove the callback */
- else
- return TRUE;
+ return FALSE; /* remove the callback */
}
static void
-swap_complete_cb (CoglFramebuffer *framebuffer, void *user_data)
+frame_event_cb (CoglOnscreen *onscreen,
+ CoglFrameEvent event,
+ CoglFrameInfo *info,
+ void *user_data)
{
- g_idle_add (paint_cb, user_data);
+ if (event == COGL_FRAME_EVENT_SYNC)
+ g_idle_add (paint_cb, user_data);
}
int
@@ -172,9 +169,10 @@ main (int argc, char **argv)
g_source_attach (cogl_source, NULL);
- if (cogl_has_feature (data.ctx, COGL_FEATURE_ID_SWAP_BUFFERS_EVENT))
- cogl_onscreen_add_swap_buffers_callback (COGL_ONSCREEN (data.fb),
- swap_complete_cb, &data);
+ cogl_onscreen_add_frame_callback (COGL_ONSCREEN (data.fb),
+ frame_event_cb,
+ &data,
+ NULL); /* destroy notify */
g_idle_add (paint_cb, &data);