Skip to content

Commit 3952ab3

Browse files
committed
Add configurable pixmap caching with LRU eviction
This commit implements transparent pixmap caching to improve performance by reusing frequently allocated pixmaps with identical format and dimensions. Cache features: - Automatic operation in twin_pixmap_create/destroy - LRU eviction policy respecting reference counts to prevent use-after-free - Hash-based lookup with collision handling via eviction Configuration options (added to Features menu): - CONFIG_PIXMAP_CACHE: Enable/disable caching (default: y) - CONFIG_PIXMAP_CACHE_SIZE: Entry count 4-32 (default: 8) - CONFIG_PIXMAP_CACHE_MAX_KB: Memory limit 16-512KB (default: 64KB)
1 parent c8834d1 commit 3952ab3

File tree

2 files changed

+387
-1
lines changed

2 files changed

+387
-1
lines changed

configs/Kconfig

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,32 @@ config SHADOW_BLUR
7777
range 1 10
7878
depends on DROP_SHADOW
7979

80+
config PIXMAP_CACHE
81+
bool "Enable pixmap caching"
82+
default y
83+
help
84+
Enable caching of pixmaps to improve performance by reusing
85+
frequently allocated pixmaps. This reduces memory allocation
86+
overhead at the cost of slightly increased memory usage.
87+
88+
config PIXMAP_CACHE_SIZE
89+
int "Maximum number of cached pixmaps"
90+
default 8
91+
range 4 32
92+
depends on PIXMAP_CACHE
93+
help
94+
Maximum number of pixmaps that can be stored in the cache.
95+
Larger values may improve performance but use more memory.
96+
97+
config PIXMAP_CACHE_MAX_KB
98+
int "Maximum cache size in KB"
99+
default 64
100+
range 16 512
101+
depends on PIXMAP_CACHE
102+
help
103+
Maximum total memory size for cached pixmaps in kilobytes.
104+
The cache will evict entries to stay within this limit.
105+
80106
endmenu
81107

82108
menu "Image Loaders"

0 commit comments

Comments
 (0)