From 5a11ee7b9cda98c6ecda62025a32e0499522882d Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 1 Oct 2024 23:55:57 +0200 Subject: [PATCH 1/2] gpu: Add GSK_GPU_DISABLE=repeat This is useful for testing of repeat nodes - both performance and conformance, and potentially even driver issues with GL_REPEAT. We have code for manual repeating anyway, so adding a flag to force always using it is easy. --- gsk/gpu/gskgpunodeprocessor.c | 8 ++++++-- gsk/gpu/gskgpurenderer.c | 1 + gsk/gpu/gskgputypesprivate.h | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gsk/gpu/gskgpunodeprocessor.c b/gsk/gpu/gskgpunodeprocessor.c index c2c2f756a2..d82c56d578 100644 --- a/gsk/gpu/gskgpunodeprocessor.c +++ b/gsk/gpu/gskgpunodeprocessor.c @@ -3265,6 +3265,7 @@ gsk_gpu_node_processor_add_repeat_node (GskGpuNodeProcessor *self, const graphene_rect_t *child_bounds; graphene_rect_t bounds; float tile_left, tile_right, tile_top, tile_bottom; + gboolean avoid_offscreen; child = gsk_repeat_node_get_child (node); child_bounds = gsk_repeat_node_get_child_bounds (node); @@ -3279,10 +3280,12 @@ gsk_gpu_node_processor_add_repeat_node (GskGpuNodeProcessor *self, tile_right = (bounds.origin.x + bounds.size.width - child_bounds->origin.x) / child_bounds->size.width; tile_top = (bounds.origin.y - child_bounds->origin.y) / child_bounds->size.height; tile_bottom = (bounds.origin.y + bounds.size.height - child_bounds->origin.y) / child_bounds->size.height; + avoid_offscreen = !gsk_gpu_frame_should_optimize (self->frame, GSK_GPU_OPTIMIZE_REPEAT); /* the 1st check tests that a tile fully fits into the bounds, * the 2nd check is to catch the case where it fits exactly */ - if (ceilf (tile_left) < floorf (tile_right) && + if (!avoid_offscreen && + ceilf (tile_left) < floorf (tile_right) && bounds.size.width > child_bounds->size.width) { if (ceilf (tile_top) < floorf (tile_bottom) && @@ -3320,7 +3323,8 @@ gsk_gpu_node_processor_add_repeat_node (GskGpuNodeProcessor *self, } } } - else if (ceilf (tile_top) < floorf (tile_bottom) && + else if (!avoid_offscreen && + ceilf (tile_top) < floorf (tile_bottom) && bounds.size.height > child_bounds->size.height) { /* repeat horizontally, tile vertically */ diff --git a/gsk/gpu/gskgpurenderer.c b/gsk/gpu/gskgpurenderer.c index 06ff4d1cf4..f904211d2c 100644 --- a/gsk/gpu/gskgpurenderer.c +++ b/gsk/gpu/gskgpurenderer.c @@ -32,6 +32,7 @@ static const GdkDebugKey gsk_gpu_optimization_keys[] = { { "mipmap", GSK_GPU_OPTIMIZE_MIPMAP, "Avoid creating mipmaps" }, { "to-image", GSK_GPU_OPTIMIZE_TO_IMAGE, "Don't fast-path creation of images for nodes" }, { "occlusion", GSK_GPU_OPTIMIZE_OCCLUSION_CULLING, "Disable occlusion culling via opaque node tracking" }, + { "repeat", GSK_GPU_OPTIMIZE_REPEAT, "Repeat drawing operations instead of using offscreen and GL_REPEAT" }, }; typedef struct _GskGpuRendererPrivate GskGpuRendererPrivate; diff --git a/gsk/gpu/gskgputypesprivate.h b/gsk/gpu/gskgputypesprivate.h index 9d2f3878ca..0e6a98422d 100644 --- a/gsk/gpu/gskgputypesprivate.h +++ b/gsk/gpu/gskgputypesprivate.h @@ -139,5 +139,6 @@ typedef enum { GSK_GPU_OPTIMIZE_MIPMAP = 1 << 4, GSK_GPU_OPTIMIZE_TO_IMAGE = 1 << 5, GSK_GPU_OPTIMIZE_OCCLUSION_CULLING = 1 << 6, + GSK_GPU_OPTIMIZE_REPEAT = 1 << 7, } GskGpuOptimizations; From 5d4f2822d06818a5660af0574adf353080f6f05b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 3 Oct 2024 20:09:43 -0400 Subject: [PATCH 2/2] Fix testsuite setup We no longer say GDK_DEBUG=gl-prefer-gl, we say GDK_DISABLE=gles-api. --- testsuite/meson.build | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/testsuite/meson.build b/testsuite/meson.build index 56810d2a23..e4033e7c10 100644 --- a/testsuite/meson.build +++ b/testsuite/meson.build @@ -25,8 +25,7 @@ setups = [ { 'backend': 'wayland', 'if': wayland_enabled, 'is_default': true, }, { 'name': 'wayland_gl', 'backend': 'wayland', 'if': wayland_enabled, - 'env': ['GDK_DEBUG=gl-prefer-gl,default-settings', - ], }, + 'env': ['GDK_DISABLE=gles-api' ], }, { 'backend': 'win32', 'if': os_win32 }, { 'backend': 'broadway', 'if': broadway_enabled, }, { 'backend': 'win32', 'if': os_win32 },