gsk: Move gc calls

maybe_gc() may make a different context current, so do it before
the renderer has made its own context current.
This commit is contained in:
Matthias Clasen 2024-01-29 07:47:40 -05:00
parent 89712fc750
commit d790268031

View File

@ -299,8 +299,6 @@ gsk_gpu_renderer_fallback_render_texture (GskGpuRenderer *self,
MIN (image_width, width - x), MIN (image_width, width - x),
MIN (image_height, height - y)); MIN (image_height, height - y));
gsk_gpu_device_maybe_gc (priv->device);
frame = gsk_gpu_renderer_create_frame (self); frame = gsk_gpu_renderer_create_frame (self);
gsk_gpu_frame_render (frame, gsk_gpu_frame_render (frame,
g_get_monotonic_time (), g_get_monotonic_time (),
@ -314,8 +312,6 @@ gsk_gpu_renderer_fallback_render_texture (GskGpuRenderer *self,
&texture); &texture);
g_object_unref (frame); g_object_unref (frame);
gsk_gpu_device_queue_gc (priv->device);
g_assert (texture); g_assert (texture);
gdk_texture_downloader_init (&downloader, texture); gdk_texture_downloader_init (&downloader, texture);
gdk_texture_downloader_set_format (&downloader, format); gdk_texture_downloader_set_format (&downloader, format);
@ -347,6 +343,8 @@ gsk_gpu_renderer_render_texture (GskRenderer *renderer,
GdkTexture *texture; GdkTexture *texture;
graphene_rect_t rounded_viewport; graphene_rect_t rounded_viewport;
gsk_gpu_device_maybe_gc (priv->device);
gsk_gpu_renderer_make_current (self); gsk_gpu_renderer_make_current (self);
rounded_viewport = GRAPHENE_RECT_INIT (viewport->origin.x, rounded_viewport = GRAPHENE_RECT_INIT (viewport->origin.x,
@ -363,8 +361,6 @@ gsk_gpu_renderer_render_texture (GskRenderer *renderer,
frame = gsk_gpu_renderer_create_frame (self); frame = gsk_gpu_renderer_create_frame (self);
gsk_gpu_device_maybe_gc (priv->device);
texture = NULL; texture = NULL;
gsk_gpu_frame_render (frame, gsk_gpu_frame_render (frame,
g_get_monotonic_time (), g_get_monotonic_time (),
@ -407,6 +403,8 @@ gsk_gpu_renderer_render (GskRenderer *renderer,
gsk_render_node_get_preferred_depth (root), gsk_render_node_get_preferred_depth (root),
region); region);
gsk_gpu_device_maybe_gc (priv->device);
gsk_gpu_renderer_make_current (self); gsk_gpu_renderer_make_current (self);
backbuffer = GSK_GPU_RENDERER_GET_CLASS (self)->get_backbuffer (self); backbuffer = GSK_GPU_RENDERER_GET_CLASS (self)->get_backbuffer (self);
@ -415,8 +413,6 @@ gsk_gpu_renderer_render (GskRenderer *renderer,
render_region = get_render_region (self); render_region = get_render_region (self);
surface = gdk_draw_context_get_surface (priv->context); surface = gdk_draw_context_get_surface (priv->context);
gsk_gpu_device_maybe_gc (priv->device);
gsk_gpu_frame_render (frame, gsk_gpu_frame_render (frame,
g_get_monotonic_time (), g_get_monotonic_time (),
backbuffer, backbuffer,