Skip to content

video: show early hi-res DDF content inside an early display window#195

Merged
LinuxJedi merged 1 commit into
mainfrom
fix/hires-overscan-picture-origin
Jul 15, 2026
Merged

video: show early hi-res DDF content inside an early display window#195
LinuxJedi merged 1 commit into
mainfrom
fix/hires-overscan-picture-origin

Conversation

@LinuxJedi

Copy link
Copy Markdown
Owner

Fixes #186 (ECS Denise PAL/NTSC horizontal offset: bitplanes shifted left relative to sprites on overscan screens).

Root cause

The early hi-res DDFSTRT pre-fetch snap (af42e2d) unconditionally skipped the whole early-fetch width at the picture origin, assuming the display window always opens at the standard $81 edge. KS 3.2 programs ECS extreme-overscan screens with both an early fetch and an early window (Overscan editor edit display: DDFSTRT=$28, DIWSTRT h=$5D, DIWSTOP h=$1C7 via DIWHIGH, BPLCON1=$44). On real hardware those early-fetched words are inside the window; the snap discarded 80 native px instead of the physical 18, shifting the whole bitmap left with a blank colour-0 band at the right window edge while sprites stayed beam-anchored - exactly the reported symptom, on PAL and NTSC alike.

Fix

Remove the snap. The physical origin term (display shift minus DDF shift plus the framebuffer-origin clamp) already clips exactly the part of the fetch that lands left of the window: XSysInfo's DDFSTRT=$38 panel still skips its one pre-fetch word. The snap only ever differed from that term for windows left of the fetch reference - it was compensating for the old $83 hi-res fetch reference and became a no-op for standard windows when the reference was recalibrated to $81 (PR #106/#107 era).

Verification

  • Full unit suite green (1434 tests); early_ddf_hires_origin_clips_prefetch_against_the_window_edge keeps the original XSysInfo/standard/KS-boot assertions unchanged (16/0/24) and gains an ECS 8375 overscan case asserting origin 18.
  • All 20 golden render probes pass unchanged (no drift in the calibrated DDF placement web); clippy and fmt clean.
  • End-to-end on the KS 3.2 Overscan editor's max-overscan edit screen (A3000 profile, ECS): picture now fills the window symmetrically on PAL and NTSC, matching the A4000/AGA rendering of the same screen; clicking Cancel at its drawn position closes the screen, so the bitmap and Intuition's hit-testing coincide again.
  • ECS standard (non-overscan) Workbench screen and the AGA edit screen are byte-identical before/after the change; only the broken case moves.

docs/internals/video.md records the rule: hi-res early DDF stays beam-anchored and is hidden by the window comparator alone.

The early hi-res DDFSTRT pre-fetch snap (af42e2d) unconditionally
skipped the whole early-fetch width, assuming the display window opens
at the standard $81 edge. KS 3.2 programs ECS extreme-overscan screens
with both an early fetch and an early window (Overscan editor edit
display: DDFSTRT=$28, DIWSTRT h=$5D, BPLCON1=$44), where those words
are inside the window on real hardware; the snap shifted the whole
picture left and left a blank colour-0 band at the right window edge,
while sprites stayed beam-anchored (issue #186, PAL and NTSC).

The physical origin term (display shift minus DDF shift plus the
framebuffer-origin clamp) already clips exactly the part of the fetch
that lands left of the window: XSysInfo's DDFSTRT=$38 panel still skips
its one pre-fetch word. The snap only ever differed from that term for
windows left of the fetch reference - it was compensating for the old
$83 hi-res reference and became a no-op for standard windows when the
reference was recalibrated to $81.

Fixes #186.
Copilot AI review requested due to automatic review settings July 15, 2026 15:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes ECS Denise hi-res early-DDF rendering on extreme-overscan screens where the display window opens early, preventing an incorrect left-shift of bitplane content relative to sprites by removing an unconditional “snap” that discarded early-fetched words even when they are inside the window.

Changes:

  • Removes the hi-res/SHRES FMODE=0 early-DDF “snap to fetch-word boundary” from ControlState::fetch_origin_native_shift, relying on the existing origin/window math to clip only what’s truly off-screen.
  • Updates/extends the bitplane origin unit test to cover the KS 3.2 ECS extreme-overscan case from issue #186 while preserving existing XSysInfo and Kickstart assertions.
  • Documents the corrected rule for hi-res early DDF in docs/internals/video.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/video/bitplane.rs Removes the unconditional hi-res early-DDF snap and clarifies why window clipping/origin math is sufficient (fixes overscan window-left cases).
src/video/bitplane/tests.rs Renames/updates the relevant test and adds an ECS extreme-overscan regression case asserting the correct origin (18).
docs/internals/video.md Records the “hi-res early DDF is beam-anchored; window comparator hides pre-window fetch” rule and cites the overscan scenario (issue #186).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@LinuxJedi LinuxJedi merged commit dc8dd26 into main Jul 15, 2026
10 checks passed
@LinuxJedi LinuxJedi deleted the fix/hires-overscan-picture-origin branch July 15, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Horizontal offset in ECS Denise PAL and NTSC modes

2 participants