From 06f28af80ff57ae42f3b3a951d33e8d43e08352c Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Mon, 3 Aug 2020 16:01:40 +0800 Subject: [PATCH 1/9] gdksurface-win32.c: Fix Aerosnap computation Don't get the default display when we compute the Aerosnap region, but instead get it from the underlying GdkSurface that we are using for the computation. Also, don't unref the monitors that we obtain from the display in the wrong place, which was why we had crashes whenever we triggered AeroSnap code (and we are actually not supposed to do that as they are owned by the GdkDisplay that is owned by the GdkSurface we are using), and this will eliminate lots of criticals that are spewed as a result. --- gdk/win32/gdksurface-win32.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index fc52a82a5a..ca8b765113 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -1979,7 +1979,7 @@ calculate_aerosnap_regions (GdkW32DragMoveResizeContext *context) int i; #endif - display = gdk_display_get_default (); + display = gdk_surface_get_display (context->window); monitors = gdk_display_get_monitors (display); #define _M_UP 0 @@ -1999,7 +1999,6 @@ calculate_aerosnap_regions (GdkW32DragMoveResizeContext *context) GdkMonitor *monitor; monitor = g_list_model_get_item (monitors, monitor_idx); - g_object_unref (monitors); gdk_win32_monitor_get_workarea (monitor, &wa); gdk_monitor_get_geometry (monitor, &geometry); @@ -3428,8 +3427,8 @@ setup_drag_move_resize_context (GdkSurface *window, GdkSurfaceEdge edge, GdkDevice *device, int button, - int x, - int y, + double x, + double y, guint32 timestamp) { RECT rect; From 69bb4f8beb6cdb3ff99e66f0d820cc41c2898d4f Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Mon, 3 Aug 2020 18:22:51 +0800 Subject: [PATCH 2/9] GDK-Win32: Move some functions around Move gdk_win32_surface_get_queued_window_rect() and gdk_win32_surface_apply_queued_move_resize() to gdksurface-win32.c, since these functions are not only used for Cairo draw contexts, but is also used for GL draw contexts, and will be used for Vulkan draw contexts. --- gdk/win32/gdkcairocontext-win32.c | 46 ------------------------------- gdk/win32/gdksurface-win32.c | 46 +++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/gdk/win32/gdkcairocontext-win32.c b/gdk/win32/gdkcairocontext-win32.c index 41b54deb3d..fa3b834fae 100644 --- a/gdk/win32/gdkcairocontext-win32.c +++ b/gdk/win32/gdkcairocontext-win32.c @@ -31,52 +31,6 @@ G_DEFINE_TYPE (GdkWin32CairoContext, gdk_win32_cairo_context, GDK_TYPE_CAIRO_CONTEXT) -void -gdk_win32_surface_get_queued_window_rect (GdkSurface *surface, - int scale, - RECT *return_window_rect) -{ - RECT window_rect; - GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface); - - _gdk_win32_get_window_client_area_rect (surface, scale, &window_rect); - - /* Turn client area into window area */ - _gdk_win32_adjust_client_rect (surface, &window_rect); - - /* Convert GDK screen coordinates to W32 desktop coordinates */ - window_rect.left -= _gdk_offset_x * impl->surface_scale; - window_rect.right -= _gdk_offset_x * impl->surface_scale; - window_rect.top -= _gdk_offset_y * impl->surface_scale; - window_rect.bottom -= _gdk_offset_y * impl->surface_scale; - - *return_window_rect = window_rect; -} - -void -gdk_win32_surface_apply_queued_move_resize (GdkSurface *surface, - RECT window_rect) -{ - if (!IsIconic (GDK_SURFACE_HWND (surface))) - { - GDK_NOTE (EVENTS, g_print ("Setting window position ... ")); - - API_CALL (SetWindowPos, (GDK_SURFACE_HWND (surface), - SWP_NOZORDER_SPECIFIED, - window_rect.left, window_rect.top, - window_rect.right - window_rect.left, - window_rect.bottom - window_rect.top, - SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOREDRAW)); - - GDK_NOTE (EVENTS, g_print (" ... set window position\n")); - - return; - } - - /* Don't move iconic windows */ - /* TODO: use SetWindowPlacement() to change non-minimized window position */ -} - static cairo_surface_t * create_cairo_surface_for_layered_window (GdkWin32Surface *impl, int width, diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index ca8b765113..357bfd813e 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -5101,3 +5101,49 @@ _gdk_win32_surface_get_egl_surface (GdkSurface *surface, } #endif + +void +gdk_win32_surface_get_queued_window_rect (GdkSurface *surface, + int scale, + RECT *return_window_rect) +{ + RECT window_rect; + GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface); + + _gdk_win32_get_window_client_area_rect (surface, scale, &window_rect); + + /* Turn client area into window area */ + _gdk_win32_adjust_client_rect (surface, &window_rect); + + /* Convert GDK screen coordinates to W32 desktop coordinates */ + window_rect.left -= _gdk_offset_x * impl->surface_scale; + window_rect.right -= _gdk_offset_x * impl->surface_scale; + window_rect.top -= _gdk_offset_y * impl->surface_scale; + window_rect.bottom -= _gdk_offset_y * impl->surface_scale; + + *return_window_rect = window_rect; +} + +void +gdk_win32_surface_apply_queued_move_resize (GdkSurface *surface, + RECT window_rect) +{ + if (!IsIconic (GDK_SURFACE_HWND (surface))) + { + GDK_NOTE (EVENTS, g_print ("Setting window position ... ")); + + API_CALL (SetWindowPos, (GDK_SURFACE_HWND (surface), + SWP_NOZORDER_SPECIFIED, + window_rect.left, window_rect.top, + window_rect.right - window_rect.left, + window_rect.bottom - window_rect.top, + SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOREDRAW)); + + GDK_NOTE (EVENTS, g_print (" ... set window position\n")); + + return; + } + + /* Don't move iconic windows */ + /* TODO: use SetWindowPlacement() to change non-minimized window position */ +} From c6ada2a329fdb748e03a9ddb4c15bce77f5c1c42 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 5 Aug 2020 10:36:53 +0800 Subject: [PATCH 3/9] gdksurface-win32.c: Add function to handle queued moves/resizes Since we need to deal with queued moves and resizes in the Cairo, GL and Vulkan draw contexts, and the logic involved in all three of these are largely similar, add a function gdk_win32_surface_handle_queued_move_resize() that will handle this, which will be shared between these three types of draw contexts. --- gdk/win32/gdksurface-win32.c | 39 ++++++++++++++++++++++++++++++++++++ gdk/win32/gdksurface-win32.h | 3 +++ 2 files changed, 42 insertions(+) diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index 357bfd813e..9aa33b96ac 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -45,6 +45,7 @@ #include "gdkwin32cursor.h" #include "gdkglcontext-win32.h" #include "gdkdisplay-win32.h" +#include "gdkcairocontext-win32.h" #include #include @@ -5147,3 +5148,41 @@ gdk_win32_surface_apply_queued_move_resize (GdkSurface *surface, /* Don't move iconic windows */ /* TODO: use SetWindowPlacement() to change non-minimized window position */ } + +RECT +gdk_win32_surface_handle_queued_move_resize (GdkDrawContext *draw_context) +{ + GdkWin32CairoContext *cairo_ctx = NULL; + GdkSurface *surface; + GdkWin32Surface *impl; + int scale; + RECT queued_window_rect; + + surface = gdk_draw_context_get_surface (draw_context); + impl = GDK_WIN32_SURFACE (surface); + scale = gdk_surface_get_scale_factor (surface); + + if (GDK_IS_WIN32_CAIRO_CONTEXT (draw_context)) + { + cairo_ctx = GDK_WIN32_CAIRO_CONTEXT (draw_context); + cairo_ctx->layered = impl->layered; + } + + gdk_win32_surface_get_queued_window_rect (surface, scale, &queued_window_rect); + + /* Apply queued resizes for non-double-buffered and non-layered windows + * before painting them (we paint on the window DC directly, + * it must have the right size). + * Due to some poorly-undetstood issue delayed + * resizing of double-buffered windows can produce weird + * artefacts, so these are also resized before we paint. + */ + if (impl->drag_move_resize_context.native_move_resize_pending && + (cairo_ctx == NULL || !cairo_ctx->layered)) + { + impl->drag_move_resize_context.native_move_resize_pending = FALSE; + gdk_win32_surface_apply_queued_move_resize (surface, queued_window_rect); + } + + return queued_window_rect; +} diff --git a/gdk/win32/gdksurface-win32.h b/gdk/win32/gdksurface-win32.h index e4f97d11be..7fb35ed764 100644 --- a/gdk/win32/gdksurface-win32.h +++ b/gdk/win32/gdksurface-win32.h @@ -393,6 +393,9 @@ void gdk_win32_surface_move_resize (GdkSurface *window, int width, int height); +RECT +gdk_win32_surface_handle_queued_move_resize (GdkDrawContext *draw_context); + void gdk_win32_surface_get_queued_window_rect (GdkSurface *surface, int scale, From 46a8a3fe31aa539f4d557b6501a84149d9ae9b28 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 5 Aug 2020 10:43:11 +0800 Subject: [PATCH 4/9] gdk[cairo|gl]context-win32.c: Use gdk_win32_surface_handle_queued_move_resize() Use the shared function that was added in the previous commit, to simplify things. Also make gdk_win32_surface_get_queued_window_rect() and gdk_win32_surface_apply_queued_move_resize() back into static functions, since they are now used only by the code in gdksurface-win32.c --- gdk/win32/gdkcairocontext-win32.c | 18 +----------------- gdk/win32/gdkglcontext-win32.c | 19 +------------------ gdk/win32/gdksurface-win32.c | 4 ++-- gdk/win32/gdksurface-win32.h | 9 --------- 4 files changed, 4 insertions(+), 46 deletions(-) diff --git a/gdk/win32/gdkcairocontext-win32.c b/gdk/win32/gdkcairocontext-win32.c index fa3b834fae..27f8baa36f 100644 --- a/gdk/win32/gdkcairocontext-win32.c +++ b/gdk/win32/gdkcairocontext-win32.c @@ -107,23 +107,7 @@ gdk_win32_cairo_context_begin_frame (GdkDrawContext *draw_context, impl = GDK_WIN32_SURFACE (surface); scale = gdk_surface_get_scale_factor (surface); - self->layered = impl->layered; - - gdk_win32_surface_get_queued_window_rect (surface, scale, &queued_window_rect); - - /* Apply queued resizes for non-double-buffered and non-layered windows - * before painting them (we paint on the window DC directly, - * it must have the right size). - * Due to some poorly-undetstood issue delayed - * resizing of double-buffered windows can produce weird - * artefacts, so these are also resized before we paint. - */ - if (impl->drag_move_resize_context.native_move_resize_pending && - !self->layered) - { - impl->drag_move_resize_context.native_move_resize_pending = FALSE; - gdk_win32_surface_apply_queued_move_resize (surface, queued_window_rect); - } + queued_window_rect = gdk_win32_surface_handle_queued_move_resize (draw_context); width = queued_window_rect.right - queued_window_rect.left; height = queued_window_rect.bottom - queued_window_rect.top; diff --git a/gdk/win32/gdkglcontext-win32.c b/gdk/win32/gdkglcontext-win32.c index a500ffcddc..ed2165d3e2 100644 --- a/gdk/win32/gdkglcontext-win32.c +++ b/gdk/win32/gdkglcontext-win32.c @@ -243,27 +243,10 @@ gdk_win32_gl_context_begin_frame (GdkDrawContext *draw_context, { GdkGLContext *context = GDK_GL_CONTEXT (draw_context); GdkSurface *surface; - GdkWin32Surface *impl; - RECT queued_window_rect; surface = gdk_gl_context_get_surface (context); - impl = GDK_WIN32_SURFACE (surface); - gdk_win32_surface_get_queued_window_rect (surface, - gdk_surface_get_scale_factor (surface), - &queued_window_rect); - - /* Apply queued resizes GL windows before painting them - * (we paint on the window DC directly, it must have the right size). - * Due to some poorly-understood issue delayed - * resizing of double-buffered windows can produce weird - * artefacts, so these are also resized before we paint. - */ - if (impl->drag_move_resize_context.native_move_resize_pending) - { - impl->drag_move_resize_context.native_move_resize_pending = FALSE; - gdk_win32_surface_apply_queued_move_resize (surface, queued_window_rect); - } + gdk_win32_surface_handle_queued_move_resize (draw_context); GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_parent_class)->begin_frame (draw_context, update_area); if (gdk_gl_context_get_shared_context (context)) diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index 9aa33b96ac..bcee5ce242 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -5103,7 +5103,7 @@ _gdk_win32_surface_get_egl_surface (GdkSurface *surface, } #endif -void +static void gdk_win32_surface_get_queued_window_rect (GdkSurface *surface, int scale, RECT *return_window_rect) @@ -5125,7 +5125,7 @@ gdk_win32_surface_get_queued_window_rect (GdkSurface *surface, *return_window_rect = window_rect; } -void +static void gdk_win32_surface_apply_queued_move_resize (GdkSurface *surface, RECT window_rect) { diff --git a/gdk/win32/gdksurface-win32.h b/gdk/win32/gdksurface-win32.h index 7fb35ed764..1f54b7b070 100644 --- a/gdk/win32/gdksurface-win32.h +++ b/gdk/win32/gdksurface-win32.h @@ -396,15 +396,6 @@ void gdk_win32_surface_move_resize (GdkSurface *window, RECT gdk_win32_surface_handle_queued_move_resize (GdkDrawContext *draw_context); -void -gdk_win32_surface_get_queued_window_rect (GdkSurface *surface, - int scale, - RECT *return_window_rect); - -void -gdk_win32_surface_apply_queued_move_resize (GdkSurface *surface, - RECT window_rect); - #ifdef GDK_WIN32_ENABLE_EGL EGLSurface _gdk_win32_surface_get_egl_surface (GdkSurface *surface, EGLConfig config, From 5ce0098adccbb26e8939c4e35278e25437a33205 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Mon, 3 Aug 2020 18:43:46 +0800 Subject: [PATCH 5/9] gdkvulkancontext-win32.c: Implement ->begin_frame() By doing so, we ensure that resizes of windows will work on Vulkan renderer, by first calling gdk_win32_surface_handle_queued_move_resize() before we proceed as usual --- gdk/win32/gdkvulkancontext-win32.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gdk/win32/gdkvulkancontext-win32.c b/gdk/win32/gdkvulkancontext-win32.c index 607658dde9..e0d9ae8473 100644 --- a/gdk/win32/gdkvulkancontext-win32.c +++ b/gdk/win32/gdkvulkancontext-win32.c @@ -72,12 +72,23 @@ gdk_win32_vulkan_context_create_surface (GdkVulkanContext *context, return result; } +static void +gdk_win32_vulkan_context_begin_frame (GdkDrawContext *draw_context, + cairo_region_t *update_area) +{ + gdk_win32_surface_handle_queued_move_resize (draw_context); + + GDK_DRAW_CONTEXT_CLASS (gdk_win32_vulkan_context_parent_class)->begin_frame (draw_context, update_area); +} + static void gdk_win32_vulkan_context_class_init (GdkWin32VulkanContextClass *klass) { GdkVulkanContextClass *context_class = GDK_VULKAN_CONTEXT_CLASS (klass); + GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass); context_class->create_surface = gdk_win32_vulkan_context_create_surface; + draw_context_class->begin_frame = gdk_win32_vulkan_context_begin_frame; } static void From d2291abe2aa55f00b80caee8491055738c95d8e8 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 5 Aug 2020 15:14:44 +0800 Subject: [PATCH 6/9] gdksurface-win32.c: Fix resizing Use gdk_surface_get_geometry() to get the correct x and y coordinates of the window that we are resizing, so that the window does not reposition itself automatically at the top-left corner at resizing as we to used hard-code the x and y coordinates to 0. --- gdk/win32/gdksurface-win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index bcee5ce242..5a61919d95 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -217,7 +217,7 @@ _gdk_win32_get_window_client_area_rect (GdkSurface *window, { int x, y, width, height; - x = y = 0; + gdk_surface_get_geometry (window, &x, &y, NULL, NULL); width = gdk_surface_get_width (window); height = gdk_surface_get_height (window); rect->left = x * scale; From cf5a6a003a65dbccebe7a6f7e331008836729300 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Mon, 3 Aug 2020 16:14:36 +0800 Subject: [PATCH 7/9] testsuite: Setup tests env by platform Check whether we really have x11 and wayland enabled before we try to setup the tests to use these respective GDK backends, and only attempt to setup tests running with the Broadway backend if it has been enabled. Also, add a setup for running tests with the GDK-Win32 backend on Windows, for builds that target Windows. --- testsuite/meson.build | 47 ++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/testsuite/meson.build b/testsuite/meson.build index 03a04048bd..4ef7cced9a 100644 --- a/testsuite/meson.build +++ b/testsuite/meson.build @@ -18,24 +18,39 @@ if get_option('debug') common_env += [ 'GDK_DEBUG=default-settings' ] endif -add_test_setup ('x11', - env: common_env + [ - 'GDK_BACKEND=x11', - 'TEST_OUTPUT_SUBDIR=x11', - ]) +if x11_enabled + add_test_setup ('x11', + env: common_env + [ + 'GDK_BACKEND=x11', + 'TEST_OUTPUT_SUBDIR=x11', + ]) +endif -add_test_setup ('wayland', - is_default: true, - env: common_env + [ - 'GDK_BACKEND=wayland', - 'TEST_OUTPUT_SUBDIR=wayland', - ]) +if wayland_enabled + add_test_setup ('wayland', + is_default: true, + env: common_env + [ + 'GDK_BACKEND=wayland', + 'TEST_OUTPUT_SUBDIR=wayland', + ]) -add_test_setup ('broadway', - env: common_env + [ - 'GDK_BACKEND=broadway', - 'TEST_OUTPUT_SUBDIR=broadway', - ]) +endif + +if os_win32 + add_test_setup ('win32', + env: common_env + [ + 'GDK_BACKEND=win32', + 'TEST_OUTPUT_SUBDIR=win32', + ]) +endif + +if broadway_enabled + add_test_setup ('broadway', + env: common_env + [ + 'GDK_BACKEND=broadway', + 'TEST_OUTPUT_SUBDIR=broadway', + ]) +endif subdir('performance') subdir('gdk') From f454c6f9d067c4ab9ae61749d12eb3983ed446fc Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Mon, 3 Aug 2020 16:23:30 +0800 Subject: [PATCH 8/9] testsuite/gsk: Only run Broadway tests if enabled We may not have enabled building the broadway renderer for our build, so don't run the broadway renderer tests unless it is enabled. --- testsuite/gsk/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/gsk/meson.build b/testsuite/gsk/meson.build index 87cac26974..01e6b38a74 100644 --- a/testsuite/gsk/meson.build +++ b/testsuite/gsk/meson.build @@ -92,7 +92,8 @@ renderers = [ foreach renderer : renderers foreach test : compare_render_tests - if (renderer[1] == '' or not test.contains(renderer[1])) + if ((renderer[1] == '' or not test.contains(renderer[1])) and + (renderer[0] != 'broadway' or broadway_enabled)) test(renderer[0] + ' ' + test, compare_render, args: ['--output', join_paths(meson.current_build_dir(), 'compare', renderer[0]), join_paths(meson.current_source_dir(), 'compare', test + '.node'), From edc1c2823616c0cb21e64820fb009b2c028b811d Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 5 Aug 2020 18:56:57 +0800 Subject: [PATCH 9/9] GdkGLContext: Drop gdk_gl_context_has_[framebuffer_blit|frame_terminator]() gdk_gl_context_has_framebuffer_blit() and gdk_gl_context_has_frame_terminator() were only used by by GDK/Win32, and they do not provide performance advantages in GTK master, so clean up the code a bit by dropping them. --- gdk/gdkglcontext.c | 36 -------------------- gdk/gdkglcontextprivate.h | 2 -- gdk/win32/gdkglcontext-win32.c | 60 ++-------------------------------- 3 files changed, 2 insertions(+), 96 deletions(-) diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c index a7284b27c6..4dc06cc24c 100644 --- a/gdk/gdkglcontext.c +++ b/gdk/gdkglcontext.c @@ -107,8 +107,6 @@ typedef struct { guint realized : 1; guint use_texture_rectangle : 1; - guint has_gl_framebuffer_blit : 1; - guint has_frame_terminator : 1; guint has_khr_debug : 1; guint use_khr_debug : 1; guint has_unpack_subimage : 1; @@ -427,22 +425,6 @@ gdk_gl_context_use_texture_rectangle (GdkGLContext *context) return priv->use_texture_rectangle; } -gboolean -gdk_gl_context_has_framebuffer_blit (GdkGLContext *context) -{ - GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context); - - return priv->has_gl_framebuffer_blit; -} - -gboolean -gdk_gl_context_has_frame_terminator (GdkGLContext *context) -{ - GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context); - - return priv->has_frame_terminator; -} - void gdk_gl_context_push_debug_group (GdkGLContext *context, const char *message) @@ -997,18 +979,6 @@ gdk_gl_context_check_extensions (GdkGLContext *context) has_npot = priv->gl_version >= 20; has_texture_rectangle = FALSE; - /* This should check for GL_NV_framebuffer_blit as well - see extension at: - * - * https://www.khronos.org/registry/gles/extensions/NV/NV_framebuffer_blit.txt - * - * for ANGLE, we can enable bit blitting if we have the - * GL_ANGLE_framebuffer_blit extension - */ - priv->has_gl_framebuffer_blit = epoxy_has_gl_extension ("GL_ANGLE_framebuffer_blit"); - - /* No OES version */ - priv->has_frame_terminator = FALSE; - priv->has_unpack_subimage = epoxy_has_gl_extension ("GL_EXT_unpack_subimage"); priv->has_khr_debug = epoxy_has_gl_extension ("GL_KHR_debug"); } @@ -1017,8 +987,6 @@ gdk_gl_context_check_extensions (GdkGLContext *context) has_npot = priv->gl_version >= 20 || epoxy_has_gl_extension ("GL_ARB_texture_non_power_of_two"); has_texture_rectangle = priv->gl_version >= 31 || epoxy_has_gl_extension ("GL_ARB_texture_rectangle"); - priv->has_gl_framebuffer_blit = priv->gl_version >= 30 || epoxy_has_gl_extension ("GL_EXT_framebuffer_blit"); - priv->has_frame_terminator = epoxy_has_gl_extension ("GL_GREMEDY_frame_terminator"); priv->has_unpack_subimage = TRUE; priv->has_khr_debug = epoxy_has_gl_extension ("GL_KHR_debug"); @@ -1052,8 +1020,6 @@ gdk_gl_context_check_extensions (GdkGLContext *context) "* Extensions checked:\n" " - GL_ARB_texture_non_power_of_two: %s\n" " - GL_ARB_texture_rectangle: %s\n" - " - GL_EXT_framebuffer_blit: %s\n" - " - GL_GREMEDY_frame_terminator: %s\n" " - GL_KHR_debug: %s\n" "* Using texture rectangle: %s", priv->use_es ? "OpenGL ES" : "OpenGL", @@ -1062,8 +1028,6 @@ gdk_gl_context_check_extensions (GdkGLContext *context) glGetString (GL_SHADING_LANGUAGE_VERSION), has_npot ? "yes" : "no", has_texture_rectangle ? "yes" : "no", - priv->has_gl_framebuffer_blit ? "yes" : "no", - priv->has_frame_terminator ? "yes" : "no", priv->has_khr_debug ? "yes" : "no", priv->use_texture_rectangle ? "yes" : "no")); diff --git a/gdk/gdkglcontextprivate.h b/gdk/gdkglcontextprivate.h index bf2dbfa5ff..67fe1a825d 100644 --- a/gdk/gdkglcontextprivate.h +++ b/gdk/gdkglcontextprivate.h @@ -87,8 +87,6 @@ void gdk_gl_context_upload_texture (GdkGLContext guint texture_target); GdkGLContextPaintData * gdk_gl_context_get_paint_data (GdkGLContext *context); gboolean gdk_gl_context_use_texture_rectangle (GdkGLContext *context); -gboolean gdk_gl_context_has_framebuffer_blit (GdkGLContext *context); -gboolean gdk_gl_context_has_frame_terminator (GdkGLContext *context); gboolean gdk_gl_context_has_unpack_subimage (GdkGLContext *context); void gdk_gl_context_push_debug_group (GdkGLContext *context, const char *message); diff --git a/gdk/win32/gdkglcontext-win32.c b/gdk/win32/gdkglcontext-win32.c index ed2165d3e2..625b13ff74 100644 --- a/gdk/win32/gdkglcontext-win32.c +++ b/gdk/win32/gdkglcontext-win32.c @@ -104,25 +104,6 @@ _gdk_win32_gl_context_dispose (GObject *gobject) G_OBJECT_CLASS (gdk_win32_gl_context_parent_class)->dispose (gobject); } -static void -gdk_gl_blit_region (GdkSurface *surface, cairo_region_t *region) -{ - int n_rects, i; - int scale = gdk_surface_get_scale_factor (surface); - int wh = gdk_surface_get_height (surface); - cairo_rectangle_int_t rect; - - n_rects = cairo_region_num_rectangles (region); - for (i = 0; i < n_rects; i++) - { - cairo_region_get_rectangle (region, i, &rect); - glScissor (rect.x * scale, (wh - rect.y - rect.height) * scale, rect.width * scale, rect.height * scale); - glBlitFramebuffer (rect.x * scale, (wh - rect.y - rect.height) * scale, (rect.x + rect.width) * scale, (wh - rect.y) * scale, - rect.x * scale, (wh - rect.y - rect.height) * scale, (rect.x + rect.width) * scale, (wh - rect.y) * scale, - GL_COLOR_BUFFER_BIT, GL_NEAREST); - } -} - #ifdef GDK_WIN32_ENABLE_EGL static gboolean _get_is_egl_force_redraw (GdkSurface *surface) @@ -188,24 +169,7 @@ gdk_win32_gl_context_end_frame (GdkDrawContext *draw_context, } } - if (cairo_region_contains_rectangle (painted, &whole_window) == CAIRO_REGION_OVERLAP_IN) - SwapBuffers (context_win32->gl_hdc); - else if (gdk_gl_context_has_framebuffer_blit (context)) - { - glDrawBuffer(GL_FRONT); - glReadBuffer(GL_BACK); - gdk_gl_blit_region (surface, painted); - glDrawBuffer(GL_BACK); - glFlush(); - - if (gdk_gl_context_has_frame_terminator (context)) - glFrameTerminatorGREMEDY (); - } - else - { - g_warning ("Need to swap whole buffer even thouigh not everything was redrawn. Expect artifacts."); - SwapBuffers (context_win32->gl_hdc); - } + SwapBuffers (context_win32->gl_hdc); } #ifdef GDK_WIN32_ENABLE_EGL else @@ -224,15 +188,7 @@ gdk_win32_gl_context_end_frame (GdkDrawContext *draw_context, _reset_egl_force_redraw (surface); } - if (cairo_region_contains_rectangle (painted, &whole_window) == CAIRO_REGION_OVERLAP_IN || force_egl_redraw_all) - eglSwapBuffers (display->egl_disp, egl_surface); - else if (gdk_gl_context_has_framebuffer_blit (context)) - gdk_gl_blit_region (surface, painted); - else - { - g_warning ("Need to swap whole buffer even thouigh not everything was redrawn. Expect artifacts."); - eglSwapBuffers (display->egl_disp, egl_surface); - } + eglSwapBuffers (display->egl_disp, egl_surface); } #endif } @@ -249,18 +205,6 @@ gdk_win32_gl_context_begin_frame (GdkDrawContext *draw_context, gdk_win32_surface_handle_queued_move_resize (draw_context); GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_parent_class)->begin_frame (draw_context, update_area); - if (gdk_gl_context_get_shared_context (context)) - return; - - if (gdk_gl_context_has_framebuffer_blit (context)) - return; - - /* If nothing else is known, repaint everything so that the back - buffer is fully up-to-date for the swapbuffer */ - cairo_region_union_rectangle (update_area, &(GdkRectangle) { - 0, 0, - gdk_surface_get_width (surface), - gdk_surface_get_height (surface) }); } typedef struct