mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 22:10:08 +00:00
gpu: Call make current before gc
We do gc in a timeout, when an arbitrary GL context might be current, so we need to make sure its ours and we don't free random textures in another context. Fixes: #6366
This commit is contained in:
parent
c7f00d51eb
commit
7b2b5469eb
@ -125,6 +125,12 @@ gsk_gl_device_create_atlas_image (GskGpuDevice *device,
|
||||
height);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_device_make_current (GskGpuDevice *device)
|
||||
{
|
||||
gdk_gl_context_make_current (gdk_display_get_gl_context (gsk_gpu_device_get_display (device)));
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_device_finalize (GObject *object)
|
||||
{
|
||||
@ -151,6 +157,7 @@ gsk_gl_device_class_init (GskGLDeviceClass *klass)
|
||||
gpu_device_class->create_atlas_image = gsk_gl_device_create_atlas_image;
|
||||
gpu_device_class->create_upload_image = gsk_gl_device_create_upload_image;
|
||||
gpu_device_class->create_download_image = gsk_gl_device_create_download_image;
|
||||
gpu_device_class->make_current = gsk_gl_device_make_current;
|
||||
|
||||
object_class->finalize = gsk_gl_device_finalize;
|
||||
}
|
||||
|
@ -496,6 +496,8 @@ gsk_gpu_device_gc (GskGpuDevice *self,
|
||||
GskGpuCached *cached, *prev;
|
||||
gint64 before G_GNUC_UNUSED = GDK_PROFILER_CURRENT_TIME;
|
||||
|
||||
gsk_gpu_device_make_current (self);
|
||||
|
||||
/* We walk the cache from the end so we don't end up with prev
|
||||
* being a leftover glyph on the atlas we are freeing
|
||||
*/
|
||||
@ -705,6 +707,12 @@ gsk_gpu_device_create_upload_image (GskGpuDevice *self,
|
||||
return GSK_GPU_DEVICE_GET_CLASS (self)->create_upload_image (self, with_mipmap, format, width, height);
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gpu_device_make_current (GskGpuDevice *self)
|
||||
{
|
||||
GSK_GPU_DEVICE_GET_CLASS (self)->make_current (self);
|
||||
}
|
||||
|
||||
GskGpuImage *
|
||||
gsk_gpu_device_create_download_image (GskGpuDevice *self,
|
||||
GdkMemoryDepth depth,
|
||||
|
@ -41,6 +41,8 @@ struct _GskGpuDeviceClass
|
||||
GdkMemoryDepth depth,
|
||||
gsize width,
|
||||
gsize height);
|
||||
void (* make_current) (GskGpuDevice *self);
|
||||
|
||||
};
|
||||
|
||||
GType gsk_gpu_device_get_type (void) G_GNUC_CONST;
|
||||
@ -68,7 +70,7 @@ GskGpuImage * gsk_gpu_device_create_download_image (GskGpuD
|
||||
GdkMemoryDepth depth,
|
||||
gsize width,
|
||||
gsize height);
|
||||
|
||||
void gsk_gpu_device_make_current (GskGpuDevice *self);
|
||||
GskGpuImage * gsk_gpu_device_lookup_texture_image (GskGpuDevice *self,
|
||||
GdkTexture *texture,
|
||||
gint64 timestamp);
|
||||
|
@ -425,6 +425,11 @@ gsk_vulkan_device_create_download_image (GskGpuDevice *device,
|
||||
return image;
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_device_make_current (GskGpuDevice *device)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_vulkan_device_finalize (GObject *object)
|
||||
{
|
||||
@ -493,6 +498,7 @@ gsk_vulkan_device_class_init (GskVulkanDeviceClass *klass)
|
||||
gpu_device_class->create_atlas_image = gsk_vulkan_device_create_atlas_image;
|
||||
gpu_device_class->create_upload_image = gsk_vulkan_device_create_upload_image;
|
||||
gpu_device_class->create_download_image = gsk_vulkan_device_create_download_image;
|
||||
gpu_device_class->make_current = gsk_vulkan_device_make_current;
|
||||
|
||||
object_class->finalize = gsk_vulkan_device_finalize;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user