1
0
Fork 0

cogl: Remove no longer used OnscreenTemplate

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3915>
This commit is contained in:
Bilal Elmoussaoui 2024-07-31 16:11:55 +02:00 committed by Bilal Elmoussaoui
parent 3b386ba5d7
commit 5277e33d37
10 changed files with 4 additions and 242 deletions

View file

@ -140,27 +140,7 @@ clutter_backend_do_real_create_context (ClutterBackend *backend,
}
else
{
CoglOnscreenTemplate *tmpl;
gboolean res;
tmpl = cogl_onscreen_template_new ();
/* XXX: I have some doubts that this is a good design.
*
* Conceptually should we be able to check an onscreen_template
* without more details about the CoglDisplay configuration?
*/
res = cogl_renderer_check_onscreen_template (backend->cogl_renderer,
tmpl,
error);
if (!res)
goto error;
backend->cogl_display = cogl_display_new (backend->cogl_renderer, tmpl);
/* the display owns the template */
g_object_unref (tmpl);
backend->cogl_display = cogl_display_new (backend->cogl_renderer);
}
if (backend->cogl_display == NULL)

View file

@ -41,7 +41,6 @@ struct _CoglDisplay
gboolean setup;
CoglRenderer *renderer;
CoglOnscreenTemplate *onscreen_template;
void *winsys;
};

View file

@ -63,7 +63,6 @@ cogl_display_dispose (GObject *object)
}
g_clear_object (&display->renderer);
g_clear_object (&display->onscreen_template);
G_OBJECT_CLASS (cogl_display_parent_class)->dispose (object);
}
@ -82,8 +81,7 @@ cogl_display_class_init (CoglDisplayClass *class)
}
CoglDisplay *
cogl_display_new (CoglRenderer *renderer,
CoglOnscreenTemplate *onscreen_template)
cogl_display_new (CoglRenderer *renderer)
{
g_return_val_if_fail (renderer != NULL, NULL);
@ -93,8 +91,6 @@ cogl_display_new (CoglRenderer *renderer,
renderer->display = display;
display->setup = FALSE;
cogl_display_set_onscreen_template (display, onscreen_template);
return display;
}
@ -104,26 +100,6 @@ cogl_display_get_renderer (CoglDisplay *display)
return display->renderer;
}
void
cogl_display_set_onscreen_template (CoglDisplay *display,
CoglOnscreenTemplate *onscreen_template)
{
g_return_if_fail (display->setup == FALSE);
if (onscreen_template)
g_object_ref (onscreen_template);
if (display->onscreen_template)
g_object_unref (display->onscreen_template);
display->onscreen_template = onscreen_template;
/* 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 ();
}
gboolean
cogl_display_setup (CoglDisplay *display,
GError **error)

View file

@ -37,7 +37,6 @@
#endif
#include "cogl/cogl-renderer.h"
#include "cogl/cogl-onscreen-template.h"
#include <glib-object.h>
@ -80,7 +79,6 @@ G_DECLARE_FINAL_TYPE (CoglDisplay,
/**
* cogl_display_new:
* @renderer: A #CoglRenderer
* @onscreen_template: A #CoglOnscreenTemplate
*
* Explicitly allocates a new #CoglDisplay object to encapsulate the
* common state of the display pipeline that applies to the whole
@ -89,11 +87,6 @@ G_DECLARE_FINAL_TYPE (CoglDisplay,
* A @display can only be made for a specific choice of renderer which
* is why this takes the @renderer argument.
*
* A common use for explicitly allocating a display object is to
* define a template for allocating onscreen framebuffers which is
* what the @onscreen_template argument is for, or alternatively
* you can use cogl_display_set_onscreen_template().
*
* When a display is first allocated via cogl_display_new() it is in a
* mutable configuration mode. It's designed this way so we can
* extend the apis available for configuring a display without
@ -111,8 +104,7 @@ G_DECLARE_FINAL_TYPE (CoglDisplay,
* object in a mutable configuration mode.
*/
COGL_EXPORT CoglDisplay *
cogl_display_new (CoglRenderer *renderer,
CoglOnscreenTemplate *onscreen_template);
cogl_display_new (CoglRenderer *renderer);
/**
* cogl_display_get_renderer:
@ -126,23 +118,6 @@ cogl_display_new (CoglRenderer *renderer,
COGL_EXPORT CoglRenderer *
cogl_display_get_renderer (CoglDisplay *display);
/**
* cogl_display_set_onscreen_template:
* @display: a #CoglDisplay
* @onscreen_template: A template for creating #CoglOnscreen framebuffers
*
* Specifies a template for creating #CoglOnscreen framebuffers.
*
* Depending on the system, the constraints for creating #CoglOnscreen
* framebuffers need to be known before setting up a #CoglDisplay because the
* final setup of the display may constrain how onscreen framebuffers may be
* allocated. If Cogl knows how an application wants to allocate onscreen
* framebuffers then it can try to make sure to setup the display accordingly.
*/
COGL_EXPORT void
cogl_display_set_onscreen_template (CoglDisplay *display,
CoglOnscreenTemplate *onscreen_template);
/**
* cogl_display_setup:
* @display: a #CoglDisplay

View file

@ -1,60 +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 <robert@linux.intel.com>
*/
#include "config.h"
#include "cogl/cogl-framebuffer-private.h"
#include <stdlib.h>
struct _CoglOnscreenTemplate {
GObject parent_class;
};
G_DEFINE_FINAL_TYPE (CoglOnscreenTemplate, cogl_onscreen_template, G_TYPE_OBJECT);
static void
cogl_onscreen_template_init (CoglOnscreenTemplate *onscreen_template)
{
}
static void
cogl_onscreen_template_class_init (CoglOnscreenTemplateClass *class)
{
}
CoglOnscreenTemplate *
cogl_onscreen_template_new (void)
{
CoglOnscreenTemplate *onscreen_template = g_object_new (COGL_TYPE_ONSCREEN_TEMPLATE, NULL);
return onscreen_template;
}

View file

@ -1,53 +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 <robert@linux.intel.com>
*
*/
#pragma once
#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION)
#error "Only <cogl/cogl.h> can be included directly."
#endif
#include <glib-object.h>
G_BEGIN_DECLS
#define COGL_TYPE_ONSCREEN_TEMPLATE (cogl_onscreen_template_get_type ())
COGL_EXPORT
G_DECLARE_FINAL_TYPE (CoglOnscreenTemplate, cogl_onscreen_template,
COGL, ONSCREEN_TEMPLATE, GObject)
COGL_EXPORT CoglOnscreenTemplate *
cogl_onscreen_template_new (void);
G_END_DECLS

View file

@ -215,28 +215,6 @@ cogl_xlib_renderer_set_foreign_display (CoglRenderer *renderer,
}
#endif /* HAVE_X11 */
gboolean
cogl_renderer_check_onscreen_template (CoglRenderer *renderer,
CoglOnscreenTemplate *onscreen_template,
GError **error)
{
CoglDisplay *display;
if (!cogl_renderer_connect (renderer, error))
return FALSE;
display = cogl_display_new (renderer, onscreen_template);
if (!cogl_display_setup (display, error))
{
g_object_unref (display);
return FALSE;
}
g_object_unref (display);
return TRUE;
}
typedef gboolean (*CoglDriverCallback) (CoglDriverDescription *description,
void *user_data);

View file

@ -33,7 +33,6 @@
#endif
#include "cogl/cogl-types.h"
#include "cogl/cogl-onscreen-template.h"
#include "cogl/cogl-pixel-format.h"
#include <glib-object.h>
@ -156,23 +155,6 @@ typedef enum
COGL_EXPORT CoglWinsysID
cogl_renderer_get_winsys_id (CoglRenderer *renderer);
/**
* cogl_renderer_check_onscreen_template:
* @renderer: A #CoglRenderer
* @onscreen_template: A #CoglOnscreenTemplate
* @error: A pointer to a #GError for reporting exceptions
*
* Tests if a given @onscreen_template can be supported with the given
* @renderer.
*
* Return value: %TRUE if the @onscreen_template can be supported,
* else %FALSE.
*/
COGL_EXPORT gboolean
cogl_renderer_check_onscreen_template (CoglRenderer *renderer,
CoglOnscreenTemplate *onscreen_template,
GError **error);
/* Final connection API */
/**

View file

@ -41,7 +41,6 @@ cogl_headers = [
'cogl-meta-texture.h',
'cogl-offscreen.h',
'cogl-onscreen.h',
'cogl-onscreen-template.h',
'cogl-pipeline.h',
'cogl-pipeline-layer-state.h',
'cogl-pipeline-state.h',
@ -217,8 +216,6 @@ cogl_sources = [
'cogl-offscreen-private.h',
'cogl-offscreen.c',
'cogl-onscreen-private.h',
'cogl-onscreen-template.c',
'cogl-onscreen-template.h',
'cogl-onscreen.c',
'cogl-pipeline-cache-private.h',
'cogl-pipeline-cache.c',

View file

@ -71,19 +71,7 @@ meta_clutter_backend_x11_get_display (ClutterBackend *clutter_backend,
CoglRenderer *renderer,
GError **error)
{
g_autoptr (CoglOnscreenTemplate) onscreen_template = NULL;
CoglDisplay *display = NULL;
gboolean res = FALSE;
onscreen_template = cogl_onscreen_template_new ();
res = cogl_renderer_check_onscreen_template (renderer,
onscreen_template,
error);
if (res)
display = cogl_display_new (renderer, onscreen_template);
return display;
return cogl_display_new (renderer);
}
static CoglRenderer *