cogl/onscreen: Move binding to onscreen class

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
This commit is contained in:
Jonas Ådahl 2020-10-19 22:11:23 +02:00 committed by Robert Mader
parent fe72876b20
commit f663567405
11 changed files with 20 additions and 28 deletions

View File

@ -81,6 +81,9 @@ _cogl_onscreen_queue_dirty (CoglOnscreen *onscreen,
void
_cogl_onscreen_queue_full_dirty (CoglOnscreen *onscreen);
void
cogl_onscreen_bind (CoglOnscreen *onscreen);
COGL_EXPORT void
cogl_onscreen_set_winsys (CoglOnscreen *onscreen,
gpointer winsys);

View File

@ -301,6 +301,12 @@ _cogl_onscreen_queue_event (CoglOnscreen *onscreen,
_cogl_onscreen_queue_dispatch_idle (onscreen);
}
void
cogl_onscreen_bind (CoglOnscreen *onscreen)
{
COGL_ONSCREEN_GET_CLASS (onscreen)->bind (onscreen);
}
void
cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
const int *rectangles,

View File

@ -58,6 +58,8 @@ struct _CoglOnscreenClass
/*< private >*/
CoglFramebufferClass parent_class;
void (* bind) (CoglOnscreen *onscreen);
void (* swap_buffers_with_damage) (CoglOnscreen *onscreen,
const int *rectangles,
int n_rectangles,

View File

@ -165,10 +165,8 @@ cogl_gl_framebuffer_back_bind (CoglGlFramebuffer *gl_framebuffer,
CoglFramebuffer *framebuffer =
cogl_framebuffer_driver_get_framebuffer (driver);
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
const CoglWinsysVtable *winsys =
_cogl_framebuffer_get_winsys (framebuffer);
winsys->onscreen_bind (COGL_ONSCREEN (framebuffer));
cogl_onscreen_bind (COGL_ONSCREEN (framebuffer));
GE (ctx, glBindFramebuffer (target, 0));

View File

@ -126,7 +126,7 @@ cogl_onscreen_egl_dispose (GObject *object)
}
}
static gboolean
static void
bind_onscreen_with_context (CoglOnscreen *onscreen,
EGLContext egl_context)
{
@ -147,24 +147,16 @@ bind_onscreen_with_context (CoglOnscreen *onscreen,
eglSwapInterval (egl_renderer->edpy, 1);
}
return status;
}
static gboolean
bind_onscreen (CoglOnscreen *onscreen)
static void
cogl_onscreen_egl_bind (CoglOnscreen *onscreen)
{
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
CoglContext *context = cogl_framebuffer_get_context (framebuffer);
CoglDisplayEGL *egl_display = context->display->winsys;
return bind_onscreen_with_context (onscreen, egl_display->egl_context);
}
void
_cogl_winsys_onscreen_egl_bind (CoglOnscreen *onscreen)
{
bind_onscreen (onscreen);
bind_onscreen_with_context (onscreen, egl_display->egl_context);
}
#ifndef EGL_BUFFER_AGE_EXT
@ -358,6 +350,7 @@ cogl_onscreen_egl_class_init (CoglOnscreenEglClass *klass)
object_class->dispose = cogl_onscreen_egl_dispose;
onscreen_class->bind = cogl_onscreen_egl_bind;
onscreen_class->swap_buffers_with_damage =
cogl_onscreen_egl_swap_buffers_with_damage;
onscreen_class->swap_region = cogl_onscreen_egl_swap_region;

View File

@ -41,9 +41,6 @@ struct _CoglOnscreenEglClass
CoglOnscreenClass parent_class;
};
void
_cogl_winsys_onscreen_egl_bind (CoglOnscreen *onscreen);
int
_cogl_winsys_onscreen_egl_get_buffer_age (CoglOnscreen *onscreen);

View File

@ -272,8 +272,8 @@ cogl_onscreen_glx_dispose (GObject *object)
}
}
void
_cogl_winsys_onscreen_glx_bind (CoglOnscreen *onscreen)
static void
cogl_onscreen_glx_bind (CoglOnscreen *onscreen)
{
CoglOnscreenGlx *onscreen_glx = COGL_ONSCREEN_GLX (onscreen);
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
@ -1160,6 +1160,7 @@ cogl_onscreen_glx_class_init (CoglOnscreenGlxClass *klass)
framebuffer_class->allocate = cogl_onscreen_glx_allocate;
onscreen_class->bind = cogl_onscreen_glx_bind;
onscreen_class->swap_buffers_with_damage =
cogl_onscreen_glx_swap_buffers_with_damage;
onscreen_class->swap_region = cogl_onscreen_glx_swap_region;

View File

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

View File

@ -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_bind = _cogl_winsys_onscreen_egl_bind,
.onscreen_get_buffer_age = _cogl_winsys_onscreen_egl_get_buffer_age,
#if defined(EGL_KHR_fence_sync) || defined(EGL_KHR_reusable_sync)

View File

@ -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_bind = _cogl_winsys_onscreen_glx_bind,
.onscreen_get_buffer_age = _cogl_winsys_onscreen_glx_get_buffer_age,
.onscreen_x11_get_window_xid =
_cogl_winsys_onscreen_glx_get_window_xid,

View File

@ -104,9 +104,6 @@ typedef struct _CoglWinsysVtable
void
(*context_deinit) (CoglContext *context);
void
(*onscreen_bind) (CoglOnscreen *onscreen);
gboolean
(*onscreen_direct_scanout) (CoglOnscreen *onscreen,
CoglScanout *scanout,