[gtk/wip/baedert/for-master: 6/17] glcontext-wayland: Only allocate configs we use
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 6/17] glcontext-wayland: Only allocate configs we use
- Date: Sat, 26 Dec 2020 09:00:30 +0000 (UTC)
commit 8a1dba22c64281762a5c8fd1c2c8be47a3001d8b
Author: Timm Bäder <mail baedert org>
Date: Thu Dec 24 09:09:35 2020 +0100
glcontext-wayland: Only allocate configs we use
We only use the first one, so don't allocate space for more than that.
gdk/wayland/gdkglcontext-wayland.c | 23 +++++------------------
1 file changed, 5 insertions(+), 18 deletions(-)
---
diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c
index a668731196..d49f2cec0e 100644
--- a/gdk/wayland/gdkglcontext-wayland.c
+++ b/gdk/wayland/gdkglcontext-wayland.c
@@ -386,7 +386,7 @@ find_eglconfig_for_surface (GdkSurface *surface,
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
EGLint attrs[MAX_EGL_ATTRS];
EGLint count;
- EGLConfig *configs;
+ EGLConfig config;
int i = 0;
attrs[i++] = EGL_SURFACE_TYPE;
@@ -407,17 +407,8 @@ find_eglconfig_for_surface (GdkSurface *surface,
attrs[i++] = EGL_NONE;
g_assert (i < MAX_EGL_ATTRS);
- if (!eglChooseConfig (display_wayland->egl_display, attrs, NULL, 0, &count) || count < 1)
- {
- g_set_error_literal (error, GDK_GL_ERROR,
- GDK_GL_ERROR_UNSUPPORTED_FORMAT,
- _("No available configurations for the given pixel format"));
- return FALSE;
- }
-
- configs = g_new (EGLConfig, count);
-
- if (!eglChooseConfig (display_wayland->egl_display, attrs, configs, count, &count) || count < 1)
+ /* Pick first valid configuration i guess? */
+ if (!eglChooseConfig (display_wayland->egl_display, attrs, &config, 1, &count) || count < 1)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_UNSUPPORTED_FORMAT,
@@ -425,12 +416,8 @@ find_eglconfig_for_surface (GdkSurface *surface,
return FALSE;
}
- /* Pick first valid configuration i guess? */
-
- if (egl_config_out != NULL)
- *egl_config_out = configs[0];
-
- g_free (configs);
+ g_assert (egl_config_out);
+ *egl_config_out = config;
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]