[gtk/wip/chergert/fix-ngl-cache-eviction: 2/2] ngl: clear Glyph front cache at the beginning of a frame




commit 0f0ee97e1e4a835ca84de96267b25380be7de6c4
Author: Christian Hergert <chergert redhat com>
Date:   Thu Mar 18 17:54:48 2021 -0700

    ngl: clear Glyph front cache at the beginning of a frame
    
    We don't want to be responsible for duplicating the effort of the hash
    table, we just want to speed up subsequent lookups. Otherwise, we risk
    not marking glyph usage when tracking usage for compaction.

 gsk/ngl/gsknglglyphlibrary.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/gsk/ngl/gsknglglyphlibrary.c b/gsk/ngl/gsknglglyphlibrary.c
index 5cb2a3fe3b..bc57475c00 100644
--- a/gsk/ngl/gsknglglyphlibrary.c
+++ b/gsk/ngl/gsknglglyphlibrary.c
@@ -83,6 +83,16 @@ gsk_ngl_glyph_value_free (gpointer data)
   g_slice_free (GskNglGlyphValue, data);
 }
 
+static void
+gsk_ngl_glyph_library_begin_frame (GskNglTextureLibrary *library,
+                                   gint64                frame_id,
+                                   GPtrArray            *removed_atlases)
+{
+  GskNglGlyphLibrary *self = GSK_NGL_GLYPH_LIBRARY (library);
+
+  memset (self->front, 0, sizeof self->front);
+}
+
 static void
 gsk_ngl_glyph_library_finalize (GObject *object)
 {
@@ -98,8 +108,11 @@ static void
 gsk_ngl_glyph_library_class_init (GskNglGlyphLibraryClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GskNglTextureLibraryClass *library_class = GSK_NGL_TEXTURE_LIBRARY_CLASS (klass);
 
   object_class->finalize = gsk_ngl_glyph_library_finalize;
+
+  library_class->begin_frame = gsk_ngl_glyph_library_begin_frame;
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]