summaryrefslogtreecommitdiff
path: root/gdk/wayland
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2021-07-07 03:00:09 +0200
committerBenjamin Otte <otte@redhat.com>2021-07-22 16:27:31 +0200
commit15ed1a329e2f4939b239d0845f3200df1cdcdd7e (patch)
tree8ae89674e630cf500503413e26f817e3781d64cd /gdk/wayland
parent505436340b6a20b767f53b3dc49ecf9a647c75f0 (diff)
downloadgtk+-15ed1a329e2f4939b239d0845f3200df1cdcdd7e.tar.gz
gl: Require EGL_KHR_surfaceless_context with egl
The code to create and manage a fake egl surface to bind to is complex and completely untested because everyone seems to support this extension. nvidia and Mesa do support it and according to Mesa devs, adding support in a new driver is rather simple and Mesa drivers gain that feature automatically, so all future drivers shoould have it.
Diffstat (limited to 'gdk/wayland')
-rw-r--r--gdk/wayland/gdkdisplay-wayland.h1
-rw-r--r--gdk/wayland/gdkglcontext-wayland.c20
-rw-r--r--gdk/wayland/gdkprivate-wayland.h3
-rw-r--r--gdk/wayland/gdksurface-wayland.c37
4 files changed, 10 insertions, 51 deletions
diff --git a/gdk/wayland/gdkdisplay-wayland.h b/gdk/wayland/gdkdisplay-wayland.h
index d431405570..66e8020b28 100644
--- a/gdk/wayland/gdkdisplay-wayland.h
+++ b/gdk/wayland/gdkdisplay-wayland.h
@@ -159,7 +159,6 @@ struct _GdkWaylandDisplay
guint have_egl_buffer_age : 1;
guint have_egl_swap_buffers_with_damage : 1;
- guint have_egl_surfaceless_context : 1;
};
struct _GdkWaylandDisplayClass
diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c
index 2e83d501f1..de60ebc820 100644
--- a/gdk/wayland/gdkglcontext-wayland.c
+++ b/gdk/wayland/gdkglcontext-wayland.c
@@ -469,6 +469,15 @@ gdk_wayland_display_init_gl (GdkDisplay *display,
return NULL;
}
+ if (!epoxy_has_egl_extension (dpy, "EGL_KHR_surfaceless_context"))
+ {
+ eglTerminate (dpy);
+ g_set_error_literal (error, GDK_GL_ERROR,
+ GDK_GL_ERROR_UNSUPPORTED_PROFILE,
+ _("Surfaceless contexts are not supported on this EGL implementation"));
+ return NULL;
+ }
+
display_wayland->egl_config = get_eglconfig (dpy);
if (!display_wayland->egl_config)
{
@@ -489,9 +498,6 @@ gdk_wayland_display_init_gl (GdkDisplay *display,
display_wayland->have_egl_swap_buffers_with_damage =
epoxy_has_egl_extension (dpy, "EGL_EXT_swap_buffers_with_damage");
- display_wayland->have_egl_surfaceless_context =
- epoxy_has_egl_extension (dpy, "EGL_KHR_surfaceless_context");
-
GDK_DISPLAY_NOTE (display, OPENGL,
g_message ("EGL API version %d.%d found\n"
" - Vendor: %s\n"
@@ -572,13 +578,7 @@ gdk_wayland_display_make_gl_context_current (GdkDisplay *display,
if (gdk_draw_context_is_in_frame (GDK_DRAW_CONTEXT (context)))
egl_surface = gdk_wayland_surface_get_egl_surface (surface);
else
- {
- if (display_wayland->have_egl_surfaceless_context)
- egl_surface = EGL_NO_SURFACE;
- else
- egl_surface = gdk_wayland_surface_get_dummy_egl_surface (surface,
- display_wayland->egl_config);
- }
+ egl_surface = EGL_NO_SURFACE;
if (!eglMakeCurrent (display_wayland->egl_display, egl_surface,
egl_surface, context_wayland->egl_context))
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index 2177cef90d..09f41606f3 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -182,9 +182,6 @@ cairo_surface_t * _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *di
struct wl_buffer *_gdk_wayland_shm_surface_get_wl_buffer (cairo_surface_t *surface);
gboolean _gdk_wayland_is_shm_surface (cairo_surface_t *surface);
-EGLSurface gdk_wayland_surface_get_dummy_egl_surface (GdkSurface *surface,
- EGLConfig config);
-
struct gtk_surface1 * gdk_wayland_surface_get_gtk_surface (GdkSurface *surface);
void gdk_wayland_seat_set_global_cursor (GdkSeat *seat,
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index 124b810394..404b10b226 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -103,7 +103,6 @@ struct _GdkWaylandSurface
struct gtk_surface1 *gtk_surface;
struct wl_egl_window *egl_window;
- struct wl_egl_window *dummy_egl_window;
struct zxdg_exported_v1 *xdg_exported;
struct org_kde_kwin_server_decoration *server_decoration;
} display_server;
@@ -111,7 +110,6 @@ struct _GdkWaylandSurface
struct wl_event_queue *event_queue;
EGLSurface egl_surface;
- EGLSurface dummy_egl_surface;
uint32_t reposition_token;
uint32_t received_reposition_token;
@@ -2901,18 +2899,6 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
if (impl->display_server.wl_surface)
{
- if (impl->dummy_egl_surface)
- {
- eglDestroySurface (display_wayland->egl_display, impl->dummy_egl_surface);
- impl->dummy_egl_surface = NULL;
- }
-
- if (impl->display_server.dummy_egl_window)
- {
- wl_egl_window_destroy (impl->display_server.dummy_egl_window);
- impl->display_server.dummy_egl_window = NULL;
- }
-
if (impl->egl_surface)
{
eglDestroySurface (display_wayland->egl_display, impl->egl_surface);
@@ -4325,29 +4311,6 @@ gdk_wayland_surface_get_egl_surface (GdkSurface *surface)
return impl->egl_surface;
}
-EGLSurface
-gdk_wayland_surface_get_dummy_egl_surface (GdkSurface *surface,
- EGLConfig config)
-{
- GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
- GdkWaylandSurface *impl;
-
- g_return_val_if_fail (GDK_IS_WAYLAND_SURFACE (surface), NULL);
-
- impl = GDK_WAYLAND_SURFACE (surface);
-
- if (impl->dummy_egl_surface == NULL)
- {
- impl->display_server.dummy_egl_window =
- wl_egl_window_create (impl->display_server.wl_surface, 1, 1);
-
- impl->dummy_egl_surface =
- eglCreateWindowSurface (display->egl_display, config, impl->display_server.dummy_egl_window, NULL);
- }
-
- return impl->dummy_egl_surface;
-}
-
struct gtk_surface1 *
gdk_wayland_surface_get_gtk_surface (GdkSurface *surface)
{