[gtk/wip/baedert/for-master] 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] glcontext-wayland: Only allocate configs we use
- Date: Thu, 24 Dec 2020 08:10:06 +0000 (UTC)
commit 6867b7b715afacaa39bd8c2fa114bfe04495aaa9
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 | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c
index 726ca25f10..b0d19d5a18 100644
--- a/gdk/wayland/gdkglcontext-wayland.c
+++ b/gdk/wayland/gdkglcontext-wayland.c
@@ -387,7 +387,7 @@ find_eglconfig_for_surface (GdkSurface *surface,
EGLint attrs[MAX_EGL_ATTRS];
EGLBoolean result;
EGLint count;
- EGLConfig *configs;
+ EGLConfig config;
int i = 0;
attrs[i++] = EGL_SURFACE_TYPE;
@@ -417,9 +417,8 @@ find_eglconfig_for_surface (GdkSurface *surface,
return FALSE;
}
- configs = g_new (EGLConfig, count);
-
- result = eglChooseConfig (display_wayland->egl_display, attrs, configs, count, &count);
+ /* Pick first valid configuration i guess? */
+ result = eglChooseConfig (display_wayland->egl_display, attrs, &config, 1, &count);
if (!result || count < 1)
{
g_set_error_literal (error, GDK_GL_ERROR,
@@ -428,12 +427,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]