From 638d3355b4a1da70c59d19180c05c050ffe18eae Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Mon, 20 May 2024 11:12:49 +0200 Subject: [PATCH] cogl: Drop CoglSwapChain CoglSwapChain is currently unused, and doesn't hold any information nor is used for anything in particular. Part-of: --- clutter/clutter/clutter-backend-private.h | 1 - clutter/clutter/clutter-backend.c | 13 +---- cogl/cogl/cogl-display.c | 2 +- cogl/cogl/cogl-framebuffer-private.h | 1 - cogl/cogl/cogl-framebuffer.c | 1 - cogl/cogl/cogl-onscreen-template-private.h | 1 - cogl/cogl/cogl-onscreen-template.c | 8 +-- cogl/cogl/cogl-onscreen-template.h | 4 +- cogl/cogl/cogl-swap-chain-private.h | 40 ------------- cogl/cogl/cogl-swap-chain.c | 64 --------------------- cogl/cogl/cogl-swap-chain.h | 61 -------------------- cogl/cogl/cogl.h | 1 - cogl/cogl/meson.build | 4 -- cogl/cogl/winsys/cogl-winsys-egl.c | 1 - cogl/cogl/winsys/cogl-winsys-glx.c | 2 - src/backends/x11/meta-clutter-backend-x11.c | 3 +- 16 files changed, 5 insertions(+), 202 deletions(-) delete mode 100644 cogl/cogl/cogl-swap-chain-private.h delete mode 100644 cogl/cogl/cogl-swap-chain.c delete mode 100644 cogl/cogl/cogl-swap-chain.h diff --git a/clutter/clutter/clutter-backend-private.h b/clutter/clutter/clutter-backend-private.h index 41738e870..f93a7230e 100644 --- a/clutter/clutter/clutter-backend-private.h +++ b/clutter/clutter/clutter-backend-private.h @@ -69,7 +69,6 @@ struct _ClutterBackendClass GError **error); CoglDisplay * (* get_display) (ClutterBackend *backend, CoglRenderer *renderer, - CoglSwapChain *swap_chain, GError **error); gboolean (* create_context) (ClutterBackend *backend, GError **error); diff --git a/clutter/clutter/clutter-backend.c b/clutter/clutter/clutter-backend.c index 297461d80..0626f58e0 100644 --- a/clutter/clutter/clutter-backend.c +++ b/clutter/clutter/clutter-backend.c @@ -118,12 +118,9 @@ clutter_backend_do_real_create_context (ClutterBackend *backend, GError **error) { ClutterBackendClass *klass; - CoglSwapChain *swap_chain; klass = CLUTTER_BACKEND_GET_CLASS (backend); - swap_chain = NULL; - CLUTTER_NOTE (BACKEND, "Creating Cogl renderer"); backend->cogl_renderer = klass->get_renderer (backend, error); @@ -135,15 +132,11 @@ clutter_backend_do_real_create_context (ClutterBackend *backend, if (!cogl_renderer_connect (backend->cogl_renderer, error)) goto error; - CLUTTER_NOTE (BACKEND, "Creating Cogl swap chain"); - swap_chain = cogl_swap_chain_new (); - CLUTTER_NOTE (BACKEND, "Creating Cogl display"); if (klass->get_display != NULL) { backend->cogl_display = klass->get_display (backend, backend->cogl_renderer, - swap_chain, error); } else @@ -151,7 +144,7 @@ clutter_backend_do_real_create_context (ClutterBackend *backend, CoglOnscreenTemplate *tmpl; gboolean res; - tmpl = cogl_onscreen_template_new (swap_chain); + tmpl = cogl_onscreen_template_new (); /* XXX: I have some doubts that this is a good design. * @@ -185,7 +178,6 @@ clutter_backend_do_real_create_context (ClutterBackend *backend, /* the display owns the renderer and the swap chain */ g_object_unref (backend->cogl_renderer); - g_object_unref (swap_chain); return TRUE; @@ -193,9 +185,6 @@ error: g_clear_object (&backend->cogl_display); g_clear_object (&backend->cogl_renderer); - if (swap_chain != NULL) - g_object_unref (swap_chain); - return FALSE; } diff --git a/cogl/cogl/cogl-display.c b/cogl/cogl/cogl-display.c index 08158e503..16a50d058 100644 --- a/cogl/cogl/cogl-display.c +++ b/cogl/cogl/cogl-display.c @@ -129,7 +129,7 @@ cogl_display_set_onscreen_template (CoglDisplay *display, /* NB: we want to maintain the invariable that there is always an * onscreen template associated with a CoglDisplay... */ if (!onscreen_template) - display->onscreen_template = cogl_onscreen_template_new (NULL); + display->onscreen_template = cogl_onscreen_template_new (); } gboolean diff --git a/cogl/cogl/cogl-framebuffer-private.h b/cogl/cogl/cogl-framebuffer-private.h index eb014e00c..407393d1d 100644 --- a/cogl/cogl/cogl-framebuffer-private.h +++ b/cogl/cogl/cogl-framebuffer-private.h @@ -53,7 +53,6 @@ struct _CoglFramebufferDriverConfig typedef struct { - CoglSwapChain *swap_chain; gboolean need_stencil; int samples_per_pixel; gboolean stereo_enabled; diff --git a/cogl/cogl/cogl-framebuffer.c b/cogl/cogl/cogl-framebuffer.c index 269c49d26..c4b928f18 100644 --- a/cogl/cogl/cogl-framebuffer.c +++ b/cogl/cogl/cogl-framebuffer.c @@ -322,7 +322,6 @@ cogl_framebuffer_init_config (CoglFramebuffer *framebuffer, cogl_framebuffer_get_instance_private (framebuffer); priv->config = *config; - g_object_ref (priv->config.swap_chain); } static void diff --git a/cogl/cogl/cogl-onscreen-template-private.h b/cogl/cogl/cogl-onscreen-template-private.h index 466eb9fa2..91ff52edf 100644 --- a/cogl/cogl/cogl-onscreen-template-private.h +++ b/cogl/cogl/cogl-onscreen-template-private.h @@ -30,7 +30,6 @@ #pragma once -#include "cogl/cogl-swap-chain.h" #include "cogl/cogl-framebuffer-private.h" struct _CoglOnscreenTemplate diff --git a/cogl/cogl/cogl-onscreen-template.c b/cogl/cogl/cogl-onscreen-template.c index e5d5faa27..0f2535527 100644 --- a/cogl/cogl/cogl-onscreen-template.c +++ b/cogl/cogl/cogl-onscreen-template.c @@ -49,17 +49,11 @@ cogl_onscreen_template_class_init (CoglOnscreenTemplateClass *class) } CoglOnscreenTemplate * -cogl_onscreen_template_new (CoglSwapChain *swap_chain) +cogl_onscreen_template_new (void) { CoglOnscreenTemplate *onscreen_template = g_object_new (COGL_TYPE_ONSCREEN_TEMPLATE, NULL); char *user_config; - onscreen_template->config.swap_chain = swap_chain; - if (swap_chain) - g_object_ref (swap_chain); - else - onscreen_template->config.swap_chain = cogl_swap_chain_new (); - onscreen_template->config.need_stencil = TRUE; onscreen_template->config.samples_per_pixel = 0; diff --git a/cogl/cogl/cogl-onscreen-template.h b/cogl/cogl/cogl-onscreen-template.h index 40d83e527..69de60336 100644 --- a/cogl/cogl/cogl-onscreen-template.h +++ b/cogl/cogl/cogl-onscreen-template.h @@ -36,8 +36,6 @@ #error "Only can be included directly." #endif -#include "cogl/cogl-swap-chain.h" - #include G_BEGIN_DECLS @@ -51,7 +49,7 @@ G_DECLARE_FINAL_TYPE (CoglOnscreenTemplate, cogl_onscreen_template, COGL, ONSCREEN_TEMPLATE, GObject) COGL_EXPORT CoglOnscreenTemplate * -cogl_onscreen_template_new (CoglSwapChain *swap_chain); +cogl_onscreen_template_new (void); /** * cogl_onscreen_template_set_samples_per_pixel: diff --git a/cogl/cogl/cogl-swap-chain-private.h b/cogl/cogl/cogl-swap-chain-private.h deleted file mode 100644 index 0c34fe669..000000000 --- a/cogl/cogl/cogl-swap-chain-private.h +++ /dev/null @@ -1,40 +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. - * - * - */ - -#pragma once - -#include - -struct _CoglSwapChain -{ - GObject parent_instance; - - int length; -}; diff --git a/cogl/cogl/cogl-swap-chain.c b/cogl/cogl/cogl-swap-chain.c deleted file mode 100644 index 0919c642d..000000000 --- a/cogl/cogl/cogl-swap-chain.c +++ /dev/null @@ -1,64 +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 "config.h" - -#include "cogl/cogl-swap-chain-private.h" -#include "cogl/cogl-swap-chain.h" - -G_DEFINE_TYPE (CoglSwapChain, cogl_swap_chain, G_TYPE_OBJECT); - -static void -cogl_swap_chain_init (CoglSwapChain *swap_chain) -{ -} - -static void -cogl_swap_chain_class_init (CoglSwapChainClass *class) -{ -} - -CoglSwapChain * -cogl_swap_chain_new (void) -{ - CoglSwapChain *swap_chain = g_object_new (COGL_TYPE_SWAP_CHAIN, NULL); - - swap_chain->length = -1; /* no preference */ - - return swap_chain; -} - -void -cogl_swap_chain_set_length (CoglSwapChain *swap_chain, - int length) -{ - swap_chain->length = length; -} diff --git a/cogl/cogl/cogl-swap-chain.h b/cogl/cogl/cogl-swap-chain.h deleted file mode 100644 index ecd084579..000000000 --- a/cogl/cogl/cogl-swap-chain.h +++ /dev/null @@ -1,61 +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. - */ - -#pragma once - -#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) -#error "Only can be included directly." -#endif - -#include "cogl/cogl-types.h" - -#include - -G_BEGIN_DECLS - -typedef struct _CoglSwapChain CoglSwapChain; - -#define COGL_TYPE_SWAP_CHAIN (cogl_swap_chain_get_type ()) - -COGL_EXPORT -G_DECLARE_FINAL_TYPE (CoglSwapChain, cogl_swap_chain, - COGL, SWAP_CHAIN, GObject) - - -COGL_EXPORT CoglSwapChain * -cogl_swap_chain_new (void); - -COGL_EXPORT void -cogl_swap_chain_set_has_alpha (CoglSwapChain *swap_chain, - gboolean has_alpha); - -COGL_EXPORT void -cogl_swap_chain_set_length (CoglSwapChain *swap_chain, - int length); - -G_END_DECLS diff --git a/cogl/cogl/cogl.h b/cogl/cogl/cogl.h index 50f042c79..e3fcfbfd3 100644 --- a/cogl/cogl/cogl.h +++ b/cogl/cogl/cogl.h @@ -62,7 +62,6 @@ #include "cogl/cogl-mutter.h" #endif -#include "cogl/cogl-swap-chain.h" #include "cogl/cogl-renderer.h" #include "cogl/cogl-output.h" #include "cogl/cogl-display.h" diff --git a/cogl/cogl/meson.build b/cogl/cogl/meson.build index 261edbd86..a49aa4d15 100644 --- a/cogl/cogl/meson.build +++ b/cogl/cogl/meson.build @@ -56,7 +56,6 @@ cogl_headers = [ 'cogl-scanout.h', 'cogl-snippet.h', 'cogl-sub-texture.h', - 'cogl-swap-chain.h', 'cogl-texture-2d.h', 'cogl-texture-2d-sliced.h', 'cogl-texture.h', @@ -280,9 +279,6 @@ cogl_sources = [ 'cogl-spans.h', 'cogl-sub-texture-private.h', 'cogl-sub-texture.c', - 'cogl-swap-chain-private.h', - 'cogl-swap-chain.c', - 'cogl-swap-chain.h', 'cogl-texture-2d-private.h', 'cogl-texture-2d-sliced-private.h', 'cogl-texture-2d-sliced.c', diff --git a/cogl/cogl/winsys/cogl-winsys-egl.c b/cogl/cogl/winsys/cogl-winsys-egl.c index 66b9940c0..6c7fcbc2d 100644 --- a/cogl/cogl/winsys/cogl-winsys-egl.c +++ b/cogl/cogl/winsys/cogl-winsys-egl.c @@ -38,7 +38,6 @@ #include "cogl/cogl-context-private.h" #include "cogl/cogl-framebuffer.h" #include "cogl/cogl-onscreen-private.h" -#include "cogl/cogl-swap-chain-private.h" #include "cogl/cogl-renderer-private.h" #include "cogl/cogl-onscreen-template-private.h" #include "cogl/cogl-egl.h" diff --git a/cogl/cogl/winsys/cogl-winsys-glx.c b/cogl/cogl/winsys/cogl-winsys-glx.c index c5d572796..9cab939d3 100644 --- a/cogl/cogl/winsys/cogl-winsys-glx.c +++ b/cogl/cogl/winsys/cogl-winsys-glx.c @@ -37,7 +37,6 @@ #include "cogl/cogl-feature-private.h" #include "cogl/cogl-context-private.h" #include "cogl/cogl-framebuffer.h" -#include "cogl/cogl-swap-chain-private.h" #include "cogl/cogl-renderer-private.h" #include "cogl/cogl-onscreen-template-private.h" #include "cogl/cogl-private.h" @@ -45,7 +44,6 @@ #include "cogl/cogl-frame-info-private.h" #include "cogl/cogl-framebuffer-private.h" #include "cogl/cogl-onscreen-private.h" -#include "cogl/cogl-swap-chain-private.h" #include "cogl/cogl-xlib-renderer.h" #include "cogl/cogl-util.h" #include "cogl/cogl-poll-private.h" diff --git a/src/backends/x11/meta-clutter-backend-x11.c b/src/backends/x11/meta-clutter-backend-x11.c index e7995cf45..243079e51 100644 --- a/src/backends/x11/meta-clutter-backend-x11.c +++ b/src/backends/x11/meta-clutter-backend-x11.c @@ -110,14 +110,13 @@ check_onscreen_template (CoglRenderer *renderer, static CoglDisplay * meta_clutter_backend_x11_get_display (ClutterBackend *clutter_backend, CoglRenderer *renderer, - CoglSwapChain *swap_chain, GError **error) { CoglOnscreenTemplate *onscreen_template; CoglDisplay *display = NULL; gboolean res = FALSE; - onscreen_template = cogl_onscreen_template_new (swap_chain); + onscreen_template = cogl_onscreen_template_new (); /* It's possible that the current renderer doesn't support transparency * or doesn't support stereo, so we try the different combinations.