From acc7b83322cc193964997982332d4fc668addefb Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 24 Oct 2019 15:58:44 -0400 Subject: [PATCH] cogl: Remove the stub winsys It's not useful and supporting it leaks into the API in other weird ways. https://gitlab.gnome.org/GNOME/mutter/merge_requests/885 --- clutter/clutter/clutter-stage.c | 11 -- cogl/cogl/cogl-context.c | 14 -- cogl/cogl/cogl-renderer.c | 2 - cogl/cogl/deprecated/cogl-clutter.c | 16 -- cogl/cogl/deprecated/cogl-clutter.h | 4 - cogl/cogl/meson.build | 2 - cogl/cogl/winsys/cogl-winsys-stub-private.h | 37 ---- cogl/cogl/winsys/cogl-winsys-stub.c | 188 -------------------- 8 files changed, 274 deletions(-) delete mode 100644 cogl/cogl/winsys/cogl-winsys-stub-private.h delete mode 100644 cogl/cogl/winsys/cogl-winsys-stub.c diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c index bf260e1ca..f1f75bd0a 100644 --- a/clutter/clutter/clutter-stage.c +++ b/clutter/clutter/clutter-stage.c @@ -717,17 +717,6 @@ clutter_stage_allocate (ClutterActor *self, flags | CLUTTER_DELEGATE_LAYOUT); } - /* XXX: Until Cogl becomes fully responsible for backend windows - * Clutter need to manually keep it informed of the current window - * size. We do this after the allocation above so that the stage - * window has a chance to update the window size based on the - * allocation. - */ - _clutter_stage_window_get_geometry (priv->impl, &window_size); - - cogl_onscreen_clutter_backend_set_size (window_size.width, - window_size.height); - /* reset the viewport if the allocation effectively changed */ clutter_actor_get_allocation_box (self, &alloc); clutter_actor_box_get_size (&alloc, &new_width, &new_height); diff --git a/cogl/cogl/cogl-context.c b/cogl/cogl/cogl-context.c index 9a2dca2ba..464e2de0e 100644 --- a/cogl/cogl/cogl-context.c +++ b/cogl/cogl/cogl-context.c @@ -51,9 +51,6 @@ #include "driver/gl/cogl-pipeline-opengl-private.h" #include "driver/gl/cogl-util-gl-private.h" #include "winsys/cogl-winsys-private.h" -#include "winsys/cogl-winsys-stub-private.h" - -#include "deprecated/cogl-framebuffer-deprecated.h" #include #include @@ -327,17 +324,6 @@ cogl_context_new (CoglDisplay *display, context->window_buffer = NULL; context->framebuffer_stack = _cogl_create_framebuffer_stack (); - /* XXX: In this case the Clutter backend is still responsible for - * the OpenGL binding API and for creating onscreen framebuffers and - * so we have to add a dummy framebuffer to represent the backend - * owned window... */ - if (_cogl_context_get_winsys (context) == _cogl_winsys_stub_get_vtable ()) - { - CoglOnscreen *window = _cogl_onscreen_new (); - cogl_set_framebuffer (COGL_FRAMEBUFFER (window)); - cogl_object_unref (COGL_FRAMEBUFFER (window)); - } - context->current_path = NULL; context->stencil_pipeline = cogl_pipeline_new (context); diff --git a/cogl/cogl/cogl-renderer.c b/cogl/cogl/cogl-renderer.c index 62fda895d..6632f3bff 100644 --- a/cogl/cogl/cogl-renderer.c +++ b/cogl/cogl/cogl-renderer.c @@ -47,7 +47,6 @@ #include "cogl-gtype-private.h" #include "winsys/cogl-winsys-private.h" -#include "winsys/cogl-winsys-stub-private.h" #ifdef COGL_HAS_EGL_PLATFORM_XLIB_SUPPORT #include "winsys/cogl-winsys-egl-x11-private.h" @@ -142,7 +141,6 @@ static CoglWinsysVtableGetter _cogl_winsys_vtable_getters[] = #ifdef COGL_HAS_EGL_PLATFORM_XLIB_SUPPORT _cogl_winsys_egl_xlib_get_vtable, #endif - _cogl_winsys_stub_get_vtable, }; static void _cogl_renderer_free (CoglRenderer *renderer); diff --git a/cogl/cogl/deprecated/cogl-clutter.c b/cogl/cogl/deprecated/cogl-clutter.c index 3c0e63390..63899355e 100644 --- a/cogl/cogl/deprecated/cogl-clutter.c +++ b/cogl/cogl/deprecated/cogl-clutter.c @@ -44,7 +44,6 @@ #include "cogl-xlib-renderer.h" #endif #include "winsys/cogl-winsys-private.h" -#include "winsys/cogl-winsys-stub-private.h" #include "deprecated/cogl-clutter.h" gboolean @@ -77,18 +76,3 @@ cogl_clutter_winsys_has_feature (CoglWinsysFeature feature) { return _cogl_winsys_has_feature (feature); } - -void -cogl_onscreen_clutter_backend_set_size (int width, int height) -{ - CoglFramebuffer *framebuffer; - - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - if (_cogl_context_get_winsys (ctx) != _cogl_winsys_stub_get_vtable ()) - return; - - framebuffer = COGL_FRAMEBUFFER (ctx->window_buffer); - - _cogl_framebuffer_winsys_update_size (framebuffer, width, height); -} diff --git a/cogl/cogl/deprecated/cogl-clutter.h b/cogl/cogl/deprecated/cogl-clutter.h index 72d69c643..82f4cce82 100644 --- a/cogl/cogl/deprecated/cogl-clutter.h +++ b/cogl/cogl/deprecated/cogl-clutter.h @@ -45,10 +45,6 @@ COGL_DEPRECATED_FOR (cogl_has_feature) gboolean cogl_clutter_winsys_has_feature (CoglWinsysFeature feature); -#define cogl_onscreen_clutter_backend_set_size cogl_onscreen_clutter_backend_set_size_CLUTTER -void -cogl_onscreen_clutter_backend_set_size (int width, int height); - G_END_DECLS #endif /* __COGL_CLUTTER_H__ */ diff --git a/cogl/cogl/meson.build b/cogl/cogl/meson.build index c66cfbc7d..95483168e 100644 --- a/cogl/cogl/meson.build +++ b/cogl/cogl/meson.build @@ -339,8 +339,6 @@ cogl_sources = [ 'cogl-point-in-poly.c', 'cogl-list.c', 'cogl-list.h', - 'winsys/cogl-winsys-stub-private.h', - 'winsys/cogl-winsys-stub.c', 'cogl-config-private.h', 'cogl-config.c', 'cogl-boxed-value.h', diff --git a/cogl/cogl/winsys/cogl-winsys-stub-private.h b/cogl/cogl/winsys/cogl-winsys-stub-private.h deleted file mode 100644 index 4aaf798a3..000000000 --- a/cogl/cogl/winsys/cogl-winsys-stub-private.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2011 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * - */ - -#ifndef __COGL_WINSYS_STUB_PRIVATE_H -#define __COGL_WINSYS_STUB_PRIVATE_H - -const CoglWinsysVtable * -_cogl_winsys_stub_get_vtable (void); - -#endif /* __COGL_WINSYS_STUB_PRIVATE_H */ diff --git a/cogl/cogl/winsys/cogl-winsys-stub.c b/cogl/cogl/winsys/cogl-winsys-stub.c deleted file mode 100644 index fee65ab71..000000000 --- a/cogl/cogl/winsys/cogl-winsys-stub.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2011 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * - * Authors: - * Robert Bragg - * - */ - -#include "cogl-config.h" - -#include "cogl-renderer-private.h" -#include "cogl-display-private.h" -#include "cogl-context-private.h" -#include "cogl-framebuffer-private.h" -#include "cogl-private.h" -#include "winsys/cogl-winsys-stub-private.h" - -#include - -static int _cogl_winsys_stub_dummy_ptr; - -/* This provides a NOP winsys. This can be useful for debugging or for - * integrating with toolkits that already have window system - * integration code. - */ - -static GCallback -_cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer, - const char *name, - gboolean in_core) -{ - static GModule *module = NULL; - - /* this should find the right function if the program is linked against a - * library providing it */ - if (G_UNLIKELY (module == NULL)) - module = g_module_open (NULL, 0); - - if (module) - { - void *symbol; - - if (g_module_symbol (module, name, &symbol)) - return symbol; - } - - return NULL; -} - -static void -_cogl_winsys_renderer_disconnect (CoglRenderer *renderer) -{ - renderer->winsys = NULL; -} - -static gboolean -_cogl_winsys_renderer_connect (CoglRenderer *renderer, - GError **error) -{ - renderer->winsys = &_cogl_winsys_stub_dummy_ptr; - return TRUE; -} - -static void -_cogl_winsys_display_destroy (CoglDisplay *display) -{ - display->winsys = NULL; -} - -static gboolean -_cogl_winsys_display_setup (CoglDisplay *display, - GError **error) -{ - display->winsys = &_cogl_winsys_stub_dummy_ptr; - return TRUE; -} - -static gboolean -_cogl_winsys_context_init (CoglContext *context, GError **error) -{ - context->winsys = &_cogl_winsys_stub_dummy_ptr; - - if (!_cogl_context_update_features (context, error)) - return FALSE; - - memset (context->winsys_features, 0, sizeof (context->winsys_features)); - - return TRUE; -} - -static void -_cogl_winsys_context_deinit (CoglContext *context) -{ - context->winsys = NULL; -} - -static gboolean -_cogl_winsys_onscreen_init (CoglOnscreen *onscreen, - GError **error) -{ - return TRUE; -} - -static void -_cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen) -{ -} - -static void -_cogl_winsys_onscreen_bind (CoglOnscreen *onscreen) -{ -} - -static void -_cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen, - const int *rectangles, - int n_rectangles) -{ -} - -static void -_cogl_winsys_onscreen_set_visibility (CoglOnscreen *onscreen, - gboolean visibility) -{ -} - -const CoglWinsysVtable * -_cogl_winsys_stub_get_vtable (void) -{ - static gboolean vtable_inited = FALSE; - static CoglWinsysVtable vtable; - - /* It would be nice if we could use C99 struct initializers here - like the GLX backend does. However this code is more likely to be - compiled using Visual Studio which (still!) doesn't support them - so we initialize it in code instead */ - - if (!vtable_inited) - { - memset (&vtable, 0, sizeof (vtable)); - - vtable.id = COGL_WINSYS_ID_STUB; - vtable.name = "STUB"; - vtable.renderer_get_proc_address = _cogl_winsys_renderer_get_proc_address; - vtable.renderer_connect = _cogl_winsys_renderer_connect; - vtable.renderer_disconnect = _cogl_winsys_renderer_disconnect; - vtable.display_setup = _cogl_winsys_display_setup; - vtable.display_destroy = _cogl_winsys_display_destroy; - vtable.context_init = _cogl_winsys_context_init; - vtable.context_deinit = _cogl_winsys_context_deinit; - - vtable.onscreen_init = _cogl_winsys_onscreen_init; - vtable.onscreen_deinit = _cogl_winsys_onscreen_deinit; - vtable.onscreen_bind = _cogl_winsys_onscreen_bind; - vtable.onscreen_swap_buffers_with_damage = - _cogl_winsys_onscreen_swap_buffers_with_damage; - vtable.onscreen_set_visibility = _cogl_winsys_onscreen_set_visibility; - - vtable_inited = TRUE; - } - - return &vtable; -}