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:
parent
b2482a2069
commit
4f3b57c841
9 changed files with 11 additions and 21 deletions
|
@ -414,16 +414,14 @@ int
|
|||
cogl_onscreen_get_buffer_age (CoglOnscreen *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);
|
||||
|
||||
winsys = _cogl_framebuffer_get_winsys (framebuffer);
|
||||
|
||||
if (!winsys->onscreen_get_buffer_age)
|
||||
if (!klass->get_buffer_age)
|
||||
return 0;
|
||||
|
||||
return winsys->onscreen_get_buffer_age (onscreen);
|
||||
return klass->get_buffer_age (onscreen);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -79,6 +79,8 @@ struct _CoglOnscreenClass
|
|||
CoglFrameInfo *info,
|
||||
gpointer user_data,
|
||||
GError **error);
|
||||
|
||||
int (* get_buffer_age) (CoglOnscreen *onscreen);
|
||||
};
|
||||
|
||||
#define COGL_SCANOUT_ERROR (cogl_scanout_error_quark ())
|
||||
|
|
|
@ -163,8 +163,8 @@ cogl_onscreen_egl_bind (CoglOnscreen *onscreen)
|
|||
#define EGL_BUFFER_AGE_EXT 0x313D
|
||||
#endif
|
||||
|
||||
int
|
||||
_cogl_winsys_onscreen_egl_get_buffer_age (CoglOnscreen *onscreen)
|
||||
static int
|
||||
cogl_onscreen_egl_get_buffer_age (CoglOnscreen *onscreen)
|
||||
{
|
||||
CoglOnscreenEgl *onscreen_egl = COGL_ONSCREEN_EGL (onscreen);
|
||||
CoglOnscreenEglPrivate *priv =
|
||||
|
@ -354,4 +354,5 @@ cogl_onscreen_egl_class_init (CoglOnscreenEglClass *klass)
|
|||
onscreen_class->swap_buffers_with_damage =
|
||||
cogl_onscreen_egl_swap_buffers_with_damage;
|
||||
onscreen_class->swap_region = cogl_onscreen_egl_swap_region;
|
||||
onscreen_class->get_buffer_age = cogl_onscreen_egl_get_buffer_age;
|
||||
}
|
||||
|
|
|
@ -41,9 +41,6 @@ struct _CoglOnscreenEglClass
|
|||
CoglOnscreenClass parent_class;
|
||||
};
|
||||
|
||||
int
|
||||
_cogl_winsys_onscreen_egl_get_buffer_age (CoglOnscreen *onscreen);
|
||||
|
||||
COGL_EXPORT void
|
||||
cogl_onscreen_egl_set_platform (CoglOnscreenEgl *onscreen_egl,
|
||||
gpointer platform);
|
||||
|
|
|
@ -517,8 +517,8 @@ _cogl_winsys_get_vsync_counter (CoglContext *ctx)
|
|||
#define GLX_BACK_BUFFER_AGE_EXT 0x20F4
|
||||
#endif
|
||||
|
||||
int
|
||||
_cogl_winsys_onscreen_glx_get_buffer_age (CoglOnscreen *onscreen)
|
||||
static int
|
||||
cogl_onscreen_glx_get_buffer_age (CoglOnscreen *onscreen)
|
||||
{
|
||||
CoglOnscreenGlx *onscreen_glx = COGL_ONSCREEN_GLX (onscreen);
|
||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||
|
@ -1112,4 +1112,5 @@ cogl_onscreen_glx_class_init (CoglOnscreenGlxClass *klass)
|
|||
onscreen_class->swap_buffers_with_damage =
|
||||
cogl_onscreen_glx_swap_buffers_with_damage;
|
||||
onscreen_class->swap_region = cogl_onscreen_glx_swap_region;
|
||||
onscreen_class->get_buffer_age = cogl_onscreen_glx_get_buffer_age;
|
||||
}
|
||||
|
|
|
@ -41,9 +41,6 @@ cogl_onscreen_glx_new (CoglContext *context,
|
|||
int width,
|
||||
int height);
|
||||
|
||||
int
|
||||
_cogl_winsys_onscreen_glx_get_buffer_age (CoglOnscreen *onscreen);
|
||||
|
||||
void
|
||||
cogl_onscreen_glx_resize (CoglOnscreen *onscreen,
|
||||
XConfigureEvent *configure_event);
|
||||
|
|
|
@ -636,7 +636,6 @@ static CoglWinsysVtable _cogl_winsys_vtable =
|
|||
.display_destroy = _cogl_winsys_display_destroy,
|
||||
.context_init = _cogl_winsys_context_init,
|
||||
.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)
|
||||
.fence_add = _cogl_winsys_fence_add,
|
||||
|
|
|
@ -1469,7 +1469,6 @@ static CoglWinsysVtable _cogl_winsys_vtable =
|
|||
.context_init = _cogl_winsys_context_init,
|
||||
.context_deinit = _cogl_winsys_context_deinit,
|
||||
.context_get_clock_time = _cogl_winsys_get_clock_time,
|
||||
.onscreen_get_buffer_age = _cogl_winsys_onscreen_glx_get_buffer_age,
|
||||
|
||||
/* X11 tfp support... */
|
||||
/* XXX: instead of having a rather monolithic winsys vtable we could
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#define __COGL_WINSYS_PRIVATE_H
|
||||
|
||||
#include "cogl-renderer.h"
|
||||
#include "cogl-onscreen.h"
|
||||
#include "cogl-scanout.h"
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
|
@ -109,9 +108,6 @@ typedef struct _CoglWinsysVtable
|
|||
int64_t
|
||||
(*context_get_clock_time) (CoglContext *context);
|
||||
|
||||
int
|
||||
(*onscreen_get_buffer_age) (CoglOnscreen *onscreen);
|
||||
|
||||
#ifdef COGL_HAS_XLIB_SUPPORT
|
||||
gboolean
|
||||
(*texture_pixmap_x11_create) (CoglTexturePixmapX11 *tex_pixmap);
|
||||
|
|
Loading…
Reference in a new issue