diff options
author | Owen W. Taylor <otaylor@fishsoup.net> | 2012-11-12 11:58:10 -0500 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2013-01-30 20:09:49 +0000 |
commit | 24733abf68ba326e415c6a17c0c1e59c3d303003 (patch) | |
tree | 5bd72440a72560dafaf764fc15c98018c3eea2a1 /cogl/winsys/cogl-winsys-egl-kms.c | |
parent | 5ce058c0e5cdbccdbfc4bff5b41023951ba549ab (diff) | |
download | cogl-24733abf68ba326e415c6a17c0c1e59c3d303003.tar.gz |
onscreen: Add CoglFrameInfo and _add_frame_callback() api
Add a CoglFrameInfo object that tracks timing information for frames
that are drawn. We track a frame counter and frame timing information
for each CoglOnscreen. Internally a CoglFrameInfo is automatically
created for each frame, delimited by cogl_onscreen_swap_buffers() or
cogl_onscreen_swap_region() calls.
CoglFrameInfos are delivered to applications via frame event callbacks
that can be registered with a new cogl_onscreen_add_frame_callback()
api. Two initial event types (dispatched on all platforms) have been
defined; a _SYNC event used for throttling the frame rate of
applications and a _COMPLETE event used so signify the end of a frame.
Note: This new _add_frame_callback() api makes the
cogl_onscreen_add_swap_complete_callback() api redundant and so it
should be considered deprecated. Since the _add_swap_complete_callback()
api is still experimental api, we will be looking to quickly migrate
users to the new api so we can remove the old api.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 700401667db2522045e4623d78797b17f9184501)
Diffstat (limited to 'cogl/winsys/cogl-winsys-egl-kms.c')
-rw-r--r-- | cogl/winsys/cogl-winsys-egl-kms.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cogl/winsys/cogl-winsys-egl-kms.c b/cogl/winsys/cogl-winsys-egl-kms.c index ff538e24..db2b4966 100644 --- a/cogl/winsys/cogl-winsys-egl-kms.c +++ b/cogl/winsys/cogl-winsys-egl-kms.c @@ -754,9 +754,13 @@ _cogl_winsys_egl_context_init (CoglContext *context, { COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_SWAP_BUFFERS_EVENT, TRUE); + /* TODO: remove this deprecated feature */ COGL_FLAGS_SET (context->winsys_features, COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT, TRUE); + COGL_FLAGS_SET (context->winsys_features, + COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT, + TRUE); return TRUE; } @@ -894,8 +898,13 @@ flush_pending_swap_notify_cb (void *data, if (kms_onscreen->pending_swap_notify) { - _cogl_onscreen_notify_swap_buffers (onscreen); + CoglFrameInfo *info = g_queue_pop_head (&onscreen->pending_frame_infos); + + _cogl_onscreen_notify_frame_sync (onscreen, info); + _cogl_onscreen_notify_complete (onscreen, info); kms_onscreen->pending_swap_notify = FALSE; + + cogl_object_unref (info); } } } |