[gtk/glyphy2: 10/34] gsk/gl: make max-frame-age configurable




commit 57e0af8ab6bd0de5913fc46bbdddc4ec36f0a93e
Author: Christian Hergert <chergert redhat com>
Date:   Tue Mar 15 15:52:44 2022 -0700

    gsk/gl: make max-frame-age configurable
    
    This is nice for some texture libraries that we might want to keep around
    for longer than say 60 frames such as a glyph cache.

 gsk/gl/gskgltexturelibrary.c        | 5 +++--
 gsk/gl/gskgltexturelibraryprivate.h | 7 ++++---
 2 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/gsk/gl/gskgltexturelibrary.c b/gsk/gl/gskgltexturelibrary.c
index 3d32c95945..414190ea7d 100644
--- a/gsk/gl/gskgltexturelibrary.c
+++ b/gsk/gl/gskgltexturelibrary.c
@@ -27,7 +27,7 @@
 #include "gskgldriverprivate.h"
 #include "gskgltexturelibraryprivate.h"
 
-#define MAX_FRAME_AGE 60
+#define DEFAULT_MAX_FRAME_AGE 60
 
 G_DEFINE_ABSTRACT_TYPE (GskGLTextureLibrary, gsk_gl_texture_library, G_TYPE_OBJECT)
 
@@ -118,6 +118,7 @@ gsk_gl_texture_library_class_init (GskGLTextureLibraryClass *klass)
 static void
 gsk_gl_texture_library_init (GskGLTextureLibrary *self)
 {
+  self->max_frame_age = DEFAULT_MAX_FRAME_AGE;
 }
 
 void
@@ -176,7 +177,7 @@ gsk_gl_texture_library_begin_frame (GskGLTextureLibrary *self,
                              G_OBJECT_TYPE_NAME (self), dropped));
     }
 
-  if (frame_id % MAX_FRAME_AGE == 0)
+  if (frame_id % self->max_frame_age == 0)
     {
       GskGLTextureAtlasEntry *entry;
       int atlased = 0;
diff --git a/gsk/gl/gskgltexturelibraryprivate.h b/gsk/gl/gskgltexturelibraryprivate.h
index a784449889..bb1db12172 100644
--- a/gsk/gl/gskgltexturelibraryprivate.h
+++ b/gsk/gl/gskgltexturelibraryprivate.h
@@ -89,10 +89,11 @@ typedef struct _GskGLTextureAtlasEntry
 
 typedef struct _GskGLTextureLibrary
 {
-  GObject        parent_instance;
+  GObject      parent_instance;
   GskGLDriver *driver;
-  GHashTable    *hash_table;
-  guint          max_entry_size;
+  GHashTable  *hash_table;
+  guint        max_entry_size;
+  guint        max_frame_age;
 } GskGLTextureLibrary;
 
 typedef struct _GskGLTextureLibraryClass


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