diff --git a/clutter/clutter/cogl/clutter-stage-cogl.c b/clutter/clutter/cogl/clutter-stage-cogl.c index f7f71e6e1..44cb37acc 100644 --- a/clutter/clutter/cogl/clutter-stage-cogl.c +++ b/clutter/clutter/cogl/clutter-stage-cogl.c @@ -369,6 +369,7 @@ swap_framebuffer (ClutterStageWindow *stage_window, { CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer); int *damage, n_rects, i; + CoglFrameInfo *frame_info; n_rects = cairo_region_num_rectangles (swap_region); damage = g_newa (int, n_rects * 4); @@ -383,6 +384,8 @@ swap_framebuffer (ClutterStageWindow *stage_window, damage[i * 4 + 3] = rect.height; } + frame_info = cogl_frame_info_new (); + /* push on the screen */ if (n_rects > 0 && !swap_with_damage) { @@ -391,7 +394,8 @@ swap_framebuffer (ClutterStageWindow *stage_window, onscreen); cogl_onscreen_swap_region (onscreen, - damage, n_rects); + damage, n_rects, + frame_info); return FALSE; } @@ -401,7 +405,8 @@ swap_framebuffer (ClutterStageWindow *stage_window, onscreen); cogl_onscreen_swap_buffers_with_damage (onscreen, - damage, n_rects); + damage, n_rects, + frame_info); return TRUE; } @@ -747,11 +752,15 @@ clutter_stage_cogl_scanout_view (ClutterStageCogl *stage_cogl, { CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view); CoglOnscreen *onscreen; + CoglFrameInfo *frame_info; g_return_if_fail (cogl_is_onscreen (framebuffer)); onscreen = COGL_ONSCREEN (framebuffer); - cogl_onscreen_direct_scanout (onscreen, scanout); + + frame_info = cogl_frame_info_new (); + + cogl_onscreen_direct_scanout (onscreen, scanout, frame_info); } static void diff --git a/cogl/cogl/cogl-frame-info-private.h b/cogl/cogl/cogl-frame-info-private.h index f0324f251..585e2c2e7 100644 --- a/cogl/cogl/cogl-frame-info-private.h +++ b/cogl/cogl/cogl-frame-info-private.h @@ -45,6 +45,7 @@ struct _CoglFrameInfo int64_t global_frame_counter; }; -CoglFrameInfo *_cogl_frame_info_new (void); +COGL_EXPORT +CoglFrameInfo *cogl_frame_info_new (void); #endif /* __COGL_FRAME_INFO_PRIVATE_H */ diff --git a/cogl/cogl/cogl-frame-info.c b/cogl/cogl/cogl-frame-info.c index 1071495a0..a6e9f3260 100644 --- a/cogl/cogl/cogl-frame-info.c +++ b/cogl/cogl/cogl-frame-info.c @@ -39,7 +39,7 @@ COGL_OBJECT_DEFINE (FrameInfo, frame_info); COGL_GTYPE_DEFINE_CLASS (FrameInfo, frame_info); CoglFrameInfo * -_cogl_frame_info_new (void) +cogl_frame_info_new (void) { CoglFrameInfo *info; diff --git a/cogl/cogl/cogl-frame-info.h b/cogl/cogl/cogl-frame-info.h index 8acbb34bd..2204bafdb 100644 --- a/cogl/cogl/cogl-frame-info.h +++ b/cogl/cogl/cogl-frame-info.h @@ -45,6 +45,11 @@ G_BEGIN_DECLS +/** + * CoglFrameInfo: + * + * Frame information. + */ typedef struct _CoglFrameInfo CoglFrameInfo; #define COGL_FRAME_INFO(X) ((CoglFrameInfo *)(X)) diff --git a/cogl/cogl/cogl-onscreen.c b/cogl/cogl/cogl-onscreen.c index 892a0af3b..a3c1514a5 100644 --- a/cogl/cogl/cogl-onscreen.c +++ b/cogl/cogl/cogl-onscreen.c @@ -293,15 +293,14 @@ _cogl_onscreen_queue_event (CoglOnscreen *onscreen, void cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, const int *rectangles, - int n_rectangles) + int n_rectangles, + CoglFrameInfo *info) { CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); const CoglWinsysVtable *winsys; - CoglFrameInfo *info; g_return_if_fail (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN); - info = _cogl_frame_info_new (); info->frame_counter = onscreen->frame_counter; g_queue_push_tail (&onscreen->pending_frame_infos, info); @@ -310,7 +309,8 @@ cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, winsys = _cogl_framebuffer_get_winsys (framebuffer); winsys->onscreen_swap_buffers_with_damage (onscreen, - rectangles, n_rectangles); + rectangles, n_rectangles, + info); cogl_framebuffer_discard_buffers (framebuffer, COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_DEPTH | @@ -334,23 +334,23 @@ cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, } void -cogl_onscreen_swap_buffers (CoglOnscreen *onscreen) +cogl_onscreen_swap_buffers (CoglOnscreen *onscreen, + CoglFrameInfo *info) { - cogl_onscreen_swap_buffers_with_damage (onscreen, NULL, 0); + cogl_onscreen_swap_buffers_with_damage (onscreen, NULL, 0, info); } void cogl_onscreen_swap_region (CoglOnscreen *onscreen, const int *rectangles, - int n_rectangles) + int n_rectangles, + CoglFrameInfo *info) { CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); const CoglWinsysVtable *winsys; - CoglFrameInfo *info; g_return_if_fail (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN); - info = _cogl_frame_info_new (); info->frame_counter = onscreen->frame_counter; g_queue_push_tail (&onscreen->pending_frame_infos, info); @@ -365,7 +365,8 @@ cogl_onscreen_swap_region (CoglOnscreen *onscreen, winsys->onscreen_swap_region (COGL_ONSCREEN (framebuffer), rectangles, - n_rectangles); + n_rectangles, + info); cogl_framebuffer_discard_buffers (framebuffer, COGL_BUFFER_BIT_COLOR | @@ -406,22 +407,21 @@ cogl_onscreen_get_buffer_age (CoglOnscreen *onscreen) } void -cogl_onscreen_direct_scanout (CoglOnscreen *onscreen, - CoglScanout *scanout) +cogl_onscreen_direct_scanout (CoglOnscreen *onscreen, + CoglScanout *scanout, + CoglFrameInfo *info) { CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); const CoglWinsysVtable *winsys; - CoglFrameInfo *info; g_return_if_fail (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN); g_return_if_fail (_cogl_winsys_has_feature (COGL_WINSYS_FEATURE_SYNC_AND_COMPLETE_EVENT)); - info = _cogl_frame_info_new (); info->frame_counter = onscreen->frame_counter; g_queue_push_tail (&onscreen->pending_frame_infos, info); winsys = _cogl_framebuffer_get_winsys (framebuffer); - winsys->onscreen_direct_scanout (onscreen, scanout); + winsys->onscreen_direct_scanout (onscreen, scanout, info); onscreen->frame_counter++; } diff --git a/cogl/cogl/cogl-onscreen.h b/cogl/cogl/cogl-onscreen.h index 845470350..e70d3f806 100644 --- a/cogl/cogl/cogl-onscreen.h +++ b/cogl/cogl/cogl-onscreen.h @@ -178,7 +178,8 @@ cogl_onscreen_hide (CoglOnscreen *onscreen); * Stability: unstable */ COGL_EXPORT void -cogl_onscreen_swap_buffers (CoglOnscreen *onscreen); +cogl_onscreen_swap_buffers (CoglOnscreen *onscreen, + CoglFrameInfo *frame_info); /** @@ -284,14 +285,16 @@ cogl_onscreen_get_buffer_age (CoglOnscreen *onscreen); COGL_EXPORT void cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, const int *rectangles, - int n_rectangles); + int n_rectangles, + CoglFrameInfo *info); /** * cogl_onscreen_direct_scanout: (skip) */ COGL_EXPORT void -cogl_onscreen_direct_scanout (CoglOnscreen *onscreen, - CoglScanout *scanout); +cogl_onscreen_direct_scanout (CoglOnscreen *onscreen, + CoglScanout *scanout, + CoglFrameInfo *info); /** * cogl_onscreen_swap_region: @@ -316,7 +319,8 @@ cogl_onscreen_direct_scanout (CoglOnscreen *onscreen, COGL_EXPORT void cogl_onscreen_swap_region (CoglOnscreen *onscreen, const int *rectangles, - int n_rectangles); + int n_rectangles, + CoglFrameInfo *info); /** * CoglFrameEvent: diff --git a/cogl/cogl/meson.build b/cogl/cogl/meson.build index edcac793e..2947b46c9 100644 --- a/cogl/cogl/meson.build +++ b/cogl/cogl/meson.build @@ -77,6 +77,7 @@ cogl_headers = [ 'cogl-bitmap.h', 'cogl-color.h', 'cogl-context.h', + 'cogl-frame-info.h', 'cogl-framebuffer.h', 'cogl-matrix.h', 'cogl-object.h', @@ -106,7 +107,6 @@ cogl_nonintrospected_headers = [ 'cogl-indices.h', 'cogl-attribute.h', 'cogl-primitive.h', - 'cogl-frame-info.h', 'cogl-output.h', 'cogl-matrix-stack.h', 'cogl-poll.h', diff --git a/cogl/cogl/winsys/cogl-winsys-egl.c b/cogl/cogl/winsys/cogl-winsys-egl.c index 5dd106d1b..8c999c52b 100644 --- a/cogl/cogl/winsys/cogl-winsys-egl.c +++ b/cogl/cogl/winsys/cogl-winsys-egl.c @@ -726,7 +726,8 @@ _cogl_winsys_onscreen_get_buffer_age (CoglOnscreen *onscreen) static void _cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen, const int *user_rectangles, - int n_rectangles) + int n_rectangles, + CoglFrameInfo *info) { CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; CoglRenderer *renderer = context->display->renderer; @@ -765,7 +766,8 @@ _cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen, static void _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, const int *rectangles, - int n_rectangles) + int n_rectangles, + CoglFrameInfo *info) { CoglContext *context = COGL_FRAMEBUFFER (onscreen)->context; CoglRenderer *renderer = context->display->renderer; diff --git a/cogl/cogl/winsys/cogl-winsys-glx.c b/cogl/cogl/winsys/cogl-winsys-glx.c index 86d5acd05..0b1c1eac2 100644 --- a/cogl/cogl/winsys/cogl-winsys-glx.c +++ b/cogl/cogl/winsys/cogl-winsys-glx.c @@ -1673,7 +1673,8 @@ set_frame_info_output (CoglOnscreen *onscreen, static void _cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen, const int *user_rectangles, - int n_rectangles) + int n_rectangles, + CoglFrameInfo *info) { CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); CoglContext *context = framebuffer->context; @@ -1879,7 +1880,8 @@ _cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen, static void _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, const int *rectangles, - int n_rectangles) + int n_rectangles, + CoglFrameInfo *info) { CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); CoglContext *context = framebuffer->context; diff --git a/cogl/cogl/winsys/cogl-winsys-private.h b/cogl/cogl/winsys/cogl-winsys-private.h index 01a45b765..b9dbff524 100644 --- a/cogl/cogl/winsys/cogl-winsys-private.h +++ b/cogl/cogl/winsys/cogl-winsys-private.h @@ -116,11 +116,13 @@ typedef struct _CoglWinsysVtable void (*onscreen_swap_buffers_with_damage) (CoglOnscreen *onscreen, const int *rectangles, - int n_rectangles); + int n_rectangles, + CoglFrameInfo *info); void - (*onscreen_direct_scanout) (CoglOnscreen *onscreen, - CoglScanout *scanout); + (*onscreen_direct_scanout) (CoglOnscreen *onscreen, + CoglScanout *scanout, + CoglFrameInfo *info); void (*onscreen_set_visibility) (CoglOnscreen *onscreen, @@ -134,7 +136,8 @@ typedef struct _CoglWinsysVtable void (*onscreen_swap_region) (CoglOnscreen *onscreen, const int *rectangles, - int n_rectangles); + int n_rectangles, + CoglFrameInfo *info); void (*onscreen_set_resizable) (CoglOnscreen *onscreen, gboolean resizable); diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c index 9034c800a..8d50a828d 100644 --- a/src/backends/native/meta-renderer-native.c +++ b/src/backends/native/meta-renderer-native.c @@ -2067,9 +2067,10 @@ ensure_crtc_modes (CoglOnscreen *onscreen, } static void -meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen, - const int *rectangles, - int n_rectangles) +meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen, + const int *rectangles, + int n_rectangles, + CoglFrameInfo *frame_info) { CoglContext *cogl_context = COGL_FRAMEBUFFER (onscreen)->context; CoglDisplay *cogl_display = cogl_context_get_display (cogl_context); @@ -2084,7 +2085,6 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen, CoglOnscreenEGL *onscreen_egl = onscreen->winsys; MetaOnscreenNative *onscreen_native = onscreen_egl->platform; MetaGpuKms *render_gpu = onscreen_native->render_gpu; - CoglFrameInfo *frame_info; gboolean egl_context_changed = FALSE; MetaKmsUpdate *kms_update; g_autoptr (GError) error = NULL; @@ -2112,7 +2112,8 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen, parent_vtable->onscreen_swap_buffers_with_damage (onscreen, rectangles, - n_rectangles); + n_rectangles, + frame_info); renderer_gpu_data = meta_renderer_native_get_gpu_data (renderer_native, render_gpu); @@ -2296,8 +2297,9 @@ meta_onscreen_native_is_buffer_scanout_compatible (CoglOnscreen *onscreen, } static void -meta_onscreen_native_direct_scanout (CoglOnscreen *onscreen, - CoglScanout *scanout) +meta_onscreen_native_direct_scanout (CoglOnscreen *onscreen, + CoglScanout *scanout, + CoglFrameInfo *frame_info) { CoglOnscreenEGL *onscreen_egl = onscreen->winsys; MetaOnscreenNative *onscreen_native = onscreen_egl->platform; @@ -2311,7 +2313,6 @@ meta_onscreen_native_direct_scanout (CoglOnscreen *onscreen, MetaBackend *backend = meta_renderer_get_backend (renderer); MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend); MetaKms *kms = meta_backend_native_get_kms (backend_native); - CoglFrameInfo *frame_info; MetaKmsUpdate *kms_update; g_autoptr (GError) error = NULL; diff --git a/src/backends/x11/nested/meta-stage-x11-nested.c b/src/backends/x11/nested/meta-stage-x11-nested.c index 2d9c2ea55..00683a569 100644 --- a/src/backends/x11/nested/meta-stage-x11-nested.c +++ b/src/backends/x11/nested/meta-stage-x11-nested.c @@ -168,6 +168,7 @@ meta_stage_x11_nested_finish_frame (ClutterStageWindow *stage_window) ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); CoglFramebuffer *onscreen = COGL_FRAMEBUFFER (stage_x11->onscreen); GList *l; + CoglFrameInfo *frame_info; if (!stage_nested->pipeline) stage_nested->pipeline = cogl_pipeline_new (clutter_backend->cogl_context); @@ -193,7 +194,8 @@ meta_stage_x11_nested_finish_frame (ClutterStageWindow *stage_window) draw_view (stage_nested, renderer_view, texture); } - cogl_onscreen_swap_buffers (stage_x11->onscreen); + frame_info = cogl_frame_info_new (); + cogl_onscreen_swap_buffers (stage_x11->onscreen, frame_info); } static void