From 81c72f77200b015191ec41d44c1d04ba39e0ba5a Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Sat, 11 Jul 2026 23:09:21 -0400 Subject: [PATCH] Remove msync() on /dev/fb0 mmap: blocks forever on PW3, freezing the device On a Kindle Paperwhite 7th gen (PW3, 2015, mxcfb driver), msync(fb, screensize, MS_SYNC) on the framebuffer mapping never returns. The render completes (save-pgm is written) but execution never reaches the eips refresh, so the screen stays unchanged while the input thread keeps an exclusive EVIOCGRAB on the touchscreen - the whole device appears frozen until a forced reboot. The calls are unnecessary: the mapping is MAP_SHARED on device memory, so stores land directly in framebuffer memory, and the display refresh is driven by eips/the EPDC rather than page-cache writeback. Verified on a PW3: with msync removed, rendering and the tap feedback flash work. Fixes #2 Co-Authored-By: Claude Fable 5 --- kindle/native/src/kindle_dashboard.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/kindle/native/src/kindle_dashboard.cpp b/kindle/native/src/kindle_dashboard.cpp index 308307d..02fd823 100644 --- a/kindle/native/src/kindle_dashboard.cpp +++ b/kindle/native/src/kindle_dashboard.cpp @@ -2307,11 +2307,9 @@ void flashTouchRectOnFramebuffer(Rect rect) { const int right = rect.x + rect.w > static_cast(vinfo.xres) ? static_cast(vinfo.xres) : rect.x + rect.w; const int bottom = rect.y + rect.h > static_cast(vinfo.yres) ? static_cast(vinfo.yres) : rect.y + rect.h; invertFramebufferArea(fb, &vinfo, &finfo, left, top, right, bottom, 0); - msync(fb, screensize, MS_SYNC); system("eips '' >/dev/null 2>&1 || true"); usleep(120000); invertFramebufferArea(fb, &vinfo, &finfo, left, top, right, bottom, 0); - msync(fb, screensize, MS_SYNC); munmap(fb, screensize); close(fd); system("eips '' >/dev/null 2>&1 || true"); @@ -2365,7 +2363,6 @@ int renderToFramebuffer(const Dashboard* dashboard, const char* status, const ch for (int x = 0; x < canvas.width; x++) putFramebufferPixel(fb, &vinfo, &finfo, x, y, canvas.pixels[y * canvas.width + x]); } free(canvas.pixels); - msync(fb, screensize, MS_SYNC); munmap(fb, screensize); close(fd); system("eips '' >/dev/null 2>&1 || true");