Resource management for the texture cache

This commit is contained in:
James Babcock committed 2026-09-20 18:23:33 -07:00
1 parent 146fe66bdd
commit 0c3d7517bc
28 files changed
+569 -524

No files matched your search

+1 -1
View File
@@ -26,7 +26,7 @@ export type FirmwareInfo = {
};
/** The Faceclaw firmware revision this build of the app needs. */
export const REQUIRED_FACECLAW_FIRMWARE_VERSION = 22;
export const REQUIRED_FACECLAW_FIRMWARE_VERSION = 23;
const FACECLAW_PREFIX = "Faceclaw/";
const LEGACY_PREFIX = "EVENCFW";
+34 -34
View File
@@ -19,12 +19,12 @@ export type FirmwarePatchSet = {
export const CFW_PATCH_SET: FirmwarePatchSet = {
"base": "g2_2.3.0.24.bin",
"baseSha256": "187ccf2bcc5c17a212106e8a376745511e8289c4232b634a7ea94b9bf25a0979",
"outputSha256": "059ff37a5455b9b272b715ab62c2910ee4dc4966fbfb2e117159bda746bd7315",
"outputSha256": "393ea24203d9a388975c732cae4698339f8af0e13139b73d71386181a1bc004e",
"patches": [
{
"offset": 1045797,
"old": "38b584b0",
"new": "5af317bf",
"new": "59f3efbf",
"desc": "ring receiver entry: timestamped unfiltered reports under framebuffer lease"
},
{
@@ -36,49 +36,49 @@ export const CFW_PATCH_SET: FirmwarePatchSet = {
{
"offset": 1437923,
"old": "fef788ff",
"new": "fbf226fc",
"new": "faf2fefc",
"desc": "cfw_ancs_event"
},
{
"offset": 1437951,
"old": "fef7e8fb",
"new": "fbf260f9",
"new": "faf238fa",
"desc": "cfw_ancs_open"
},
{
"offset": 1437969,
"old": "fef7e7fb",
"new": "fbf277f9",
"new": "faf24ffa",
"desc": "cfw_ancs_close"
},
{
"offset": 1388387,
"old": "39694d00",
"new": "35407d00",
"new": "e5317d00",
"desc": "connection-bound ANCS EUS write callback"
},
{
"offset": 971497,
"old": "fff717f8",
"new": "6df347f8",
"new": "6cf31ff9",
"desc": "bl faceclaw_input_bridge_received (ring relay and ordered private transport before worker pool)"
},
{
"offset": 971845,
"old": "fef769ff",
"new": "6cf399ff",
"new": "6cf371f8",
"desc": "bl faceclaw_input_bridge_received (ring relay and ordered private transport before worker pool)"
},
{
"offset": 979579,
"old": "fdf74ef8",
"new": "6bf37ef8",
"new": "6af356f9",
"desc": "bl faceclaw_input_bridge_received (ring relay and ordered private transport before worker pool)"
},
{
"offset": 1428895,
"old": "f8f76cfd",
"new": "faf224f9",
"new": "f9f28afd",
"desc": "bl cfw_receive_packet (private SID-f0 probe before TPL reassembly)"
},
{
@@ -108,145 +108,145 @@ export const CFW_PATCH_SET: FirmwarePatchSet = {
{
"offset": 1248487,
"old": "d4f712fb",
"new": "28f378f9",
"new": "27f354fb",
"desc": "bl settings_send_wrapper (append caps field 100)"
},
{
"offset": 1246183,
"old": "f5f7e2f8",
"new": "28f310fb",
"new": "27f374fd",
"desc": "bl settings_decode_wrapper (Faceclaw lease field 101)"
},
{
"offset": 975219,
"old": "02f083fc",
"new": "6af372fb",
"new": "69f3d6fd",
"desc": "bl faceclaw_display_start @ 0x467d68 (fail-open wake takeover)"
},
{
"offset": 975411,
"old": "02f023fc",
"new": "6af3e0fb",
"new": "69f344fe",
"desc": "bl faceclaw_display_start_headup @ 0x467e28 (fail-open wake takeover)"
},
{
"offset": 975103,
"old": "07f085fb",
"new": "6cf350f8",
"new": "6bf328f9",
"desc": "bl headup_gate (head-up sensor event -> EvenHub sys event 12 under lease)"
},
{
"offset": 830549,
"old": "19f03efb",
"new": "8ff3fff9",
"new": "8ef3d7fa",
"desc": "bl gesture_ring_press_mode (observe ring touch-down, preserve stock dispatch)"
},
{
"offset": 830795,
"old": "1ff071ff",
"new": "8ff3b8f9",
"new": "8ef390fa",
"desc": "bl gesture_press (owned event 9 before stock menu gate)"
},
{
"offset": 830887,
"old": "1ff043ff",
"new": "8ff3b2f9",
"new": "8ef38afa",
"desc": "bl gesture_short_long (Faceclaw lease gates event 11 vs stock Menu path)"
},
{
"offset": 831763,
"old": "1ff08dfd",
"new": "8ef3e8ff",
"new": "8ef3c0f8",
"desc": "bl gesture_release (owned event 10 before stock menu gate)"
},
{
"offset": 1570209,
"old": "7fb50600",
"new": "d9f209bd",
"new": "d8f2e5be",
"desc": "even_ai_display_ctrl entry -> conditional Faceclaw lease trampoline"
},
{
"offset": 1051545,
"old": "f6f787f9",
"new": "53f3d7fe",
"new": "53f3cbfc",
"desc": "bl display_copy_hook @ 0x47a78e (640x480 direct framebuffer)"
},
{
"offset": 1051861,
"old": "f6f7e9f8",
"new": "53f339fe",
"new": "53f32dfc",
"desc": "bl display_copy_hook @ 0x47a8ca (640x480 direct framebuffer)"
},
{
"offset": 1262237,
"old": "d9f7d0fd",
"new": "24f3cff9",
"new": "23f3b3fc",
"desc": "bl faceclaw_send_wear_event @ 0x4ade92 (outside onboarding)"
},
{
"offset": 1262337,
"old": "d9f79efd",
"new": "24f39df9",
"new": "23f381fc",
"desc": "bl faceclaw_send_wear_event @ 0x4adef6 (outside onboarding)"
},
{
"offset": 1309405,
"old": "67f02dff",
"new": "18f3b7fa",
"new": "17f39bfd",
"desc": "bl compass_decode_capture (sample-matched GAF diagnostics)"
},
{
"offset": 1307865,
"old": "fff7c9fb",
"new": "18f335fe",
"new": "18f319f9",
"desc": "bl compass_report_event (stock UI + heading with diagnostics over BLE)"
},
{
"offset": 1300937,
"old": "00210170",
"new": "1af31bfb",
"new": "19f3fffd",
"desc": "bl compass_preserve_accuracy (retain magnetic calibration under Faceclaw framebuffer lease)"
},
{
"offset": 4537963,
"old": "",
"new": "b0b581ea00039b0701d0034637e0c2b110f0030315d000f1010ca2f1010e0023cc5c9e45c45403f1010404d0634413f003032346f4d121440319121b102a14d302e00346102a10d3d1f800c0d1f804e0cc688d68103adc609d60c3f804e043f810cb0f2a01f11001eed8042a07d300bf51f8045b043a032a43f8045bf8d8002a08bfb0bd0139013b11f8015f013a03f8015ff9d1b0bd00bf884218bf002a00d1704710b50b1a38bf431a934207d288420ad281ea00039b0726d0034669e0fff79fffbde81040704781ea000300eb020c9b0701eb020e42d15fea8c732bd0a0f1010c00bf8b1813f801ec8418531e04f801ec04d0624412f003021a46f2d101eb030e00eb030c17e0830736d0a2f1010c00f1010e002300bfcc5c9c45c45403f1010404d0734413f003032346f4d1121b2144031922e01346042b0ed3aef10402acf1040152f80449043b032b41f80449f8d802f1040e01f1040c1a4653b1aef10101acf1010300bf11f80149013a03f80149f9d1bde8104070470346042a06d351f8044b043a032a43f8044bf8d8002af0d00139013b00bf11f8014f013a03f8014ff9d1e6e700bf2de9f04fa5b04ef66c6b4ff29c5416460d46ccf2ff0bc2f229044ff6ff7900274ff00108019006e048f2a351c0f24501bff32f8f8847d4f800a0bff35f8f20680321cff680710140b1f1005fbff35f8f03d10168594500f0c3804ff4407005f073f9002800f0b7824ff60051cff6ff714218403182f8007382f8017382f8027382f8037382f8047382f8057382f8067382f8077382f8087382f8097382f80a7382f80b7382f80c7382f80d7382f80e7382f80f7382f8107382f8117382f8127382f8137382f8147382f8157382f8167382f8177382f8187382f8197382f81a7382f81b7382f81c7382f81d7382f81e7382f81f7382f8207382f8217382f8227382f8237382f8247382f8257382f8267382f8277382f8287382f8297382f82a7382f82b7382f82c7382f82d7382f82e7382f82f7382f8307382f8317382f8327382f8337382f8347382f8357382f8367382f8377382f8387382f8397382f83a7382f83b7382f83c7382f83d7382f83e7382f83f737ff47cafc0f800b080f80a80a0f81c90a0f81e90a0f82090a0f82290a0f82490a0f82690a0f82890a0f82a90a0f82c90a0f82e90a0f83090a0f83290a0f83490a0f83690a0f83890a0f83a9054e8001f51457ff42fafbff35f8f00bf44e8000121b154e8001f5145f8d023e7aa4645ea064100260127c0f8701206e048f2a351c0f24501bff32f8f88472568bff35f8f20680321cff680710140b1f1005fbff35f8f03d10168594500f0c2804ff4407005f090f8002800f0d4814ff60051cff6ff7100bf4218403182f8006382f8016382f8026382f8036382f8046382f8056382f8066382f8076382f8086382f8096382f80a6382f80b6382f80c6382f80d6382f80e6382f80f6382f8106382f8116382f8126382f8136382f8146382f8156382f8166382f8176382f8186382f8196382f81a6382f81b6382f81c6382f81d6382f81e6382f81f6382f8206382f8216382f8226382f8236382f8246382f8256382f8266382f8276382f8286382f8296382f82a6382f82b6382f82c6382f82d6382f82e6382f82f6382f8306382f8316382f8326382f8336382f8346382f8356382f8366382f8376382f8386382f8396382f83a6382f83b6382f83c6382f83d6382f83e6382f83f637ff47cafc0f800b08772a0f81c90a0f81e90a0f82090a0f82290a0f82490a0f82690a0f82890a0f82a90a0f82c90a0f82e90a0f83090a0f83290a0f83490a0f83690a0f83890a0f83a9054e8001fa9427ff430afbff35f8f44e8000121b154e8001fa942f8d025e7d0f8746242f6f767c0f24407002ebff35f8f00f0f38007f19a0230464ff0ff314ff0ff379047002840f0498147f6df40c0f24f00804700274ff001080397adf8107006e048f2a351c0f24501bff32f8f88472568bff35f8f20680321cff680710140b1f1005fbff35f8f03d10168594500f0e9804ff4407004f094ff002800f0e1804ff60051cff6ff7100bf4218403182f8007382f8017382f8027382f8037382f8047382f8057382f8067382f8077382f8087382f8097382f80a7382f80b7382f80c7382f80d7382f80e7382f80f7382f8107382f8117382f8127382f8137382f8147382f8157382f8167382f8177382f8187382f8197382f81a7382f81b7382f81c7382f81d7382f81e7382f81f7382f8207382f8217382f8227382f8237382f8247382f8257382f8267382f8277382f8287382f8297382f82a7382f82b7382f82c7382f82d7382f82e7382f82f7382f8307382f8317382f8327382f8337382f8347382f8357382f8367382f8377382f8387382f8397382f83a7382f83b7382f83c7382f83d7382f83e7382f83f737ff47cafc0f800b080f80a80a0f81c90a0f81e90a0f82090a0f82290a0f82490a0f82690a0f82890a0f82a90a0f82c90a0f82e90a0f83090a0f83290a0f83490a0f83690a0f83890a0f83a9054e8001fa9427ff42fafbff35f8f00bf44e8000149b354e8001fa942f8d023e705460020b847b0b105f51d7151e8006f4eb9bff35f8f00bf41e8000292b151e8006f002ef8d00021bff32f8fbff35f8f21b10646f1e64ff0ff3742e007f5a9718847eae60121f1e70020019d42f6f764002d4ff0010bc0f2440418bfbaf1000f33d10df108098046484602f061fa03ab28465146012206f093fa9df8111007464846002918bf4ff0ff3702f08dfbbbf1000f044608d19df8100028b94af21f30c0f247004c308047b8f1000f18bfc8f80c4042f6f764c0f2440404f5807130468847384625b0bde8f08f2a7802f07f01a1f1150313f1030f0bd802f07b030b2b07d002f07e02082a03d0032901d00629b7d140b14af21f31c0f247010746884797f8641111b14ff0ff37d6e738464ff0000ba6e72de9f04f81b04ef66c6b4ff29c554ff6005848f2a35accf2ff0bc2f229054ff6ff76cff6ff7800274ff00109c0f2450a03e000bfbff32f8fd0472c68bff35f8f2868bff35f8f01466ff39601b1f1005f03d10168594500f0b2804ff4407004f019fe002800f0aa80414600bf4218403182f8007382f8017382f8027382f8037382f8047382f8057382f8067382f8077382f8087382f8097382f80a7382f80b7382f80c7382f80d7382f80e7382f80f7382f8107382f8117382f8127382f8137382f8147382f8157382f8167382f8177382f8187382f8197382f81a7382f81b7382f81c7382f81d7382f81e7382f81f7382f8207382f8217382f8227382f8237382f8247382f8257382f8267382f8277382f8287382f8297382f82a7382f82b7382f82c7382f82d7382f82e7382f82f7382f8307382f8317382f8327382f8337382f8347382f8357382f8367382f8377382f8387382f8397382f83a7382f83b738Line truncated
"new": "b0b581ea00039b0701d0034637e0c2b110f0030315d000f1010ca2f1010e0023cc5c9e45c45403f1010404d0634413f003032346f4d121440319121b102a14d302e00346102a10d3d1f800c0d1f804e0cc688d68103adc609d60c3f804e043f810cb0f2a01f11001eed8042a07d300bf51f8045b043a032a43f8045bf8d8002a08bfb0bd0139013b11f8015f013a03f8015ff9d1b0bd00bf884218bf002a00d1704710b50b1a38bf431a934207d288420ad281ea00039b0726d0034669e0fff79fffbde81040704781ea000300eb020c9b0701eb020e42d15fea8c732bd0a0f1010c00bf8b1813f801ec8418531e04f801ec04d0624412f003021a46f2d101eb030e00eb030c17e0830736d0a2f1010c00f1010e002300bfcc5c9c45c45403f1010404d0734413f003032346f4d1121b2144031922e01346042b0ed3aef10402acf1040152f80449043b032b41f80449f8d802f1040e01f1040c1a4653b1aef10101acf1010300bf11f80149013a03f80149f9d1bde8104070470346042a06d351f8044b043a032a43f8044bf8d8002af0d00139013b00bf11f8014f013a03f8014ff9d1e6e700bf2de9f04fa5b04ef66c6a4ff29c5516460c46ccf2ff0ac2f229054ff6ff7800274ff00109019006e048f2a351c0f24501bff32f8f8847d5f800b0bff35f8f28680321cff680710140b1f1005fbff35f8f02d10168514543d04ff4417004f050fb002800f036810021421847540431b1f5417f57709770d770f6d1c0f800a080f80a90a0f81c80a0f81e80a0f82080a0f82280a0f82480a0f82680a0f82880a0f82a80a0f82c80a0f82e80a0f83080a0f83280a0f83480a0f83680a0f83880a0f83a8055e8001f5945aed1bff35f8f00bf45e8000121b155e8001f5945f8d0a3e7a34644ea064100260127c0f8701206e048f2a351c0f24501bff32f8f88472c68bff35f8f28680321cff680710140b1f1005fbff35f8f02d10168514542d04ff4417004f0edfa002800f0d380002100bf421846540431b1f5417f56709670d670f6d1c0f800a08772a0f81c80a0f81e80a0f82080a0f82280a0f82480a0f82680a0f82880a0f82a80a0f82c80a0f82e80a0f83080a0f83280a0f83480a0f83680a0f83880a0f83a8055e8001fa142afd1bff35f8f45e8000121b155e8001fa142f8d0a5e7d0f8746242f6f767c0f24407002ebff35f8f71d007f19a0230464ff0ff314ff0ff379047002840f0c28047f6df40c0f24f00804700274ff001090397adf8107007e000bf48f2a351c0f24501bff32f8f88472c68bff35f8f28680321cff680710140b1f1005fbff35f8f02d10168514567d04ff4417004f071fa002860d00021421847540431b1f5417f57709770d770f6d1c0f800a080f80a90a0f81c80a0f81e80a0f82080a0f82280a0f82480a0f82680a0f82880a0f82a80a0f82c80a0f82e80a0f83080a0f83280a0f83480a0f83680a0f83880a0f83a8055e8001fa142b0d1bff35f8f00bf45e8000149b355e8001fa142f8d0a5e704460020b847b0b104f51d7151e8006f4eb9bff35f8f00bf41e8000292b151e8006f002ef8d00021bff32f8fbff35f8f21b1064672e74ff0ff373ce007f5a97188476be70121f1e70020019f42f6f769002f4ff00104c0f2440918bfbbf1000f2dd102ad8046284602f054f903ab38465946012205f0eefc9df8111007462846002918bf4ff0ff3702f0f6f9002c044608d19df8100028b94af21f30c0f247004c308047b8f1000f18bfc8f80c4009f5807130468847384625b0bde8f08f3a7802f07f01a1f1150313f1030f0bd802f07b030b2b07d002f07e02082a03d0032901d00629bdd140b14af21f31c0f247010446884794f8641111b14ff0ff37d6e720460024ade700bf2de9f0474ef66c6a4ff29c5548f2a359ccf2ff0ac2f229054ff6ff7600274ff00108c0f2450902e0bff32f8fc8472c68bff35f8f2868bff35f8f01466ff39601b1f1005f02d10168514535d04ff4417004f084f978b30021421847540431b1f5417f57709770d770f6d1c0f800a080f80a808683c683068446848684c684068546858685c685068646868686c6860687468755e8001fa142c6d1bff35f8f00bf45e80001002908bfbde8f08755e8001fa142f5d0b8e70020bde8f08770b500284dd001684ef66c62ccf2ff02914218bf70bd90f8441090f845504bf6394c8d42c0f2510c2ad205eb8501014491f8492091f84a4091f846e091f8473091f8481042ea0424012c4ff0010298bf14466e1c054680f84560b9b164294eea032028bf6421012888bf024644f62060824228bf02460cf5e2731046984706e0002180f84410bde870406047e047286c38b142f64d42c0f244022146bde87040104770bd02464ff64b70cff6ff7042f6653c7844c0f2440c00210023604700bf2de9f04f9db04ff29c50c2f22900d0f800b0bff35f8f58466ff39600b0f1005f3fd1dbf800004ef66c65ccf2ff05a84237d19bf8640110b3dbf86041fcb140f24030c2f20000d0f8787502a802f020f8002f00f0f18040f20308384621464ff41632cff680784ff6ff760197fff764fc48f2a35900240127c0f245091ce09bf8660170b1dbf8680140b147f64c61c2f207010968401a002801f3cc8700208bf8660140f6a120c0f247001db0bde8f04f0047bff32f8fc8474ff29c50c2f22900d0f800a0bff35f8f0068bff35f8f00ea0801b1f1005f02d10168a94236d04ff4417004f07df8002801f08c87002100bf421844540431b1f5417f54709470d470f6d14ff29c52056087728683c683068446848684c684068546858685c685068646868686c68606874687c2f2290252e8001f5145bdd1bff35f8f00bf42e8000121b152e8001f5145f8d0b2e7817a002941f05887027e0021002a8df814107cd04ff29c5605aac2f22906535c002b00f0b68053185f78002f74d09f78002f73d0df78002f72d01f79002f71d05f79002f70d09f79002f6fd0df79002f6ed01f7a002f6dd05f7a002f6cd09f7a002f6bd0df7a002f6ad01f7b002f69d05f7b002f68d09f7b002f67d0df7b002f66d01f7c002f65d05f7c002f64d09f7c002f63d0df7c002f62d01f7d002f61d05f7d002f60d09f7d002f5fd0df7d002f5ed01f7e002f5dd05f7e002f5cd09f7e002f5bd0df7e002f5ad01f7f002f59d05f7f002f58d09f7f002f57d0db7f002b56d0203160297ff49aaf76e000208bf86401cbf860018bf8660101208bf8650140f6a120c0f24700804701f0e8be4ff29c56c2f2290664e001313ae0023138e0033136e0043134e0053132e0063130e007312ee008312ce009312ae00a3128e00b3126e00c3124e00d3122e00e3120e00f311ee010311ce011311ae0123118e0133116e0143114e0153112e0163110e017310ee018310ce019310ae01a3108e01b3106e01c3104e01d3102e01e3100e01f315f2921d84ff0520353541dd00a4445235e29537018d04Line truncated
"desc": "append injected blobs to main-app payload"
},
{
"offset": 779123,
"old": "805a3900",
"new": "f0173a00",
"new": "f00a3a00",
"desc": "main-app subheader payload size (ps)"
},
{
"offset": 152,
"old": "005b3900",
"new": "70183a00",
"new": "700b3a00",
"desc": "main-app TOC entry size (ps + 128)"
},
{
"offset": 779243,
"old": "805a3904",
"new": "f0173a04",
"new": "f00a3a04",
"desc": "main-app preamble length (low 24 bits)"
},
{
"offset": 779247,
"old": "effdbcea",
"new": "ed6be905",
"new": "09a9afac",
"desc": "[5] ota/s200_firmware_ota.bin preamble crc32"
},
{
"offset": 156,
"old": "c0c6322a",
"new": "18540264",
"new": "19292813",
"desc": "[5] ota/s200_firmware_ota.bin component crc32c (TOC)"
},
{
"offset": 779127,
"old": "c0c6322a",
"new": "18540264",
"new": "19292813",
"desc": "[5] ota/s200_firmware_ota.bin component crc32c (subheader)"
}
]
+9 -5
View File
@@ -496,6 +496,7 @@ export class GlassesSession {
this.timer = setTimeout(() => { this.timer = null; void this.pump() }, delay)
}
private canSendDisplay(): boolean {
if (this.displaySending?.commands[this.displaySending.offset][0] === 22 && this.cfwPending.length) return false
// Also bound completed frames retained behind a missing/out-of-order ACK.
return this.displayInFlight < DISPLAY_WINDOW_SIZE && !!(this.displaySending ||
(this.latest && !this.charging && this.displayFrames.length < DISPLAY_WINDOW_SIZE))
@@ -511,11 +512,11 @@ export class GlassesSession {
const texturePlan = textureFrame ? this.textures?.plan(this.lastEnqueued, packed, textureFrame, this.nextImageFrameId) : null
let commands: Uint8Array[]
if (texturePlan) {
// Uploads participate in the same ordered, acknowledged command window as
// Resource commands participate in the same ordered, acknowledged command window as
// the image. Coalescing only happens before planning mutates residency.
commands = [...texturePlan.uploads, texturePlan.payload]
commands = [...texturePlan.resourceCommands, texturePlan.payload]
this.nextImageFrameId = texturePlan.nextFid
this.log(`Display textures (${texturePlan.uploads.length} uploads, cache=${texturePlan.usedBytes}B)`)
this.log(`Display textures (${texturePlan.resourceCommands.length} resource commands, cache=${texturePlan.usedBytes}B)`)
} else {
const delta = buildBoundingBoxPayload(this.lastEnqueued, packed, 640, 480, this.nextImageFrameId)
const payload = delta ?? protocol.concat(new Uint8Array([6]), protocol.rle4(packed))
@@ -528,7 +529,10 @@ export class GlassesSession {
this.displaySending = { packed, commands, offset: 0, pending: 0 }
this.displayFrames.push(this.displaySending); this.lastEnqueued = packed
}
const frame = this.displaySending, payload = frame.commands[frame.offset++]
const frame = this.displaySending
// Drain earlier commands before evicting: recovery may replay any unresolved draw/upload.
if (frame.commands[frame.offset][0] === 22 && this.cfwPending.length) return
const payload = frame.commands[frame.offset++]
frame.pending++; this.displayInFlight++
if (frame.offset >= frame.commands.length) this.displaySending = null
// Writes serialize on L while up to three complete commands await their
@@ -554,7 +558,7 @@ export class GlassesSession {
this.pumping = true; const generation = this.generation
try {
const now = Date.now()
// Firmware frees textures when its 90-second framebuffer lease expires.
// Firmware frees resources when its 90-second framebuffer lease expires.
// After a long iOS suspension, reconnect rather than replaying pending
// draws against unknown memory. Leave a margin for the two arm writes.
if (now - this.lastLease >= 80_000) throw new Error('Display lease lapsed; restarting session')
+1 -1
View File
@@ -1,6 +1,6 @@
/** Platform-owned snapshot of the same composite as the submitted pixels. */
export type TextureFrame = { readonly native: object }
export type TexturePlan = { uploads: Uint8Array[]; payload: Uint8Array; nextFid: number; usedBytes: number }
export type TexturePlan = { resourceCommands: Uint8Array[]; payload: Uint8Array; nextFid: number; usedBytes: number }
/** Sessions own residency; frame snapshots may be coalesced without changing it. */
export interface SessionTexturePlanner {
plan(previous: Uint8Array | null, next: Uint8Array, frame: TextureFrame, firstId: number): TexturePlan | null
+3 -3
View File
@@ -40,10 +40,10 @@ export function runKotlinProtocolSmokeTest(): void {
textured.submitSurfaceFrame('icon', white, { x: 0, y: 0, width: 2, height: 2 }, draw.buffer)
const snapshot = textured.compositeFrame(), packed = protocol.packGray4(snapshot.pixels, 4, 2)
const cold = textures.plan(null, packed, snapshot.textures, 1)
assert(!!cold && cold.uploads[0]?.[0] === 18 && cold.payload[0] === 8, 'texture upload and draw')
assert(textures.plan(null, packed, snapshot.textures, 1)?.uploads.length === 0, 'texture reuse')
assert(!!cold && cold.resourceCommands.some(command => command[0] === 21) && cold.payload[0] === 8, 'texture upload and draw')
assert(textures.plan(null, packed, snapshot.textures, 1)?.resourceCommands.length === 0, 'texture reuse')
textures.reset()
assert((textures.plan(null, packed, snapshot.textures, 1)?.uploads.length ?? 0) > 0, 'texture reset')
assert((textures.plan(null, packed, snapshot.textures, 1)?.resourceCommands.length ?? 0) > 0, 'texture reset')
const changed = new Uint8Array(16); changed[0] = 255
assert(buildBoundingBoxPayload(new Uint8Array(16), changed, 8, 4, 1)?.[0] === 3, 'image update')
assert(lvglMetrics('/nonexistent/faceclaw-font').length === 0, 'font bridge')
+1 -1
View File
@@ -7,7 +7,7 @@ export class IosTexturePlanner implements SessionTexturePlanner {
reset(): void { this.native.reset() }
plan(previous: Uint8Array | null, next: Uint8Array, frame: TextureFrame, firstId: number): TexturePlan | null {
const result = this.native.planPreviousNextFrameFirstId(previous ? toData(previous) : null, toData(next), frame.native, firstId)
return result ? { payload: fromData(result.payload), uploads: nativeArray(result.uploads, fromData),
return result ? { payload: fromData(result.payload), resourceCommands: nativeArray(result.resourceCommands, fromData),
nextFid: result.nextFid, usedBytes: result.usedBytes } : null
}
}