From 1c20ba4c323b9d999942e0d0ca7fa48b2ddd4d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Sat, 10 Oct 2020 00:39:53 +0200 Subject: [PATCH] cogl/onscreen: Add way to manually add frame infos We will soon need to use CoglOnscreen frame events communicate cursor plane changes; this means we need to have a way to queue them without going through any of the current APIs that can do so, i.e. the swap buffer functions and direct scanout. Add a function that just adds a frame info to the queue. The one who adds it is responsible for emitting it too. Part-of: --- cogl/cogl/cogl-onscreen.c | 8 ++++++++ cogl/cogl/cogl-onscreen.h | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/cogl/cogl/cogl-onscreen.c b/cogl/cogl/cogl-onscreen.c index 367fd2698..30aacbf6f 100644 --- a/cogl/cogl/cogl-onscreen.c +++ b/cogl/cogl/cogl-onscreen.c @@ -457,6 +457,14 @@ cogl_onscreen_direct_scanout (CoglOnscreen *onscreen, return TRUE; } +void +cogl_onscreen_add_frame_info (CoglOnscreen *onscreen, + CoglFrameInfo *info) +{ + info->frame_counter = onscreen->frame_counter; + g_queue_push_tail (&onscreen->pending_frame_infos, info); +} + #ifdef COGL_HAS_X11_SUPPORT uint32_t cogl_x11_onscreen_get_window_xid (CoglOnscreen *onscreen) diff --git a/cogl/cogl/cogl-onscreen.h b/cogl/cogl/cogl-onscreen.h index f0b143fa8..308513a30 100644 --- a/cogl/cogl/cogl-onscreen.h +++ b/cogl/cogl/cogl-onscreen.h @@ -304,6 +304,13 @@ cogl_onscreen_direct_scanout (CoglOnscreen *onscreen, gpointer user_data, GError **error); +/** + * cogl_onscreen_add_frame_info: (skip) + */ +COGL_EXPORT void +cogl_onscreen_add_frame_info (CoglOnscreen *onscreen, + CoglFrameInfo *info); + /** * cogl_onscreen_swap_region: * @onscreen: A #CoglOnscreen framebuffer