diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2022-06-27 03:54:58 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2022-07-06 04:27:36 -0400 |
commit | 442bbb084a1316aa6b25b29e17889bc71c1e4235 (patch) | |
tree | 787bcd2134d6b58b43ba35a3a400fb6a876b7587 /src/xftint.h | |
parent | d4a554c9795b109085ec31eedacba6532c18d802 (diff) | |
download | xorg-lib-libXft-442bbb084a1316aa6b25b29e17889bc71c1e4235.tar.gz |
add "trackmemusage" property to use in improved _XftFontUncacheGlyph
The linear search used for randomly selecting a glyph to discard is
inefficient. This commit provides for a doubly-linked list which
could be maintained by the library to quickly discard the least
recently used glyph.
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
Diffstat (limited to 'src/xftint.h')
-rw-r--r-- | src/xftint.h | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/xftint.h b/src/xftint.h index f35823f..3687d6f 100644 --- a/src/xftint.h +++ b/src/xftint.h @@ -88,6 +88,16 @@ typedef struct _XftGlyph { } XftGlyph; /* + * If the "trackmemusage" option is set, glyphs are managed via a doubly-linked + * list. To save space, the links are just array indices. + */ +typedef struct _XftGlyphUsage { + XftGlyph contents; + FT_UInt newer; + FT_UInt older; +} XftGlyphUsage; + +/* * A hash table translates Unicode values into glyph indices */ typedef struct _XftUcsHash { @@ -181,6 +191,8 @@ typedef struct _XftFontInt { */ unsigned long glyph_memory; unsigned long max_glyph_memory; + unsigned sizeof_glyph; /* sizeof(XftGlyph) or XftGlyphUsage */ + FcBool track_mem_usage; /* Use XftGlyphUsage */ FcBool use_free_glyphs; /* Use XRenderFreeGlyphs */ } XftFontInt; @@ -250,6 +262,7 @@ typedef struct _XftDisplayInfo { XRenderPictFormat *solidFormat; unsigned long glyph_memory; unsigned long max_glyph_memory; + FcBool track_mem_usage; FcBool use_free_glyphs; int num_unref_fonts; int max_unref_fonts; @@ -273,6 +286,9 @@ typedef struct _XftDisplayInfo { extern XftDisplayInfo *_XftDisplayInfo; +/* + * Bits in $XFT_DEBUG, which can be combined. + */ #define XFT_DBG_OPEN 1 #define XFT_DBG_OPENV 2 #define XFT_DBG_RENDER 4 @@ -284,11 +300,16 @@ extern XftDisplayInfo *_XftDisplayInfo; #define XFT_DBG_CACHEV 256 #define XFT_DBG_MEMORY 512 -#define XFT_MEM_DRAW 0 -#define XFT_MEM_FONT 1 -#define XFT_MEM_FILE 2 -#define XFT_MEM_GLYPH 3 -#define XFT_MEM_NUM 4 +/* + * Categories for memory allocation. + */ +typedef enum { + XFT_MEM_DRAW + , XFT_MEM_FONT + , XFT_MEM_FILE + , XFT_MEM_GLYPH + , XFT_MEM_NUM +} XFT_MEM_KIND; #define AllocTypedArray(n,type) malloc ((size_t)(n) * sizeof (type)) #define AllocUIntArray(n) AllocTypedArray(n, FT_UInt) |