[mutter] cogl: Move CoglOnscreen struct to C file



commit d0831cbbcdf745809efd45e6d6785e75ace4e1e3
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Sat Oct 17 00:11:27 2020 +0200

    cogl: Move CoglOnscreen struct to C file
    
    That means all sub types need to use helper methods, so make them do
    that too.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>

 cogl/cogl/cogl-onscreen-private.h          | 36 ++++++-------
 cogl/cogl/cogl-onscreen.c                  | 51 ++++++++++++++++++
 cogl/cogl/winsys/cogl-winsys-egl-x11.c     | 16 +++---
 cogl/cogl/winsys/cogl-winsys-egl.c         | 20 +++----
 cogl/cogl/winsys/cogl-winsys-glx.c         | 70 ++++++++++++------------
 src/backends/native/meta-renderer-native.c | 87 +++++++++++++++---------------
 6 files changed, 166 insertions(+), 114 deletions(-)
---
diff --git a/cogl/cogl/cogl-onscreen-private.h b/cogl/cogl/cogl-onscreen-private.h
index ad46273042..f7d44c0e29 100644
--- a/cogl/cogl/cogl-onscreen-private.h
+++ b/cogl/cogl/cogl-onscreen-private.h
@@ -55,26 +55,6 @@ typedef struct _CoglOnscreenQueuedDirty
   CoglOnscreenDirtyInfo info;
 } CoglOnscreenQueuedDirty;
 
-struct _CoglOnscreen
-{
-  CoglFramebuffer parent;
-
-  CoglList frame_closures;
-
-  gboolean resizable;
-  CoglList resize_closures;
-
-  CoglList dirty_closures;
-
-  int64_t frame_counter;
-  int64_t swap_frame_counter; /* frame counter at last all to
-                               * cogl_onscreen_swap_region() or
-                               * cogl_onscreen_swap_buffers() */
-  GQueue pending_frame_infos;
-
-  void *winsys;
-};
-
 COGL_EXPORT void
 _cogl_framebuffer_winsys_update_size (CoglFramebuffer *framebuffer,
                                       int width, int height);
@@ -101,4 +81,20 @@ _cogl_onscreen_queue_dirty (CoglOnscreen *onscreen,
 void
 _cogl_onscreen_queue_full_dirty (CoglOnscreen *onscreen);
 
+COGL_EXPORT void
+cogl_onscreen_set_winsys (CoglOnscreen *onscreen,
+                          gpointer      winsys);
+
+COGL_EXPORT gpointer
+cogl_onscreen_get_winsys (CoglOnscreen *onscreen);
+
+COGL_EXPORT CoglFrameInfo *
+cogl_onscreen_peek_head_frame_info (CoglOnscreen *onscreen);
+
+COGL_EXPORT CoglFrameInfo *
+cogl_onscreen_peek_tail_frame_info (CoglOnscreen *onscreen);
+
+COGL_EXPORT CoglFrameInfo *
+cogl_onscreen_pop_head_frame_info (CoglOnscreen *onscreen);
+
 #endif /* __COGL_ONSCREEN_PRIVATE_H */
diff --git a/cogl/cogl/cogl-onscreen.c b/cogl/cogl/cogl-onscreen.c
index 30aacbf6fb..77fbcd28f5 100644
--- a/cogl/cogl/cogl-onscreen.c
+++ b/cogl/cogl/cogl-onscreen.c
@@ -42,6 +42,26 @@
 #include "cogl-poll-private.h"
 #include "cogl-gtype-private.h"
 
+struct _CoglOnscreen
+{
+  CoglFramebuffer parent;
+
+  CoglList frame_closures;
+
+  gboolean resizable;
+  CoglList resize_closures;
+
+  CoglList dirty_closures;
+
+  int64_t frame_counter;
+  int64_t swap_frame_counter; /* frame counter at last all to
+                               * cogl_onscreen_swap_region() or
+                               * cogl_onscreen_swap_buffers() */
+  GQueue pending_frame_infos;
+
+  void *winsys;
+};
+
 G_DEFINE_TYPE (CoglOnscreen, cogl_onscreen, COGL_TYPE_FRAMEBUFFER)
 
 static gpointer
@@ -465,6 +485,24 @@ cogl_onscreen_add_frame_info (CoglOnscreen  *onscreen,
   g_queue_push_tail (&onscreen->pending_frame_infos, info);
 }
 
+CoglFrameInfo *
+cogl_onscreen_peek_head_frame_info (CoglOnscreen *onscreen)
+{
+  return g_queue_peek_head (&onscreen->pending_frame_infos);
+}
+
+CoglFrameInfo *
+cogl_onscreen_peek_tail_frame_info (CoglOnscreen *onscreen)
+{
+  return g_queue_peek_tail (&onscreen->pending_frame_infos);
+}
+
+CoglFrameInfo *
+cogl_onscreen_pop_head_frame_info (CoglOnscreen *onscreen)
+{
+  return g_queue_pop_head (&onscreen->pending_frame_infos);
+}
+
 #ifdef COGL_HAS_X11_SUPPORT
 uint32_t
 cogl_x11_onscreen_get_window_xid (CoglOnscreen *onscreen)
@@ -643,3 +681,16 @@ cogl_onscreen_get_frame_counter (CoglOnscreen *onscreen)
 {
   return onscreen->frame_counter;
 }
+
+void
+cogl_onscreen_set_winsys (CoglOnscreen *onscreen,
+                          gpointer      winsys)
+{
+  onscreen->winsys = winsys;
+}
+
+gpointer
+cogl_onscreen_get_winsys (CoglOnscreen *onscreen)
+{
+  return onscreen->winsys;
+}
diff --git a/cogl/cogl/winsys/cogl-winsys-egl-x11.c b/cogl/cogl/winsys/cogl-winsys-egl-x11.c
index 9ce1fa1085..cec9a0f2d4 100644
--- a/cogl/cogl/winsys/cogl-winsys-egl-x11.c
+++ b/cogl/cogl/winsys/cogl-winsys-egl-x11.c
@@ -84,7 +84,7 @@ find_onscreen_for_xid (CoglContext *context, uint32_t xid)
       if (!COGL_IS_ONSCREEN (framebuffer))
         continue;
 
-      egl_onscreen = COGL_ONSCREEN (framebuffer)->winsys;
+      egl_onscreen = cogl_onscreen_get_winsys (COGL_ONSCREEN (framebuffer));
       xlib_onscreen = egl_onscreen->platform;
       if (xlib_onscreen->xwin == (Window)xid)
         return COGL_ONSCREEN (framebuffer);
@@ -102,7 +102,7 @@ flush_pending_resize_notifications_cb (void *data,
   if (COGL_IS_ONSCREEN (framebuffer))
     {
       CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
-      CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
+      CoglOnscreenEGL *egl_onscreen = cogl_onscreen_get_winsys (onscreen);
 
       if (egl_onscreen->pending_resize_notify)
         {
@@ -144,7 +144,7 @@ notify_resize (CoglContext *context,
   if (!onscreen)
     return;
 
-  egl_onscreen = onscreen->winsys;
+  egl_onscreen = cogl_onscreen_get_winsys (onscreen);
 
   _cogl_framebuffer_winsys_update_size (framebuffer, width, height);
 
@@ -420,7 +420,7 @@ _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
   CoglXlibRenderer *xlib_renderer =
     _cogl_xlib_renderer_get_data (renderer);
   CoglOnscreenXlib *xlib_onscreen;
-  CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
+  CoglOnscreenEGL *egl_onscreen = cogl_onscreen_get_winsys (onscreen);
   Window xwin;
 
   /* FIXME: We need to explicitly Select for ConfigureNotify events.
@@ -518,7 +518,7 @@ _cogl_winsys_egl_onscreen_deinit (CoglOnscreen *onscreen)
   CoglXlibRenderer *xlib_renderer =
     _cogl_xlib_renderer_get_data (renderer);
   CoglXlibTrapState old_state;
-  CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
+  CoglOnscreenEGL *egl_onscreen = cogl_onscreen_get_winsys (onscreen);
   CoglOnscreenXlib *xlib_onscreen = egl_onscreen->platform;
 
   _cogl_xlib_renderer_trap_errors (renderer, &old_state);
@@ -549,7 +549,7 @@ _cogl_winsys_onscreen_set_visibility (CoglOnscreen *onscreen,
   CoglRenderer *renderer = context->display->renderer;
   CoglXlibRenderer *xlib_renderer =
     _cogl_xlib_renderer_get_data (renderer);
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   CoglOnscreenXlib *xlib_onscreen = onscreen_egl->platform;
 
   if (visibility)
@@ -566,7 +566,7 @@ _cogl_winsys_onscreen_set_resizable (CoglOnscreen *onscreen,
   CoglContext *context = cogl_framebuffer_get_context (framebuffer);
   CoglXlibRenderer *xlib_renderer =
     _cogl_xlib_renderer_get_data (context->display->renderer);
-  CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
+  CoglOnscreenEGL *egl_onscreen = cogl_onscreen_get_winsys (onscreen);
   CoglOnscreenXlib *xlib_onscreen = egl_onscreen->platform;
 
   XSizeHints *size_hints = XAllocSizeHints ();
@@ -600,7 +600,7 @@ _cogl_winsys_onscreen_set_resizable (CoglOnscreen *onscreen,
 static uint32_t
 _cogl_winsys_onscreen_x11_get_window_xid (CoglOnscreen *onscreen)
 {
-  CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
+  CoglOnscreenEGL *egl_onscreen = cogl_onscreen_get_winsys (onscreen);
   CoglOnscreenXlib *xlib_onscreen = egl_onscreen->platform;
 
   return xlib_onscreen->xwin;
diff --git a/cogl/cogl/winsys/cogl-winsys-egl.c b/cogl/cogl/winsys/cogl-winsys-egl.c
index 041a25b568..6600b71c08 100644
--- a/cogl/cogl/winsys/cogl-winsys-egl.c
+++ b/cogl/cogl/winsys/cogl-winsys-egl.c
@@ -599,6 +599,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
   EGLConfig egl_config;
   EGLint config_count = 0;
   EGLBoolean status;
+  CoglOnscreenEGL *winsys;
 
   g_return_val_if_fail (egl_display->egl_context, FALSE);
 
@@ -629,14 +630,15 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
       cogl_framebuffer_update_samples_per_pixel (framebuffer, samples);
     }
 
-  onscreen->winsys = g_slice_new0 (CoglOnscreenEGL);
+  winsys = g_slice_new0 (CoglOnscreenEGL);
+  cogl_onscreen_set_winsys (onscreen, winsys);
 
   if (egl_renderer->platform_vtable->onscreen_init &&
       !egl_renderer->platform_vtable->onscreen_init (onscreen,
                                                      egl_config,
                                                      error))
     {
-      g_slice_free (CoglOnscreenEGL, onscreen->winsys);
+      g_slice_free (CoglOnscreenEGL, winsys);
       return FALSE;
     }
 
@@ -651,7 +653,7 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
   CoglDisplayEGL *egl_display = context->display->winsys;
   CoglRenderer *renderer = context->display->renderer;
   CoglRendererEGL *egl_renderer = renderer->winsys;
-  CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
+  CoglOnscreenEGL *egl_onscreen = cogl_onscreen_get_winsys (onscreen);
 
   /* If we never successfully allocated then there's nothing to do */
   if (egl_onscreen == NULL)
@@ -683,8 +685,8 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
   if (egl_renderer->platform_vtable->onscreen_deinit)
     egl_renderer->platform_vtable->onscreen_deinit (onscreen);
 
-  g_slice_free (CoglOnscreenEGL, onscreen->winsys);
-  onscreen->winsys = NULL;
+  g_slice_free (CoglOnscreenEGL, cogl_onscreen_get_winsys (onscreen));
+  cogl_onscreen_set_winsys (onscreen, NULL);
 }
 
 static gboolean
@@ -693,7 +695,7 @@ bind_onscreen_with_context (CoglOnscreen *onscreen,
 {
   CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
   CoglContext *context = cogl_framebuffer_get_context (framebuffer);
-  CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
+  CoglOnscreenEGL *egl_onscreen = cogl_onscreen_get_winsys (onscreen);
 
   gboolean status = _cogl_winsys_egl_make_current (context->display,
                                                    egl_onscreen->egl_surface,
@@ -737,7 +739,7 @@ _cogl_winsys_onscreen_get_buffer_age (CoglOnscreen *onscreen)
   CoglContext *context = cogl_framebuffer_get_context (framebuffer);
   CoglRenderer *renderer = context->display->renderer;
   CoglRendererEGL *egl_renderer = renderer->winsys;
-  CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
+  CoglOnscreenEGL *egl_onscreen = cogl_onscreen_get_winsys (onscreen);
   CoglDisplayEGL *egl_display = context->display->winsys;
   EGLSurface surface = egl_onscreen->egl_surface;
   static gboolean warned = FALSE;
@@ -776,7 +778,7 @@ _cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen,
   CoglContext *context = cogl_framebuffer_get_context (framebuffer);
   CoglRenderer *renderer = context->display->renderer;
   CoglRendererEGL *egl_renderer = renderer->winsys;
-  CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
+  CoglOnscreenEGL *egl_onscreen = cogl_onscreen_get_winsys (onscreen);
   int framebuffer_height  = cogl_framebuffer_get_height (framebuffer);
   int *rectangles = g_alloca (sizeof (int) * n_rectangles * 4);
   int i;
@@ -817,7 +819,7 @@ _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
   CoglContext *context = cogl_framebuffer_get_context (framebuffer);
   CoglRenderer *renderer = context->display->renderer;
   CoglRendererEGL *egl_renderer = renderer->winsys;
-  CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
+  CoglOnscreenEGL *egl_onscreen = cogl_onscreen_get_winsys (onscreen);
 
   COGL_TRACE_BEGIN_SCOPED (CoglOnscreenEGLSwapBuffersWithDamage,
                            "Onscreen (eglSwapBuffers)");
diff --git a/cogl/cogl/winsys/cogl-winsys-glx.c b/cogl/cogl/winsys/cogl-winsys-glx.c
index 686b8ac69b..a05a21756e 100644
--- a/cogl/cogl/winsys/cogl-winsys-glx.c
+++ b/cogl/cogl/winsys/cogl-winsys-glx.c
@@ -182,7 +182,7 @@ find_onscreen_for_xid (CoglContext *context, uint32_t xid)
         continue;
 
       /* Does the GLXEvent have the GLXDrawable or the X Window? */
-      xlib_onscreen = COGL_ONSCREEN (framebuffer)->winsys;
+      xlib_onscreen = cogl_onscreen_get_winsys (COGL_ONSCREEN (framebuffer));
       if (xlib_onscreen != NULL && xlib_onscreen->xwin == (Window)xid)
         return COGL_ONSCREEN (framebuffer);
     }
@@ -334,7 +334,7 @@ flush_pending_notifications_cb (void *data,
   if (COGL_IS_ONSCREEN (framebuffer))
     {
       CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
-      CoglOnscreenGLX *glx_onscreen = onscreen->winsys;
+      CoglOnscreenGLX *glx_onscreen = cogl_onscreen_get_winsys (onscreen);
 
       while (glx_onscreen->pending_sync_notify > 0 ||
              glx_onscreen->pending_complete_notify > 0 ||
@@ -342,18 +342,18 @@ flush_pending_notifications_cb (void *data,
         {
           if (glx_onscreen->pending_sync_notify > 0)
             {
-              CoglFrameInfo *info =
-                g_queue_peek_head (&onscreen->pending_frame_infos);
+              CoglFrameInfo *info;
 
+              info = cogl_onscreen_peek_head_frame_info (onscreen);
               _cogl_onscreen_notify_frame_sync (onscreen, info);
               glx_onscreen->pending_sync_notify--;
             }
 
           if (glx_onscreen->pending_complete_notify > 0)
             {
-              CoglFrameInfo *info =
-                g_queue_pop_head (&onscreen->pending_frame_infos);
+              CoglFrameInfo *info;
 
+              info = cogl_onscreen_pop_head_frame_info (onscreen);
               _cogl_onscreen_notify_complete (onscreen, info);
               cogl_object_unref (info);
               glx_onscreen->pending_complete_notify--;
@@ -388,7 +388,7 @@ flush_pending_notifications_idle (void *user_data)
 static void
 set_sync_pending (CoglOnscreen *onscreen)
 {
-  CoglOnscreenGLX *glx_onscreen = onscreen->winsys;
+  CoglOnscreenGLX *glx_onscreen = cogl_onscreen_get_winsys (onscreen);
   CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
   CoglContext *context = cogl_framebuffer_get_context (framebuffer);
   CoglRenderer *renderer = context->display->renderer;
@@ -412,7 +412,7 @@ set_sync_pending (CoglOnscreen *onscreen)
 static void
 set_complete_pending (CoglOnscreen *onscreen)
 {
-  CoglOnscreenGLX *glx_onscreen = onscreen->winsys;
+  CoglOnscreenGLX *glx_onscreen = cogl_onscreen_get_winsys (onscreen);
   CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
   CoglContext *context = cogl_framebuffer_get_context (framebuffer);
   CoglRenderer *renderer = context->display->renderer;
@@ -441,7 +441,7 @@ notify_swap_buffers (CoglContext *context, GLXBufferSwapComplete *swap_event)
 
   if (!onscreen)
     return;
-  glx_onscreen = onscreen->winsys;
+  glx_onscreen = cogl_onscreen_get_winsys (onscreen);
 
   /* We only want to notify that the swap is complete when the
      application calls cogl_context_dispatch so instead of immediately
@@ -450,7 +450,7 @@ notify_swap_buffers (CoglContext *context, GLXBufferSwapComplete *swap_event)
 
   if (swap_event->ust != 0)
     {
-      CoglFrameInfo *info = g_queue_peek_head (&onscreen->pending_frame_infos);
+      CoglFrameInfo *info = cogl_onscreen_peek_head_frame_info (onscreen);
 
       info->presentation_time =
         ust_to_nanoseconds (context->display->renderer,
@@ -464,7 +464,7 @@ notify_swap_buffers (CoglContext *context, GLXBufferSwapComplete *swap_event)
 static void
 update_output (CoglOnscreen *onscreen)
 {
-  CoglOnscreenXlib *xlib_onscreen = onscreen->winsys;
+  CoglOnscreenXlib *xlib_onscreen = cogl_onscreen_get_winsys (onscreen);
   CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
   CoglContext *context = cogl_framebuffer_get_context (framebuffer);
   CoglDisplay *display = context->display;
@@ -504,8 +504,8 @@ notify_resize (CoglContext *context,
   if (!onscreen)
     return;
 
-  glx_onscreen = onscreen->winsys;
-  xlib_onscreen = onscreen->winsys;
+  glx_onscreen = cogl_onscreen_get_winsys (onscreen);
+  xlib_onscreen = cogl_onscreen_get_winsys (onscreen);
 
   _cogl_framebuffer_winsys_update_size (framebuffer,
                                         configure_event->width,
@@ -1249,6 +1249,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
   const CoglFramebufferConfig *config;
   GLXFBConfig fbconfig;
   GError *fbconfig_error = NULL;
+  CoglOnscreenGLX *winsys;
 
   g_return_val_if_fail (glx_display->glx_context, FALSE);
 
@@ -1347,9 +1348,10 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
         }
     }
 
-  onscreen->winsys = g_slice_new0 (CoglOnscreenGLX);
-  xlib_onscreen = onscreen->winsys;
-  glx_onscreen = onscreen->winsys;
+  winsys = g_slice_new0 (CoglOnscreenGLX);
+  cogl_onscreen_set_winsys (onscreen, winsys);
+  xlib_onscreen = cogl_onscreen_get_winsys (onscreen);
+  glx_onscreen = cogl_onscreen_get_winsys (onscreen);
 
   xlib_onscreen->xwin = xwin;
 
@@ -1395,8 +1397,8 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
     _cogl_xlib_renderer_get_data (context->display->renderer);
   CoglGLXRenderer *glx_renderer = context->display->renderer->winsys;
   CoglXlibTrapState old_state;
-  CoglOnscreenXlib *xlib_onscreen = onscreen->winsys;
-  CoglOnscreenGLX *glx_onscreen = onscreen->winsys;
+  CoglOnscreenXlib *xlib_onscreen = cogl_onscreen_get_winsys (onscreen);
+  CoglOnscreenGLX *glx_onscreen = cogl_onscreen_get_winsys (onscreen);
   GLXDrawable drawable;
 
   /* If we never successfully allocated then there's nothing to do */
@@ -1452,8 +1454,8 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
 
   _cogl_xlib_renderer_untrap_errors (context->display->renderer, &old_state);
 
-  g_slice_free (CoglOnscreenGLX, onscreen->winsys);
-  onscreen->winsys = NULL;
+  g_slice_free (CoglOnscreenGLX, cogl_onscreen_get_winsys (onscreen));
+  cogl_onscreen_set_winsys (onscreen, NULL);
 }
 
 static void
@@ -1466,8 +1468,8 @@ _cogl_winsys_onscreen_bind (CoglOnscreen *onscreen)
   CoglXlibRenderer *xlib_renderer =
     _cogl_xlib_renderer_get_data (context->display->renderer);
   CoglGLXRenderer *glx_renderer = context->display->renderer->winsys;
-  CoglOnscreenXlib *xlib_onscreen = onscreen->winsys;
-  CoglOnscreenGLX *glx_onscreen = onscreen->winsys;
+  CoglOnscreenXlib *xlib_onscreen = cogl_onscreen_get_winsys (onscreen);
+  CoglOnscreenGLX *glx_onscreen = cogl_onscreen_get_winsys (onscreen);
   CoglXlibTrapState old_state;
   GLXDrawable drawable;
 
@@ -1551,11 +1553,11 @@ _cogl_winsys_wait_for_vblank (CoglOnscreen *onscreen)
 
   if (glx_display->can_vblank_wait)
     {
-      CoglFrameInfo *info = g_queue_peek_tail (&onscreen->pending_frame_infos);
+      CoglFrameInfo *info = cogl_onscreen_peek_tail_frame_info (onscreen);
 
       if (glx_renderer->glXWaitForMsc)
         {
-          CoglOnscreenGLX *glx_onscreen = onscreen->winsys;
+          CoglOnscreenGLX *glx_onscreen = cogl_onscreen_get_winsys (onscreen);
           Drawable drawable = glx_onscreen->glxwin;
           int64_t ust;
           int64_t msc;
@@ -1606,8 +1608,8 @@ _cogl_winsys_onscreen_get_buffer_age (CoglOnscreen *onscreen)
   CoglContext *context = cogl_framebuffer_get_context (framebuffer);
   CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (context->display->renderer);
   CoglGLXRenderer *glx_renderer = context->display->renderer->winsys;
-  CoglOnscreenGLX *glx_onscreen = onscreen->winsys;
-  CoglOnscreenXlib *xlib_onscreen = onscreen->winsys;
+  CoglOnscreenGLX *glx_onscreen = cogl_onscreen_get_winsys (onscreen);
+  CoglOnscreenXlib *xlib_onscreen = cogl_onscreen_get_winsys (onscreen);
   GLXDrawable drawable = glx_onscreen->glxwin ? glx_onscreen->glxwin : xlib_onscreen->xwin;
   unsigned int age;
 
@@ -1623,7 +1625,7 @@ static void
 set_frame_info_output (CoglOnscreen *onscreen,
                        CoglOutput *output)
 {
-  CoglFrameInfo *info = g_queue_peek_tail (&onscreen->pending_frame_infos);
+  CoglFrameInfo *info = cogl_onscreen_peek_tail_frame_info (onscreen);
 
   if (output)
     {
@@ -1646,8 +1648,8 @@ _cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen,
     _cogl_xlib_renderer_get_data (context->display->renderer);
   CoglGLXRenderer *glx_renderer = context->display->renderer->winsys;
   CoglGLXDisplay *glx_display = context->display->winsys;
-  CoglOnscreenXlib *xlib_onscreen = onscreen->winsys;
-  CoglOnscreenGLX *glx_onscreen = onscreen->winsys;
+  CoglOnscreenXlib *xlib_onscreen = cogl_onscreen_get_winsys (onscreen);
+  CoglOnscreenGLX *glx_onscreen = cogl_onscreen_get_winsys (onscreen);
   GLXDrawable drawable =
     glx_onscreen->glxwin ? glx_onscreen->glxwin : xlib_onscreen->xwin;
   uint32_t end_frame_vsync_counter = 0;
@@ -1854,8 +1856,8 @@ _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
     _cogl_xlib_renderer_get_data (context->display->renderer);
   CoglGLXRenderer *glx_renderer = context->display->renderer->winsys;
   CoglGLXDisplay *glx_display = context->display->winsys;
-  CoglOnscreenXlib *xlib_onscreen = onscreen->winsys;
-  CoglOnscreenGLX *glx_onscreen = onscreen->winsys;
+  CoglOnscreenXlib *xlib_onscreen = cogl_onscreen_get_winsys (onscreen);
+  CoglOnscreenGLX *glx_onscreen = cogl_onscreen_get_winsys (onscreen);
   gboolean have_counter;
   GLXDrawable drawable;
 
@@ -1923,7 +1925,7 @@ _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
 static uint32_t
 _cogl_winsys_onscreen_x11_get_window_xid (CoglOnscreen *onscreen)
 {
-  CoglOnscreenXlib *xlib_onscreen = onscreen->winsys;
+  CoglOnscreenXlib *xlib_onscreen = cogl_onscreen_get_winsys (onscreen);
   return xlib_onscreen->xwin;
 }
 
@@ -1935,7 +1937,7 @@ _cogl_winsys_onscreen_set_visibility (CoglOnscreen *onscreen,
   CoglContext *context = cogl_framebuffer_get_context (framebuffer);
   CoglXlibRenderer *xlib_renderer =
     _cogl_xlib_renderer_get_data (context->display->renderer);
-  CoglOnscreenXlib *xlib_onscreen = onscreen->winsys;
+  CoglOnscreenXlib *xlib_onscreen = cogl_onscreen_get_winsys (onscreen);
 
   if (visibility)
     XMapWindow (xlib_renderer->xdpy, xlib_onscreen->xwin);
@@ -1951,7 +1953,7 @@ _cogl_winsys_onscreen_set_resizable (CoglOnscreen *onscreen,
   CoglContext *context = cogl_framebuffer_get_context (framebuffer);
   CoglXlibRenderer *xlib_renderer =
     _cogl_xlib_renderer_get_data (context->display->renderer);
-  CoglOnscreenXlib *xlib_onscreen = onscreen->winsys;
+  CoglOnscreenXlib *xlib_onscreen = cogl_onscreen_get_winsys (onscreen);
 
   XSizeHints *size_hints = XAllocSizeHints ();
 
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 0b05925914..8866d1602b 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -341,7 +341,7 @@ get_supported_egl_modifiers (CoglOnscreen *onscreen,
                              MetaCrtcKms  *crtc_kms,
                              uint32_t      format)
 {
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaRendererNative *renderer_native = onscreen_native->renderer_native;
   MetaEgl *egl = meta_onscreen_native_get_egl (onscreen_native);
@@ -389,7 +389,7 @@ static GArray *
 get_supported_modifiers (CoglOnscreen *onscreen,
                          uint32_t      format)
 {
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaCrtcKms *crtc_kms = META_CRTC_KMS (onscreen_native->crtc);
   MetaGpu *gpu;
@@ -407,7 +407,7 @@ get_supported_modifiers (CoglOnscreen *onscreen,
 static GArray *
 get_supported_kms_formats (CoglOnscreen *onscreen)
 {
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaCrtcKms *crtc_kms = META_CRTC_KMS (onscreen_native->crtc);
 
@@ -442,7 +442,7 @@ init_secondary_gpu_state_gpu_copy_mode (MetaRendererNative         *renderer_nat
                                         GError                    **error)
 {
   CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaEgl *egl = meta_onscreen_native_get_egl (onscreen_native);
   int width, height;
@@ -600,7 +600,7 @@ init_secondary_gpu_state_cpu_copy_mode (MetaRendererNative         *renderer_nat
                                         GError                    **error)
 {
   CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state;
   MetaGpuKms *gpu_kms;
@@ -665,7 +665,7 @@ init_secondary_gpu_state (MetaRendererNative  *renderer_native,
                           CoglOnscreen        *onscreen,
                           GError             **error)
 {
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaGpu *gpu = meta_crtc_get_gpu (onscreen_native->crtc);
   MetaRendererNativeGpuData *renderer_gpu_data;
@@ -712,7 +712,7 @@ meta_renderer_native_disconnect (CoglRenderer *cogl_renderer)
 static void
 free_current_secondary_bo (CoglOnscreen *onscreen)
 {
-  CoglOnscreenEGL *onscreen_egl =  onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state;
 
@@ -726,7 +726,7 @@ free_current_secondary_bo (CoglOnscreen *onscreen)
 static void
 free_current_bo (CoglOnscreen *onscreen)
 {
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
 
   g_clear_object (&onscreen_native->gbm.current_fb);
@@ -738,9 +738,10 @@ meta_onscreen_native_notify_frame_complete (CoglOnscreen *onscreen)
 {
   CoglFrameInfo *info;
 
-  g_assert (onscreen->pending_frame_infos.length == 1);
+  info = cogl_onscreen_pop_head_frame_info (onscreen);
+
+  g_assert (!cogl_onscreen_peek_head_frame_info (onscreen));
 
-  info = g_queue_pop_head (&onscreen->pending_frame_infos);
   _cogl_onscreen_notify_frame_sync (onscreen, info);
   _cogl_onscreen_notify_complete (onscreen, info);
   cogl_object_unref (info);
@@ -993,7 +994,7 @@ meta_renderer_native_egl_cleanup_context (CoglDisplay *cogl_display)
 static void
 swap_secondary_drm_fb (CoglOnscreen *onscreen)
 {
-  CoglOnscreenEGL *onscreen_egl =  onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state;
 
@@ -1009,7 +1010,7 @@ swap_secondary_drm_fb (CoglOnscreen *onscreen)
 static void
 meta_onscreen_native_swap_drm_fb (CoglOnscreen *onscreen)
 {
-  CoglOnscreenEGL *onscreen_egl =  onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
 
   if (!onscreen_native->gbm.next_fb)
@@ -1056,14 +1057,14 @@ notify_view_crtc_presented (MetaRendererView *view,
   CoglFramebuffer *framebuffer =
     clutter_stage_view_get_onscreen (stage_view);
   CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
-  CoglOnscreenEGL *onscreen_egl =  onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaRendererNative *renderer_native = onscreen_native->renderer_native;
   CoglFrameInfo *frame_info;
   MetaCrtc *crtc;
   MetaRendererNativeGpuData *renderer_gpu_data;
 
-  frame_info = g_queue_peek_tail (&onscreen->pending_frame_infos);
+  frame_info = cogl_onscreen_peek_head_frame_info (onscreen);
 
   crtc = META_CRTC (meta_crtc_kms_from_kms_crtc (kms_crtc));
   maybe_update_frame_info (crtc, frame_info, time_ns);
@@ -1123,7 +1124,7 @@ page_flip_feedback_ready (MetaKmsCrtc *kms_crtc,
   CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
   CoglFrameInfo *frame_info;
 
-  frame_info = g_queue_peek_tail (&onscreen->pending_frame_infos);
+  frame_info = cogl_onscreen_peek_head_frame_info (onscreen);
   frame_info->flags |= COGL_FRAME_INFO_FLAG_SYMBOLIC;
 
   meta_onscreen_native_notify_frame_complete (onscreen);
@@ -1232,7 +1233,7 @@ dummy_power_save_page_flip (CoglOnscreen *onscreen)
 
   meta_onscreen_native_swap_drm_fb (onscreen);
 
-  frame_info = g_queue_peek_tail (&onscreen->pending_frame_infos);
+  frame_info = cogl_onscreen_peek_tail_frame_info (onscreen);
   frame_info->flags |= COGL_FRAME_INFO_FLAG_SYMBOLIC;
   meta_onscreen_native_notify_frame_complete (onscreen);
 }
@@ -1255,7 +1256,7 @@ dummy_power_save_page_flip_cb (gpointer user_data)
 static void
 queue_dummy_power_save_page_flip (CoglOnscreen *onscreen)
 {
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaRendererNative *renderer_native = onscreen_native->renderer_native;
   const unsigned int timeout_ms = 100;
@@ -1279,7 +1280,7 @@ meta_onscreen_native_flip_crtc (CoglOnscreen                *onscreen,
                                 MetaCrtc                    *crtc,
                                 MetaKmsPageFlipListenerFlag  flags)
 {
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaRendererNative *renderer_native = onscreen_native->renderer_native;
   MetaGpuKms *render_gpu = onscreen_native->render_gpu;
@@ -1342,7 +1343,7 @@ static void
 meta_onscreen_native_set_crtc_mode (CoglOnscreen              *onscreen,
                                     MetaRendererNativeGpuData *renderer_gpu_data)
 {
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaCrtcKms *crtc_kms = META_CRTC_KMS (onscreen_native->crtc);
   MetaKmsCrtc *kms_crtc = meta_crtc_kms_get_kms_crtc (crtc_kms);
@@ -1380,7 +1381,7 @@ static gboolean
 import_shared_framebuffer (CoglOnscreen                        *onscreen,
                            MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state)
 {
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaGpuKms *gpu_kms;
   MetaKmsDevice *kms_device;
@@ -1456,7 +1457,7 @@ copy_shared_framebuffer_gpu (CoglOnscreen                        *onscreen,
                              MetaRendererNativeGpuData           *renderer_gpu_data,
                              gboolean                            *egl_context_changed)
 {
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaRendererNative *renderer_native = renderer_gpu_data->renderer_native;
   MetaEgl *egl = meta_renderer_native_get_egl (renderer_native);
@@ -1630,7 +1631,7 @@ copy_shared_framebuffer_primary_gpu (CoglOnscreen                        *onscre
                                      MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state)
 {
   CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaRendererNative *renderer_native = onscreen_native->renderer_native;
   MetaRendererNativeGpuData *primary_gpu_data;
@@ -1770,7 +1771,7 @@ copy_shared_framebuffer_cpu (CoglOnscreen                        *onscreen,
 static void
 update_secondary_gpu_state_pre_swap_buffers (CoglOnscreen *onscreen)
 {
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state;
 
@@ -1825,7 +1826,7 @@ static void
 update_secondary_gpu_state_post_swap_buffers (CoglOnscreen *onscreen,
                                               gboolean     *egl_context_changed)
 {
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaRendererNative *renderer_native = onscreen_native->renderer_native;
   MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state;
@@ -1865,7 +1866,7 @@ retry:
 static void
 ensure_crtc_modes (CoglOnscreen *onscreen)
 {
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
   CoglContext *cogl_context = cogl_framebuffer_get_context (framebuffer);
@@ -1897,7 +1898,7 @@ kms_device_from_view (MetaRendererView *view)
   CoglFramebuffer *framebuffer =
     clutter_stage_view_get_onscreen (CLUTTER_STAGE_VIEW (view));
   CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaCrtcKms *crtc_kms = META_CRTC_KMS (onscreen_native->crtc);
   MetaKmsCrtc *kms_crtc = meta_crtc_kms_get_kms_crtc (crtc_kms);
@@ -1911,7 +1912,7 @@ gpu_from_view (MetaRendererView *view)
   CoglFramebuffer *framebuffer =
     clutter_stage_view_get_onscreen (CLUTTER_STAGE_VIEW (view));
   CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
 
   return meta_crtc_get_gpu (onscreen_native->crtc);
@@ -2063,7 +2064,7 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen  *onscreen,
   MetaMonitorManager *monitor_manager =
     meta_backend_get_monitor_manager (backend);
   MetaKms *kms = meta_backend_native_get_kms (backend_native);
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaGpuKms *render_gpu = onscreen_native->render_gpu;
   MetaKmsDevice *render_kms_device = meta_gpu_kms_get_kms_device (render_gpu);
@@ -2303,7 +2304,7 @@ meta_onscreen_native_is_buffer_scanout_compatible (CoglOnscreen *onscreen,
                                                    uint64_t      drm_modifier,
                                                    uint32_t      stride)
 {
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   const MetaCrtcConfig *crtc_config;
   MetaDrmBuffer *fb;
@@ -2348,7 +2349,7 @@ meta_onscreen_native_direct_scanout (CoglOnscreen   *onscreen,
                                      gpointer        user_data,
                                      GError        **error)
 {
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaGpuKms *render_gpu = onscreen_native->render_gpu;
   CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
@@ -2467,7 +2468,7 @@ meta_renderer_native_init_egl_context (CoglContext *cogl_context,
 static gboolean
 should_surface_be_sharable (CoglOnscreen *onscreen)
 {
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
 
   if (META_GPU_KMS (meta_crtc_get_gpu (onscreen_native->crtc)) ==
@@ -2485,7 +2486,7 @@ meta_renderer_native_create_surface_gbm (CoglOnscreen        *onscreen,
                                          EGLSurface          *egl_surface,
                                          GError             **error)
 {
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaRendererNative *renderer_native = onscreen_native->renderer_native;
   MetaEgl *egl = meta_onscreen_native_get_egl (onscreen_native);
@@ -2576,7 +2577,7 @@ meta_renderer_native_create_surface_egl_device (CoglOnscreen  *onscreen,
                                                 GError       **error)
 {
   CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   CoglContext *cogl_context = cogl_framebuffer_get_context (framebuffer);
   CoglDisplay *cogl_display = cogl_context->display;
@@ -2671,8 +2672,8 @@ meta_renderer_native_init_onscreen (CoglOnscreen *onscreen,
 
   g_return_val_if_fail (cogl_display_egl->egl_context, FALSE);
 
-  onscreen->winsys = g_slice_new0 (CoglOnscreenEGL);
-  onscreen_egl = onscreen->winsys;
+  onscreen_egl = g_slice_new0 (CoglOnscreenEGL);
+  cogl_onscreen_set_winsys (onscreen, onscreen_egl);
 
   onscreen_native = g_slice_new0 (MetaOnscreenNative);
   onscreen_egl->platform = onscreen_native;
@@ -2695,7 +2696,7 @@ meta_onscreen_native_allocate (CoglOnscreen *onscreen,
                                GError      **error)
 {
   CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
   MetaRendererNativeGpuData *renderer_gpu_data;
   struct gbm_surface *gbm_surface;
@@ -2764,7 +2765,7 @@ meta_onscreen_native_allocate (CoglOnscreen *onscreen,
 static void
 destroy_egl_surface (CoglOnscreen *onscreen)
 {
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
 
   if (onscreen_egl->egl_surface != EGL_NO_SURFACE)
     {
@@ -2790,7 +2791,7 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
   CoglContext *cogl_context = cogl_framebuffer_get_context (framebuffer);
   CoglDisplay *cogl_display = cogl_context_get_display (cogl_context);
   CoglDisplayEGL *cogl_display_egl = cogl_display->winsys;
-  CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
+  CoglOnscreenEGL *onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   MetaOnscreenNative *onscreen_native;
   MetaRendererNative *renderer_native;
   MetaRendererNativeGpuData *renderer_gpu_data;
@@ -2859,8 +2860,8 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
                    secondary_gpu_state_free);
 
   g_slice_free (MetaOnscreenNative, onscreen_native);
-  g_slice_free (CoglOnscreenEGL, onscreen->winsys);
-  onscreen->winsys = NULL;
+  g_slice_free (CoglOnscreenEGL, cogl_onscreen_get_winsys (onscreen));
+  cogl_onscreen_set_winsys (onscreen, NULL);
 }
 
 static const CoglWinsysEGLVtable
@@ -2912,7 +2913,7 @@ meta_renderer_native_create_onscreen (MetaRendererNative   *renderer_native,
       return NULL;
     }
 
-  onscreen_egl = onscreen->winsys;
+  onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   onscreen_native = onscreen_egl->platform;
   onscreen_native->renderer_native = renderer_native;
   onscreen_native->render_gpu = render_gpu;
@@ -3036,7 +3037,7 @@ meta_onscreen_native_set_view (CoglOnscreen     *onscreen,
   CoglOnscreenEGL *onscreen_egl;
   MetaOnscreenNative *onscreen_native;
 
-  onscreen_egl = onscreen->winsys;
+  onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   onscreen_native = onscreen_egl->platform;
   onscreen_native->view = view;
 }
@@ -3209,7 +3210,7 @@ meta_renderer_native_create_view (MetaRenderer       *renderer,
   g_object_unref (onscreen);
 
   /* Ensure we don't point to stale surfaces when creating the offscreen */
-  onscreen_egl = onscreen->winsys;
+  onscreen_egl = cogl_onscreen_get_winsys (onscreen);
   cogl_display_egl = cogl_display->winsys;
   _cogl_winsys_egl_make_current (cogl_display,
                                  onscreen_egl->egl_surface,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]