From 68deac2d8f4f55c8ca57d2cd3327df8b6f2e6eaa Mon Sep 17 00:00:00 2001 From: Evan Reichard Date: Tue, 21 Jul 2026 10:27:36 -0400 Subject: [PATCH] Reader renders correctly in WASM: grayscale persistence model Bumps third_party/qemu to the X3 grayscale persistence render. The in-browser reader now shows crisp black text on white (no inversion, no muddle). Marks the grayscale defect resolved in ISSUES. --- ISSUES.md | 6 +++--- third_party/qemu | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ISSUES.md b/ISSUES.md index 6f54240..5ea9189 100644 --- a/ISSUES.md +++ b/ISSUES.md @@ -14,11 +14,11 @@ Opening a book panicked **only in WASM** (`Invalid read ... reason: rejected` Worked around by forcing store-containing TBs to TCI (`wasm_tci_only_tb = true` in `tcg_out_qemu_st`). Reader now opens and paints in the browser. This is a workaround with a perf ceiling (store-containing TBs run interpreted); the precise miscompiled op is not yet localized. Full investigation and next steps: `docs/wasm-inflate-panic.md`. -## Reader inverts to muddled grayscale after the initial page +## Resolved: reader grayscale rendered inverted and muddled -With the panic worked around, the reader first paints a correct BW page (black text on white), then a follow-up refresh inverts it into muddled white-on-black text. This reproduces in the browser and is the current top reader defect. +The reader drew a crisp BW page, then a 4-level grayscale antialiasing pass (inverted plane polarity, near-empty planes) that the old model rendered as a full frame, wiping the page to an inverted muddle. The `xteink_x3_eink` model now keeps a persistent surface, detects grayscale vs BW by DTM2's set-fraction, and treats grayscale level 0 as no-drive (keep pixel) so only antialiased edges repaint over the retained BW page. Reader text renders sharp on native and wasm. -The reader uses the X3 community **4-level grayscale** path (DTM1=LSB, DTM2=MSB, grayscale LUT), whose plane polarity differs from the BW menu mode. The `xteink_x3_eink` model ignores LUT/grayscale commands and renders only DTM2 as `bit=white`, so the grayscale pass comes out inverted/garbled. Fixing this means tracking grayscale mode and rendering DTM1+DTM2 as 2-bit levels. Iterable on native (fast, no wasm rebuild). +Ceiling: the BW-vs-grayscale detector assumes the background is the white pixel majority, so a genuinely mostly-black BW frame would flip. Upgrade path: decode the loaded LUT directly. ## Cold boot requires a manual power-button hold diff --git a/third_party/qemu b/third_party/qemu index 1f76f73..ede6e5b 160000 --- a/third_party/qemu +++ b/third_party/qemu @@ -1 +1 @@ -Subproject commit 1f76f73feef6dc0ecd956ac19e25cde2f7b905ba +Subproject commit ede6e5b9f3b152364935f051771dbef96105a6a0