Expand the resource cache from 192kb to 320kb

This commit is contained in:
James Babcock committed 2026-11-18 12:29:29 -08:00
1 parent 2922f07c2f
commit d8a15c5251
7 files changed
+107 -62

No files matched your search

@@ -20,11 +20,18 @@ class CachedResource @JvmOverloads constructor(bytes: ByteArray, val owner: Stri
*/
class ResourceCacheState {
companion object {
/** Mirrors g2flash/patches/resource_cache.h. */
const val CACHE_SIZE = 196608
/**
* Mirrors g2flash/patches/resource_cache.h: the id table, then 320 KiB shared by the
* resources and their block headers. Firmware before Faceclaw/40 had 192 KiB in all,
* so this must not grow past what REQUIRED_FACECLAW_FIRMWARE_VERSION guarantees.
* RayNeo iO sessions use the same budget: that firmware's own copy of the header
* (faceclaw-rayneo-cfw patches/fc/resource_cache.h) needs at least this much before
* it reports the required revision.
*/
const val RESOURCE_COUNT = 512
const val TABLE_BYTES = RESOURCE_COUNT * 4
const val ARENA_BYTES = CACHE_SIZE - TABLE_BYTES
const val ARENA_BYTES = 320 * 1024
const val CACHE_SIZE = TABLE_BYTES + ARENA_BYTES
const val MAX_RESOURCE_SIZE = 65536
const val BLOCK_HEADER_BYTES = 16
@@ -507,7 +507,7 @@ class GlassesSessionCore(
// Preview/screenshot/recording callers render those explicitly on demand.
internal val compositor = SurfaceCompositor(false)
// Phone-side model of the CFW's 192 KiB resource cache.
// Phone-side model of the CFW's resource cache (ResourceCacheState.CACHE_SIZE).
// Reset whenever the image pipeline / EvenHub session is torn down: the
// firmware frees the cache with the fb lease, and after any resync the
// cheap safe assumption is an empty cache (glyphs re-upload lazily).