Model the DC windows and VIC compose, and scan out what they describe

The display model took each window's line stride from PRESCALED_SIZE
rather than LINE_STRIDE, and kept one set of window parameters for all
four windows, so window D's 656-pixel log window leaked into window A.
Its block-linear decoder also had two GOB address bits swapped. The mock
VIC only memcpy'd, so Nyx's rotated frame never existed. The renderer
papered over all of this with per-address heuristics: a "known menu
stride" of 2624, forced block-linear decoding of the IPL carveout, and a
hard-coded 1280x720 geometry for Nyx's framebuffer.

- DC: a register file per window (A-D), reached through the indirect
  pages per DISPLAY_WINDOW_HEADER or the A/B/C direct ranges. Writes
  land in the assembly copy, and WIN_x_ACT_REQ promotes it to the active
  copy the scan-out reads. Other DC registers read back what was
  written. STATE_CONTROL reads 0, and INT_STATUS reports frame end and
  vblank, which bdk polls before DSI commands.
- VIC: on COMPOSE_START, read bdk's vic_config_t from guest memory and
  draw the enabled pitch slots into the target, with scaling, clipping
  and the output flip/transpose. Nyx's 270-degree rotation now happens.
- Scan-out: fetch each enabled window per SURFACE_KIND (pitch, tiled or
  block linear, per TRM 20.1.2 Figure 47), LINE_STRIDE and COLOR_DEPTH,
  turn it per WIN_OPTIONS (H/V direction, SCAN_COLUMN), scale it from
  PRESCALED_SIZE to SIZE, place it at POSITION, and stack and blend the
  windows by depth and BLEND_*. When the surface on show was turned on
  its way to the panel, by the DC or by VIC, the view undoes the turn,
  so Nyx still shows landscape. All the heuristics are gone.

hwtest's frame and Nyx's home screen are pixel-identical to before.
Nyx's error console (window D over window A) now shows; before, it was
invisible.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YYewwDPujjo5B2xRyC5Grb
This commit is contained in:
Claude committed 2026-09-25 18:40:26 +00:00
1 parent 39bfad6a0b
commit e32052ffd5
6 files changed
+795 -543

No files matched your search

-2
View File
@@ -204,7 +204,6 @@ static uc_engine *setup_emulation(EmuState *state, uint8_t *payload, size_t payl
// ---- Map Framebuffer pointer ----
state->fb_ptr = state->dram_low_ptr + (FB_BASE - DRAM_BASE);
fill_fb_background(state);
state->fb_addr = FB_BASE;
printf("[emu] Defined FB: 0x%08llX - 0x%08llX (%u MB)\n",
(unsigned long long)FB_BASE,
(unsigned long long)(FB_BASE + FB_SIZE),
@@ -532,7 +531,6 @@ int main(int argc, char *argv[]) {
uc_reg_write(uc, UC_ARM_REG_CPSR, &reset_cpsr);
uc_reg_write(uc, UC_ARM_REG_SP, &reset_sp);
uc_reg_write(uc, UC_ARM_REG_PC, &reset_pc);
state.fb_addr = FB_BASE; // re-point display at the FB base
state.emu_usec = 0;
state.insn_count = 0;
state.bpmp_slept_us = 0;