forked from AuroraMiddleware/gtk
egl: Move extension checks to GdkDisplay
We check the same extensions anyway, so no need to duplicate the code.
This commit is contained in:
parent
d128ffcc14
commit
f8b9b309b0
@ -1694,6 +1694,11 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
self->have_egl_buffer_age =
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_buffer_age");
|
||||
self->have_egl_swap_buffers_with_damage =
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_swap_buffers_with_damage");
|
||||
|
||||
GDK_DISPLAY_NOTE (self, OPENGL, {
|
||||
char *ext = describe_extensions (priv->egl_display);
|
||||
char *cfg = describe_egl_config (priv->egl_display, priv->egl_config);
|
||||
@ -1713,7 +1718,6 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
g_free (ext);
|
||||
});
|
||||
|
||||
|
||||
gdk_profiler_end_mark (start_time, "init EGL", NULL);
|
||||
|
||||
return TRUE;
|
||||
|
@ -92,6 +92,8 @@ struct _GdkDisplay
|
||||
guint double_click_time; /* Maximum time between clicks in msecs */
|
||||
guint double_click_distance; /* Maximum distance between clicks in pixels */
|
||||
|
||||
GList *seats;
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
VkInstance vk_instance;
|
||||
VkDebugReportCallbackEXT vk_debug_callback;
|
||||
@ -103,7 +105,9 @@ struct _GdkDisplay
|
||||
guint vulkan_refcount;
|
||||
#endif /* GDK_RENDERING_VULKAN */
|
||||
|
||||
GList *seats;
|
||||
/* egl info */
|
||||
guint have_egl_buffer_age : 1;
|
||||
guint have_egl_swap_buffers_with_damage : 1;
|
||||
};
|
||||
|
||||
struct _GdkDisplayClass
|
||||
|
@ -149,11 +149,6 @@ struct _GdkWaylandDisplay
|
||||
GListStore *monitors;
|
||||
|
||||
gint64 last_bell_time_ms;
|
||||
|
||||
/* egl info */
|
||||
|
||||
guint have_egl_buffer_age : 1;
|
||||
guint have_egl_swap_buffers_with_damage : 1;
|
||||
};
|
||||
|
||||
struct _GdkWaylandDisplayClass
|
||||
|
@ -208,12 +208,11 @@ static cairo_region_t *
|
||||
gdk_wayland_gl_context_get_damage (GdkGLContext *context)
|
||||
{
|
||||
GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
EGLSurface egl_surface;
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context));
|
||||
int buffer_age = 0;
|
||||
|
||||
if (display_wayland->have_egl_buffer_age)
|
||||
if (display->have_egl_buffer_age)
|
||||
{
|
||||
egl_surface = gdk_surface_get_egl_surface (surface);
|
||||
gdk_gl_context_make_current (context);
|
||||
@ -297,7 +296,6 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context,
|
||||
GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
|
||||
GdkSurface *surface = gdk_gl_context_get_surface (context);
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
EGLSurface egl_surface;
|
||||
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->end_frame (draw_context, painted);
|
||||
@ -309,7 +307,7 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context,
|
||||
gdk_wayland_surface_request_frame (surface);
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "swap buffers");
|
||||
if (display_wayland->have_egl_swap_buffers_with_damage)
|
||||
if (display->have_egl_swap_buffers_with_damage)
|
||||
{
|
||||
EGLint stack_rects[4 * 4]; /* 4 rects */
|
||||
EGLint *heap_rects = NULL;
|
||||
@ -390,7 +388,6 @@ gdk_wayland_display_init_gl (GdkDisplay *display,
|
||||
GError **error)
|
||||
{
|
||||
GdkWaylandDisplay *self = GDK_WAYLAND_DISPLAY (display);
|
||||
EGLDisplay egl_display;
|
||||
|
||||
if (!gdk_display_init_egl (display,
|
||||
EGL_PLATFORM_WAYLAND_EXT,
|
||||
@ -407,14 +404,6 @@ gdk_wayland_display_init_gl (GdkDisplay *display,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
egl_display = gdk_display_get_egl_display (display);
|
||||
|
||||
self->have_egl_buffer_age =
|
||||
epoxy_has_egl_extension (egl_display, "EGL_EXT_buffer_age");
|
||||
|
||||
self->have_egl_swap_buffers_with_damage =
|
||||
epoxy_has_egl_extension (egl_display, "EGL_EXT_swap_buffers_with_damage");
|
||||
|
||||
return g_object_new (GDK_TYPE_WAYLAND_GL_CONTEXT,
|
||||
"display", display,
|
||||
NULL);
|
||||
|
@ -2995,11 +2995,6 @@ gdk_x11_display_init_gl_backend (GdkX11Display *self,
|
||||
|
||||
self->egl_version = epoxy_egl_version (egl_display);
|
||||
|
||||
self->has_egl_buffer_age =
|
||||
epoxy_has_egl_extension (egl_display, "EGL_EXT_buffer_age");
|
||||
self->has_egl_swap_buffers_with_damage =
|
||||
epoxy_has_egl_extension (egl_display, "EGL_EXT_swap_buffers_with_damage");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -155,10 +155,6 @@ struct _GdkX11Display
|
||||
guint has_glx_visual_rating : 1;
|
||||
guint has_glx_create_es2_context : 1;
|
||||
guint has_async_glx_swap_buffers : 1;
|
||||
|
||||
/* EGL extensions we check */
|
||||
guint has_egl_buffer_age : 1;
|
||||
guint has_egl_swap_buffers_with_damage : 1;
|
||||
};
|
||||
|
||||
struct _GdkX11DisplayClass
|
||||
|
@ -77,7 +77,6 @@ gdk_x11_gl_context_egl_end_frame (GdkDrawContext *draw_context,
|
||||
GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
|
||||
GdkSurface *surface = gdk_gl_context_get_surface (context);
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
||||
EGLSurface egl_surface;
|
||||
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_x11_gl_context_egl_parent_class)->end_frame (draw_context, painted);
|
||||
@ -87,7 +86,7 @@ gdk_x11_gl_context_egl_end_frame (GdkDrawContext *draw_context,
|
||||
egl_surface = gdk_surface_get_egl_surface (surface);
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "x11", "swap buffers");
|
||||
if (display_x11->has_egl_swap_buffers_with_damage)
|
||||
if (display->have_egl_swap_buffers_with_damage)
|
||||
{
|
||||
int i, j, n_rects = cairo_region_num_rectangles (painted);
|
||||
int surface_height = gdk_surface_get_height (surface);
|
||||
@ -186,9 +185,8 @@ static cairo_region_t *
|
||||
gdk_x11_gl_context_egl_get_damage (GdkGLContext *context)
|
||||
{
|
||||
GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
||||
|
||||
if (display_x11->has_egl_buffer_age)
|
||||
if (display->have_egl_buffer_age)
|
||||
{
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context));
|
||||
EGLSurface egl_surface;
|
||||
|
Loading…
Reference in New Issue
Block a user