cogl/onscreen: Move buffer age getter vfunc to class

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
This commit is contained in:
Jonas Ådahl 2020-10-19 23:43:10 +02:00 committed by Robert Mader
parent b2482a2069
commit 4f3b57c841
9 changed files with 11 additions and 21 deletions

View File

@ -414,16 +414,14 @@ int
cogl_onscreen_get_buffer_age (CoglOnscreen *onscreen) cogl_onscreen_get_buffer_age (CoglOnscreen *onscreen)
{ {
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
const CoglWinsysVtable *winsys; CoglOnscreenClass *klass = COGL_ONSCREEN_GET_CLASS (onscreen);
g_return_val_if_fail (COGL_IS_ONSCREEN (framebuffer), 0); g_return_val_if_fail (COGL_IS_ONSCREEN (framebuffer), 0);
winsys = _cogl_framebuffer_get_winsys (framebuffer); if (!klass->get_buffer_age)
if (!winsys->onscreen_get_buffer_age)
return 0; return 0;
return winsys->onscreen_get_buffer_age (onscreen); return klass->get_buffer_age (onscreen);
} }
gboolean gboolean

View File

@ -79,6 +79,8 @@ struct _CoglOnscreenClass
CoglFrameInfo *info, CoglFrameInfo *info,
gpointer user_data, gpointer user_data,
GError **error); GError **error);
int (* get_buffer_age) (CoglOnscreen *onscreen);
}; };
#define COGL_SCANOUT_ERROR (cogl_scanout_error_quark ()) #define COGL_SCANOUT_ERROR (cogl_scanout_error_quark ())

View File

@ -163,8 +163,8 @@ cogl_onscreen_egl_bind (CoglOnscreen *onscreen)
#define EGL_BUFFER_AGE_EXT 0x313D #define EGL_BUFFER_AGE_EXT 0x313D
#endif #endif
int static int
_cogl_winsys_onscreen_egl_get_buffer_age (CoglOnscreen *onscreen) cogl_onscreen_egl_get_buffer_age (CoglOnscreen *onscreen)
{ {
CoglOnscreenEgl *onscreen_egl = COGL_ONSCREEN_EGL (onscreen); CoglOnscreenEgl *onscreen_egl = COGL_ONSCREEN_EGL (onscreen);
CoglOnscreenEglPrivate *priv = CoglOnscreenEglPrivate *priv =
@ -354,4 +354,5 @@ cogl_onscreen_egl_class_init (CoglOnscreenEglClass *klass)
onscreen_class->swap_buffers_with_damage = onscreen_class->swap_buffers_with_damage =
cogl_onscreen_egl_swap_buffers_with_damage; cogl_onscreen_egl_swap_buffers_with_damage;
onscreen_class->swap_region = cogl_onscreen_egl_swap_region; onscreen_class->swap_region = cogl_onscreen_egl_swap_region;
onscreen_class->get_buffer_age = cogl_onscreen_egl_get_buffer_age;
} }

View File

@ -41,9 +41,6 @@ struct _CoglOnscreenEglClass
CoglOnscreenClass parent_class; CoglOnscreenClass parent_class;
}; };
int
_cogl_winsys_onscreen_egl_get_buffer_age (CoglOnscreen *onscreen);
COGL_EXPORT void COGL_EXPORT void
cogl_onscreen_egl_set_platform (CoglOnscreenEgl *onscreen_egl, cogl_onscreen_egl_set_platform (CoglOnscreenEgl *onscreen_egl,
gpointer platform); gpointer platform);

View File

@ -517,8 +517,8 @@ _cogl_winsys_get_vsync_counter (CoglContext *ctx)
#define GLX_BACK_BUFFER_AGE_EXT 0x20F4 #define GLX_BACK_BUFFER_AGE_EXT 0x20F4
#endif #endif
int static int
_cogl_winsys_onscreen_glx_get_buffer_age (CoglOnscreen *onscreen) cogl_onscreen_glx_get_buffer_age (CoglOnscreen *onscreen)
{ {
CoglOnscreenGlx *onscreen_glx = COGL_ONSCREEN_GLX (onscreen); CoglOnscreenGlx *onscreen_glx = COGL_ONSCREEN_GLX (onscreen);
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
@ -1112,4 +1112,5 @@ cogl_onscreen_glx_class_init (CoglOnscreenGlxClass *klass)
onscreen_class->swap_buffers_with_damage = onscreen_class->swap_buffers_with_damage =
cogl_onscreen_glx_swap_buffers_with_damage; cogl_onscreen_glx_swap_buffers_with_damage;
onscreen_class->swap_region = cogl_onscreen_glx_swap_region; onscreen_class->swap_region = cogl_onscreen_glx_swap_region;
onscreen_class->get_buffer_age = cogl_onscreen_glx_get_buffer_age;
} }

View File

@ -41,9 +41,6 @@ cogl_onscreen_glx_new (CoglContext *context,
int width, int width,
int height); int height);
int
_cogl_winsys_onscreen_glx_get_buffer_age (CoglOnscreen *onscreen);
void void
cogl_onscreen_glx_resize (CoglOnscreen *onscreen, cogl_onscreen_glx_resize (CoglOnscreen *onscreen,
XConfigureEvent *configure_event); XConfigureEvent *configure_event);

View File

@ -636,7 +636,6 @@ static CoglWinsysVtable _cogl_winsys_vtable =
.display_destroy = _cogl_winsys_display_destroy, .display_destroy = _cogl_winsys_display_destroy,
.context_init = _cogl_winsys_context_init, .context_init = _cogl_winsys_context_init,
.context_deinit = _cogl_winsys_context_deinit, .context_deinit = _cogl_winsys_context_deinit,
.onscreen_get_buffer_age = _cogl_winsys_onscreen_egl_get_buffer_age,
#if defined(EGL_KHR_fence_sync) || defined(EGL_KHR_reusable_sync) #if defined(EGL_KHR_fence_sync) || defined(EGL_KHR_reusable_sync)
.fence_add = _cogl_winsys_fence_add, .fence_add = _cogl_winsys_fence_add,

View File

@ -1469,7 +1469,6 @@ static CoglWinsysVtable _cogl_winsys_vtable =
.context_init = _cogl_winsys_context_init, .context_init = _cogl_winsys_context_init,
.context_deinit = _cogl_winsys_context_deinit, .context_deinit = _cogl_winsys_context_deinit,
.context_get_clock_time = _cogl_winsys_get_clock_time, .context_get_clock_time = _cogl_winsys_get_clock_time,
.onscreen_get_buffer_age = _cogl_winsys_onscreen_glx_get_buffer_age,
/* X11 tfp support... */ /* X11 tfp support... */
/* XXX: instead of having a rather monolithic winsys vtable we could /* XXX: instead of having a rather monolithic winsys vtable we could

View File

@ -32,7 +32,6 @@
#define __COGL_WINSYS_PRIVATE_H #define __COGL_WINSYS_PRIVATE_H
#include "cogl-renderer.h" #include "cogl-renderer.h"
#include "cogl-onscreen.h"
#include "cogl-scanout.h" #include "cogl-scanout.h"
#ifdef COGL_HAS_XLIB_SUPPORT #ifdef COGL_HAS_XLIB_SUPPORT
@ -109,9 +108,6 @@ typedef struct _CoglWinsysVtable
int64_t int64_t
(*context_get_clock_time) (CoglContext *context); (*context_get_clock_time) (CoglContext *context);
int
(*onscreen_get_buffer_age) (CoglOnscreen *onscreen);
#ifdef COGL_HAS_XLIB_SUPPORT #ifdef COGL_HAS_XLIB_SUPPORT
gboolean gboolean
(*texture_pixmap_x11_create) (CoglTexturePixmapX11 *tex_pixmap); (*texture_pixmap_x11_create) (CoglTexturePixmapX11 *tex_pixmap);