Skip to content

Fix Turing (TU106/TU104/TU116) WindowServer dragging micro-stutter & 256MB BAR1 budget drops - #179

Open
Golopmoui3 wants to merge 1 commit into
nullmoth:mainfrom
Golopmoui3:fix/turing-stutter-optimization
Open

Golopmoui3 wants to merge 1 commit into
nullmoth:mainfrom
Golopmoui3:fix/turing-stutter-optimization

Conversation

@Golopmoui3

Copy link
Copy Markdown

Overview

This PR resolves the severe WindowServer dragging micro-stutter, surface drops, and black window rectangles observed on NVIDIA Turing GPUs (RTX 2060 SUPER / TU106, RTX 2070 / TU104, GTX 1660 / TU116) running on macOS Sequoia / Sonoma with 256MB small BAR1 apertures.

Root Causes & Fixes

  1. NVRMFB 256MB VRAM Grant Budget Ceiling (vramGrant at offset 0x21ea3):

    • Framebuffer enforces a 256MB VRAM allocation ceiling intended for small BAR1. WindowServer surface churn during window moves exceeds this threshold, returning kIOReturnNoMemory and dropping surfaces into black boxes.
    • Fix: Patched conditional branch (0x0f 0x8e 0x6d 0x01 0x00 0x00 -> 0xe9 0x6e 0x01 0x00 0x00 0x90, jle -> jmp) to let system memory handle allocations smoothly without rejection.
  2. NVAccel Inactivity Surface Eviction (gSurfGpuOn at offset 0x251e0):

    • Surfaces untouched for 100ms are aggressively evicted from GPU memory, causing rendering stalls and hitching upon mouse resume.
    • Fix: gSurfGpuOn set to 0.
  3. NVAccel Sticky VM Mapping Churn (gVmSticky at offset 0x23f1c):

    • Redundant sticky mappings churn during window movement.
    • Fix: gVmSticky set to 0.
  4. Metal Driver Configuration (nullmoth-rules.json):

    • Added turing-bar1-stutter-optimization rule to configure nvrm610.conf with:
      • NVMTL_VRAM_HEADROOM_MB=48 (avoids BAR1 starvation).
      • NVMTL_NO_SURFACE_PAGEOFF=0 (keeps active desktop surfaces responsive).
      • Disables buffer reuse (NVMTL_NO_BUFREUSE=1), private image pooling (NVMTL_IMAGE_POOL=0, NVMTL_PRIVATE_POOL=0), and buffer grace periods on small BAR1 apertures.
      • NVMTL_GSUB_HOSTPTR_LIFT=1, NVMTL_CMD_POOL_MAX_CHUNKS=256, NVMTL_SURFACE_DEFER_FREE_MS=0.
  5. Installer & Standalone Utilities:

    • Added automatic detection and patching into mac/Resources/nullmoth-setup.sh.
    • Added standalone verification tool tools/apply-turing-fix.sh (with --check and --revert).
    • Added unit test tests/test_turing_stutter_rules.py and technical breakdown docs/TURING_OPTIMIZATION.md.

Hardware Verification

  • CPU: AMD Ryzen 5 5600 6-Core Processor
  • GPU: NVIDIA GeForce RTX 2060 SUPER 8GB (Device ID 10de:1f06, Turing TU106)
  • OS: macOS Sequoia 15.8.3 (Kernel Darwin 24.6.0 x86_64)
  • Results: Window dragging is 100% smooth at 60 FPS, zero black window surfaces, zero NVENC/audio regressions.

…s & rules

- Add turing-bar1-stutter-optimization rule to nullmoth-rules.json with optimized Metal driver knobs
- Patch NVRMFB 256MB vramGrant budget limit check at offset 0x21ea3 to prevent surface dropping and black frames
- Patch NVAccel aggressive 100ms surface eviction (0x251e0) and sticky VM mapping churn (0x23f1c)
- Integrate automatic patcher and AuxKC rebuild in nullmoth-setup.sh
- Provide standalone diagnostic tool tools/apply-turing-fix.sh with --check and --revert
- Add full technical documentation in docs/TURING_OPTIMIZATION.md and unit tests
@Golopmoui3
Golopmoui3 requested a review from nullmoth as a code owner November 14, 2026 19:55
Golopmoui3 added a commit to Golopmoui3/Golopmoui3 that referenced this pull request Nov 15, 2026
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.

1 participant