forked from Blendman974/faceclaw
Fix several bugs that could lead to reconnect-looping
Fix misinterpretation of EvenHub event type 5. Notification modals stacked, in a way that's O(n) in device resource memory; replace with a queue.
This commit is contained in:
1 parent
e5303e7b3e
commit
38da8e6168
15 files changed
+396
-52
No files matched your search
@@ -341,6 +341,37 @@ class DisplayListTest {
|
||||
c.setSurfaceDepth("glance", -16)
|
||||
assertEquals(-16, c.composite().shellScene.screenDepth)
|
||||
}
|
||||
/** #42: stacked modal-sized layers overflow the cache, so the frame bakes the bottom ones instead of throwing. */
|
||||
@Test fun shellOverTheResourceBudgetBakesBottomLayersAndRecovers() {
|
||||
val cache = ResourceCacheState(); val planner = ScenePlanner(cache)
|
||||
val gray = ByteArray(640 * 480) { 48 }; val app = BmpUtil.pack4bppFromGray8(gray, 640, 480)
|
||||
fun layer(key: Int, y: Int, h: Int, nibble: Int, depth: Int = 0) =
|
||||
ShellScene.Layer(key, 14, y, 612, h, 256, ByteArray(306 * h) { (nibble * 17).toByte() }, depth = depth)
|
||||
// Each 612x214 layer is just under the 64 KiB resource cap; three exceed the arena on their own.
|
||||
fun chrome(depth: Int) = layer(1, 444, 36, 7, depth)
|
||||
val modals = listOf(layer(2, 10, 214, 9), layer(3, 120, 214, 11), layer(4, 230, 214, 13, depth = 4))
|
||||
val overflow = ShellScene(listOf(chrome(6)) + modals)
|
||||
val plan = planner.plan(app, 640, 480, null, overflow, 1)
|
||||
assertEquals(2, plan.bakedLayers); assertFalse(plan.bakedSelections)
|
||||
assertTrue(plan.commands.all { it.size <= 65535 })
|
||||
assertTrue(cache.usedBytes() <= ResourceCacheState.CACHE_SIZE)
|
||||
// Baked layers lose their stereo depth; the live ones keep it.
|
||||
val expected = ShellScene(listOf(chrome(0)) + modals)
|
||||
val lenses = listOf(Glasses(), Glasses(true))
|
||||
for (glasses in lenses) {
|
||||
glasses.apply(plan.commands)
|
||||
assertContentEquals(BmpUtil.pack4bppFromGray8(expected.preview(gray, 640, 480, glasses.right), 640, 480), glasses.composition)
|
||||
}
|
||||
// Once the shell fits again, the next frame is fully live and the screen is the app's again.
|
||||
val fits = ShellScene(listOf(chrome(0), modals[2]))
|
||||
val next = planner.plan(app, 640, 480, null, fits, plan.nextFid)
|
||||
assertEquals(0, next.bakedLayers)
|
||||
for (glasses in lenses) {
|
||||
glasses.apply(next.commands)
|
||||
assertContentEquals(app, glasses.screen)
|
||||
assertContentEquals(BmpUtil.pack4bppFromGray8(fits.preview(gray, 640, 480, glasses.right), 640, 480), glasses.composition)
|
||||
}
|
||||
}
|
||||
@Test fun noisyFramesRemainBoundedAndResourceBudgetIs192KiB() {
|
||||
val cache=ResourceCacheState();val planner=ScenePlanner(cache);val glasses=Glasses()
|
||||
val app=ByteArray(640*480/2){(it*37).toByte()}
|
||||
|
||||
Reference in new issue
Block a user