You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mutter/SOURCES/0001-cogl-egl-Choose-config...

90 lines
3.5 KiB

From 3a858da28e0517a862e40ea992f8bb0f2988dc33 Mon Sep 17 00:00:00 2001
From: Jocelyn Falempe <jfalempe@redhat.com>
Date: Fri, 18 Oct 2024 17:19:14 +0200
Subject: [PATCH 1/2] cogl/egl: Choose config only if needed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In try_create_context(), if COGL_EGL_WINSYS_FEATURE_NO_CONFIG_CONTEXT
is set, don't try to choose an egl config.
Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4088>
(cherry picked from commit 18085b0e402ba5a7fe9c6a06a8cbb0bfcaabebf7)
---
cogl/cogl/winsys/cogl-winsys-egl-private.h | 2 ++
cogl/cogl/winsys/cogl-winsys-egl-x11.c | 1 +
cogl/cogl/winsys/cogl-winsys-egl.c | 27 +++++++++++++---------
3 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/cogl/cogl/winsys/cogl-winsys-egl-private.h b/cogl/cogl/winsys/cogl-winsys-egl-private.h
index 6a31d1ab2d..30821cc22f 100644
--- a/cogl/cogl/winsys/cogl-winsys-egl-private.h
+++ b/cogl/cogl/winsys/cogl-winsys-egl-private.h
@@ -120,6 +120,8 @@ typedef struct _CoglRendererEGL
/* vtable for platform specific parts */
const CoglWinsysEGLVtable *platform_vtable;
+ gboolean needs_config;
+
/* Sync for latest submitted work */
EGLSyncKHR sync;
diff --git a/cogl/cogl/winsys/cogl-winsys-egl-x11.c b/cogl/cogl/winsys/cogl-winsys-egl-x11.c
index 7393f79f6a..d61e82f4de 100644
--- a/cogl/cogl/winsys/cogl-winsys-egl-x11.c
+++ b/cogl/cogl/winsys/cogl-winsys-egl-x11.c
@@ -244,6 +244,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
egl_renderer->platform_vtable = &_cogl_winsys_egl_vtable;
egl_renderer->sync = EGL_NO_SYNC_KHR;
+ egl_renderer->needs_config = TRUE;
if (!_cogl_xlib_renderer_connect (renderer, error))
goto error;
diff --git a/cogl/cogl/winsys/cogl-winsys-egl.c b/cogl/cogl/winsys/cogl-winsys-egl.c
index b37ba15316..54a402aee2 100644
--- a/cogl/cogl/winsys/cogl-winsys-egl.c
+++ b/cogl/cogl/winsys/cogl-winsys-egl.c
@@ -329,19 +329,24 @@ try_create_context (CoglDisplay *display,
edpy = egl_renderer->edpy;
- if (!egl_renderer->platform_vtable->choose_config (display,
- cfg_attribs,
- &config,
- &config_error))
+ if (!(egl_renderer->private_features &
+ COGL_EGL_WINSYS_FEATURE_NO_CONFIG_CONTEXT) ||
+ egl_renderer->needs_config)
{
- g_set_error (error, COGL_WINSYS_ERROR,
- COGL_WINSYS_ERROR_CREATE_CONTEXT,
- "Couldn't choose config: %s", config_error->message);
- g_error_free (config_error);
- goto err;
- }
+ if (!egl_renderer->platform_vtable->choose_config (display,
+ cfg_attribs,
+ &config,
+ &config_error))
+ {
+ g_set_error (error, COGL_WINSYS_ERROR,
+ COGL_WINSYS_ERROR_CREATE_CONTEXT,
+ "Couldn't choose config: %s", config_error->message);
+ g_error_free (config_error);
+ goto err;
+ }
- egl_display->egl_config = config;
+ egl_display->egl_config = config;
+ }
if (display->renderer->driver == COGL_DRIVER_GL3)
{
--
2.44.0.501.g19981daefd.dirty