From 9690c87736d243d016d341b67dc9dcc68fc44a3d Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 10 Sep 2024 14:14:11 +0200 Subject: [PATCH 1/7] docs: Remove duplicated text --- gtk/gtksingleselection.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/gtksingleselection.c b/gtk/gtksingleselection.c index eea4cfc1a3..b47e77fd9f 100644 --- a/gtk/gtksingleselection.c +++ b/gtk/gtksingleselection.c @@ -792,7 +792,7 @@ gtk_single_selection_get_can_unselect (GtkSingleSelection *self) * * Note that setting [property@Gtk.SingleSelection:autoselect] will * cause unselecting to not work, so it practically makes no sense - * to set both at the same time the same time. + * to set both at the same time. */ void gtk_single_selection_set_can_unselect (GtkSingleSelection *self, From e35670a01422ef2c361765ec6ebe41aeaf6fdd32 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 10 Sep 2024 15:04:01 +0200 Subject: [PATCH 2/7] gpu: Don't crash when there's no ops In the rare situation (read: I triggered it with obscure hacks) where no ops are emitted, we could end up pointing into invalid memory and crashing. Don't do that. --- gsk/gpu/gskgpuframe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gsk/gpu/gskgpuframe.c b/gsk/gpu/gskgpuframe.c index 6403ad982d..9fab9e537f 100644 --- a/gsk/gpu/gskgpuframe.c +++ b/gsk/gpu/gskgpuframe.c @@ -74,6 +74,7 @@ gsk_gpu_frame_default_cleanup (GskGpuFrame *self) } gsk_gpu_ops_set_size (&priv->ops, 0); + priv->first_op = NULL; priv->last_op = NULL; } @@ -283,6 +284,9 @@ gsk_gpu_frame_seal_ops (GskGpuFrame *self) GskGpuOp *last, *op; gsize i; + if (gsk_gpu_ops_get_size (&priv->ops) == 0) + return; + priv->first_op = (GskGpuOp *) gsk_gpu_ops_index (&priv->ops, 0); last = priv->first_op; From 1ff9d1545d92e476ed9504983cb3ed4a62fc6818 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 10 Sep 2024 03:01:31 +0200 Subject: [PATCH 3/7] Revert "vulkan: Set VK_SWAPCHAIN_CREATE_DEFERRED_MEMORY_ALLOCATION_BIT_EXT" This reverts commit ffae0010c4a7af25601e286c9488a72889b5b8b1. The commit doesn't work with the nvidia driver and it's not necessary to use it, so drop it for now. Fixes #6992 --- gdk/gdkvulkancontext.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c index 284f0f7d33..9bb7fd961f 100644 --- a/gdk/gdkvulkancontext.c +++ b/gdk/gdkvulkancontext.c @@ -467,9 +467,8 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context, res = GDK_VK_CHECK (vkCreateSwapchainKHR, device, &(VkSwapchainCreateInfoKHR) { .sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR, - .flags = - (gdk_vulkan_context_has_feature (context, GDK_VULKAN_FEATURE_SWAPCHAIN_MAINTENANCE) ? - VK_SWAPCHAIN_CREATE_DEFERRED_MEMORY_ALLOCATION_BIT_EXT : 0), + .pNext = NULL, + .flags = 0, .surface = priv->surface, .minImageCount = CLAMP (4, capabilities.minImageCount, From 748acaf654a0a121d2b856b372fa411ac182c5ad Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 5 Sep 2024 20:58:41 +0200 Subject: [PATCH 4/7] gpu: Use a better character for debug print MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of 🞨 which isn't supported in many places, use ⬚. ⬚ also fits better with □ and ▢ for describing clip regions. --- gsk/gpu/gskgpuprint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gsk/gpu/gskgpuprint.c b/gsk/gpu/gskgpuprint.c index f68afc2288..6300376973 100644 --- a/gsk/gpu/gskgpuprint.c +++ b/gsk/gpu/gskgpuprint.c @@ -22,7 +22,7 @@ gsk_gpu_print_shader_flags (GString *string, switch (clip) { case GSK_GPU_SHADER_CLIP_NONE: - g_string_append (string, "🞨 "); + g_string_append (string, "⬚ "); break; case GSK_GPU_SHADER_CLIP_RECT: g_string_append (string, "□ "); From a8748598b687d1d46f41823d1a9e834a4078b04d Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 5 Sep 2024 21:42:11 +0200 Subject: [PATCH 5/7] gpu: verbose-print if shaders are inside merged ops This is useful when trying to get more ops merged for performance reasons. --- gsk/gpu/gskgpuprint.c | 9 ++++++++- gsk/gpu/gskgpuprintprivate.h | 3 ++- gsk/gpu/gskgpushaderop.c | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gsk/gpu/gskgpuprint.c b/gsk/gpu/gskgpuprint.c index 6300376973..d81b376f2e 100644 --- a/gsk/gpu/gskgpuprint.c +++ b/gsk/gpu/gskgpuprint.c @@ -15,10 +15,17 @@ gsk_gpu_print_indent (GString *string, void gsk_gpu_print_shader_flags (GString *string, - GskGpuShaderFlags flags) + GskGpuShaderFlags flags, + gboolean first) { GskGpuShaderClip clip = gsk_gpu_shader_flags_get_clip (flags); + g_string_append (string, first ? "+ " : "| "); +#if 0 + g_string_append (string, first ? (last ? "⧫ " : "▲ ") + : (last ? "▼ " : "▮ ")); +#endif + switch (clip) { case GSK_GPU_SHADER_CLIP_NONE: diff --git a/gsk/gpu/gskgpuprintprivate.h b/gsk/gpu/gskgpuprintprivate.h index c8359d0b47..1fd2615e4f 100644 --- a/gsk/gpu/gskgpuprintprivate.h +++ b/gsk/gpu/gskgpuprintprivate.h @@ -18,7 +18,8 @@ void gsk_gpu_print_newline (GString void gsk_gpu_print_string (GString *string, const char *s); void gsk_gpu_print_shader_flags (GString *string, - GskGpuShaderFlags flags); + GskGpuShaderFlags flags, + gboolean first); void gsk_gpu_print_color_states (GString *string, GskGpuColorStates color_states); void gsk_gpu_print_enum (GString *string, diff --git a/gsk/gpu/gskgpushaderop.c b/gsk/gpu/gskgpushaderop.c index 874f533e10..34a70ef8ba 100644 --- a/gsk/gpu/gskgpushaderop.c +++ b/gsk/gpu/gskgpushaderop.c @@ -52,7 +52,7 @@ gsk_gpu_shader_op_print (GskGpuOp *op, for (i = 0; i < self->n_ops; i++) { gsk_gpu_print_op (string, indent, shader_name); - gsk_gpu_print_shader_flags (string, self->flags); + gsk_gpu_print_shader_flags (string, self->flags, i == 0); gsk_gpu_print_color_states (string, self->color_states); shader_class->print_instance (self, instance + i * shader_class->vertex_size, From d32037326218abf2080638e60a3832247a7ea6fe Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 11 Sep 2024 08:32:33 +0200 Subject: [PATCH 6/7] gpu: Clarify a function It does functionally the same now, but it makes it mroe clear how it works. As a bonus, it will now trigger for -Wswitch-enum, too. --- gsk/gpu/gskgpuclip.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/gsk/gpu/gskgpuclip.c b/gsk/gpu/gskgpuclip.c index 6cf748bfea..4e1e763744 100644 --- a/gsk/gpu/gskgpuclip.c +++ b/gsk/gpu/gskgpuclip.c @@ -309,13 +309,27 @@ gsk_gpu_clip_get_shader_clip (const GskGpuClip *self, const graphene_point_t *offset, const graphene_rect_t *rect) { - if (self->type == GSK_GPU_CLIP_NONE || - self->type == GSK_GPU_CLIP_CONTAINED || - gsk_gpu_clip_contains_rect (self, offset, rect)) - return GSK_GPU_SHADER_CLIP_NONE; - else if (self->type == GSK_GPU_CLIP_RECT) - return GSK_GPU_SHADER_CLIP_RECT; - else - return GSK_GPU_SHADER_CLIP_ROUNDED; + switch (self->type) + { + case GSK_GPU_CLIP_NONE: + case GSK_GPU_CLIP_CONTAINED: + return GSK_GPU_SHADER_CLIP_NONE; + + case GSK_GPU_CLIP_RECT: + if (gsk_gpu_clip_contains_rect (self, offset, rect)) + return GSK_GPU_SHADER_CLIP_NONE; + else + return GSK_GPU_SHADER_CLIP_RECT; + + case GSK_GPU_CLIP_ROUNDED: + if (gsk_gpu_clip_contains_rect (self, offset, rect)) + return GSK_GPU_SHADER_CLIP_NONE; + else + return GSK_GPU_SHADER_CLIP_ROUNDED; + + case GSK_GPU_CLIP_ALL_CLIPPED: + default: + g_return_val_if_reached (GSK_GPU_SHADER_CLIP_NONE); + } } From e9735f0c35a60ea582782161b71b925b5a6a29a8 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 11 Sep 2024 08:33:53 +0200 Subject: [PATCH 7/7] gpu: Move GskGpuClip declaration into types header Makes it possible to use it in multiple places. --- gsk/gpu/gskgpuclipprivate.h | 2 -- gsk/gpu/gskgputypesprivate.h | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gsk/gpu/gskgpuclipprivate.h b/gsk/gpu/gskgpuclipprivate.h index 01102d652e..8ebdc8f266 100644 --- a/gsk/gpu/gskgpuclipprivate.h +++ b/gsk/gpu/gskgpuclipprivate.h @@ -30,8 +30,6 @@ typedef enum { GSK_GPU_CLIP_ROUNDED } GskGpuClipComplexity; -typedef struct _GskGpuClip GskGpuClip; - struct _GskGpuClip { GskGpuClipComplexity type; diff --git a/gsk/gpu/gskgputypesprivate.h b/gsk/gpu/gskgputypesprivate.h index a73d797c59..46a413f47f 100644 --- a/gsk/gpu/gskgputypesprivate.h +++ b/gsk/gpu/gskgputypesprivate.h @@ -7,6 +7,7 @@ typedef struct _GskGpuBuffer GskGpuBuffer; typedef struct _GskGpuCache GskGpuCache; +typedef struct _GskGpuClip GskGpuClip; typedef guint32 GskGpuColorStates; typedef struct _GskGpuDevice GskGpuDevice; typedef struct _GskGpuFrame GskGpuFrame;