# NV2A: northbridge, memory controller and GPU Evidence tags as in the methodology. Sources, all pinned: xboxdevwiki `NV2A` r6894 and its subpages (`Vertex Shader` r7422, `Pixel Combiner` r6853, `Surface Formats` r6737, `Vertex attributes` r6672; `Fixed Function Pipeline` r6636 is an empty stub); NVIDIA's own OpenGL extension specifications for the NV20 family (`reference/docs/GL_NV_*.txt`, `nv30specs.pdf`); nouveau's envytools documentation of the NV4-family PFIFO, DMA pusher and puller (`reference/src/envytools`, MIT, `f102b82`; its Kelvin pages are stubs); nxdk's `pbkit` (MIT; `nv_regs.h` has no SPDX line, so facts only) for the NV2A's method names; abaire's hardware tests and golden pictures (validation.md). **There is no public NVIDIA document of the NV2A.** NVIDIA documented the NV20's *programming model* through its OpenGL extensions; the register interface, the push-buffer methods and every NV2A-specific difference come from reverse engineering by the Xbox community and from tests on hardware. Tier 3 at best throughout, tier 1 only where a golden picture or a hardware-run test decides. ## What it is - One chip: the host bridge to the CPU's front-side bus, the memory controller for the 64 MB of unified DDR RAM, the AGP-like link to the MCPX, and an NV20-family ("Kelvin") GPU at 233 MHz (`NV2A`: part of the NV20 family with GeForce3, GeForce4 Ti; `Xbox Hardware Overview` r6007 for the clock). Three revisions: XGPU (1.0), XGPU-S (1.1-1.4), XGPU-B (1.6); "very little known about the difference" (`NV2A`). - Engines by the NV20 family's layout (envytools; nxdk's register names): PMC (master control, interrupts), PBUS, PFIFO (command submission), PTIMER (a timer with an alarm interrupt: abaire's `ptimer_alarm_test`), PFB (memory interface, tiling regions), PGRAPH (the 3D engine, object class 97h "Kelvin primitive": `nv_regs.h`), PCRTC (scan out, vblank interrupt), PRAMDAC (video PLLs and DAC timing), PVIDEO (overlay), PRAMIN (instance memory: object contexts, the RAMHT hash table, RAMFC). ## Command submission: the push buffer - Software writes **methods** (a subchannel, a method offset, a count, data words) into a **push buffer** in RAM and advances the channel's PUT pointer; PFIFO's **DMA pusher** fetches from GET up to PUT, decodes jumps, calls and returns, increasing and non-increasing method headers, and feeds **CACHE1**; the **puller** looks up the subchannel's object through RAMHT and hands methods to PGRAPH (envytools `docs/hw/fifo/dma-pusher.rst`, `puller.rst`, `nv4-pfifo.rst`: desktop NV4-family behaviour; abaire's `pfifo_cache1_test` probes the NV2A's CACHE1 on hardware). - **Sync between CPU and GPU** is through: PUT/GET register reads, **semaphores and notifiers** the GPU writes into memory, interrupts (PGRAPH errors, notify, PCRTC vblank, PTIMER alarm), and polling of PGRAPH status. These are the board's channels (domains-and-speed.md). - The push buffer is written through write-combining memory (HYPOTHESIS, x86-p3-python timing.md), so when the GPU can see a write depends on the CPU's WC drains. ## PGRAPH (Kelvin) as the Xbox uses it - **Vertex input**: 16 attribute slots (`Vertex attributes`), vertex arrays in RAM or inline vertex data in the push buffer. - **Vertex shader**: the NV_vertex_program and NV_vertex_program1_1 programming model (`Vertex Shader`: "the Xbox implements the 2 GL extensions ... with some" differences), **136 instruction slots, 192 constants in two blocks of 96** (Microsoft exposed the second block as c[-96]..c[-1]), 16 inputs, 11 outputs (HPOS, two colours front and back, fog, point size, four texture coordinate sets); vertex state programs. Encoding documented on the wiki; arithmetic corner cases measured on hardware (abaire's `nv2a_vsh_cpu` exceptional-value expectations from `VSH Exceptional` runs: tier 1 for those cases). A fixed-function T&L mode also exists; its wiki page is empty. - **Rasteriser and pixel pipeline**: four texture stages through the **texture shader** (NV_texture_shader, _2, and _3 "citation needed": `Pixel Combiner`), then the **register combiners**: general stages and a final combiner with per-stage constants (NV_register_combiners, _2; the wiki notes where the NV2A's constants differ from the GL extension). Fixed-point types: the wiki cites NV_texture_shader's 8-, 9- and 16-bit signed formats and says "it is not known if the NV2A really implements these 3 datatypes" (U-list). - **Surfaces**: colour and depth targets, swizzled or linear, optionally tiled through PFB tiling regions (`Surface Formats`: tiling "FIXME"); texture formats per NVIDIA's OpenGL texture format list (linked from that page; not fetched); anti-aliasing modes (golden results' `Antialiasing_tests` suite). - **Scan-out**: PCRTC reads the front buffer at the video mode's timing and feeds the external **video encoder** over a digital pixel bus (smbus-devices.md). ## What can judge it | Judge | Tier | Decides | | --- | --- | --- | | abaire/nxdk_pgraph_tests_golden_results (CC0) | 1 (framebuffer captures on a 1.0 Xbox; the README warns that web display may treat alpha differently from the console) | the picture each test produces: 111 suites (2 fetched as a sample) | | abaire/nxdk_low_level_nv2a_tests, nv2a_vsh_cpu's exceptional values (Unlicense) | 1 for the cases they report | PTIMER alarm and interrupt, PFIFO CACHE1 behaviour, vertex shader arithmetic corners | | NVIDIA's NV_* extension specs | 2 for the NV20 family's programming model | combiner and texture-shader arithmetic as specified, vertex program semantics | | envytools | 3 (desktop NV4/NV20 family) | PFIFO, DMA pusher and puller structure | | xboxdevwiki | 3 (community; many FIXMEs) | encodings, register layouts | | xemu (its nv2a is GPL) | 5, closed box | differences only, through a harness in emu-tools-gpl if ever | ## The specification's level (proposal) - **Front end at transaction level, on the CPU domain's time**: PFIFO fetch, method decode, object lookup, PGRAPH state, semaphores and notifiers, interrupts, with the busy time of each primitive from a timing model (FITTED: no NVIDIA timing document exists). - **Back end as a software rasteriser**: per-pixel, deterministic, with the combiner arithmetic in the fixed-point widths the judges support, judged by the golden pictures. It is the reference for any GPU backend (turbo), as for the N64's RDP (`../n64-python/docs/execution-architecture.md`). - Vertex shader as an interpreter over the 136-slot program with the measured corner values.