From 5737ed65d8b676a660572583f8cf433629e51a13 Mon Sep 17 00:00:00 2001 From: Cyd Date: Mon, 10 Aug 2026 21:54:00 -0500 Subject: [PATCH] plasma window: initialize the display area (junk shown until the callsigns) The desktop plasma marquee showed heap garbage from boot until the gauge renderer first drew the callsigns. Root cause [T0]: PixelMap8(w,h) allocates its pixel bytes UNCLEARED (GRAPH2D.cpp `new Byte[w*h]`, no memset) and Video8BitBuffered never clears them either -- only changedLine[] is zeroed. The real pod never showed it: the serial PlasmaDisplay transfers only CHANGED lines, so the garbage never left the buffer and the hardware marquee sat at its power-on blank. PlasmaWindow::Update however blits the WHOLE buffer every frame, exposing the junk for the window-up-to-first-draw gap (seconds on slower rigs). Fix: PlasmaWindow ctor memsets the pixelBuffer to index 0 (the near-black background) -- the window comes up blank like the hardware did. Glass-layer only; the serial pod path is untouched. Verified: glass boot shows a clean marquee from the first visible frame. Co-Authored-By: Claude Opus 4.8 --- engine/MUNGA_L4/L4PLASMAWIN.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/engine/MUNGA_L4/L4PLASMAWIN.cpp b/engine/MUNGA_L4/L4PLASMAWIN.cpp index 454019b..5bf05a4 100644 --- a/engine/MUNGA_L4/L4PLASMAWIN.cpp +++ b/engine/MUNGA_L4/L4PLASMAWIN.cpp @@ -54,6 +54,22 @@ PlasmaWindow::PlasmaWindow(): } blitBuffer = new unsigned long[plasmaWidth * plasmaHeight]; memset(blitBuffer, 0, plasmaWidth * plasmaHeight * sizeof(unsigned long)); + + // + // INITIALIZE THE DISPLAY AREA (2026-08-10). PixelMap8(w,h) allocates its + // pixel bytes UNCLEARED (GRAPH2D.cpp: `new Byte[w*h]`, no memset), so the + // 128x32 plasma buffer starts as heap garbage. The real pod never showed + // it: the serial PlasmaDisplay transfers only CHANGED lines (changedLine[] + // is zeroed by the base ctor), so the garbage never left the buffer and + // the hardware marquee sat at its power-on blank. This desktop window + // blits the WHOLE buffer every frame, so the junk was visible from boot + // until the gauge renderer first drew the callsigns. Clear to index 0 + // (the near-black background) -- the window comes up blank like the + // hardware did. + // + if (pixelBuffer != NULL && pixelBuffer->Data.MapPointer != NULL) + memset(pixelBuffer->Data.MapPointer, 0, plasmaWidth * plasmaHeight); + DEBUG_STREAM << "[plasmawin] desktop plasma display up (scale x" << scale << ")\n" << std::flush; }