Files
nvdriver/kernel-open/modeset_bridge
morebrackets b95d30a698 ada/desktop: adapt Stage 1 & Stage 2 desktop video for RTX 40 series (AD102-AD107) (#620)
* ada/desktop: adapt Stage 1 & Stage 2 desktop video for RTX 40 series (AD102-AD107)

Stage 1 & Core Ada GSP-RM / RM fixes (verified against stock 580.196.07):
- ga10x_gsp.rs: stop downgrading Ada's configured 580.x release string when
  no bundled 580.178.04 Ada booter exists, add 580.196.07 -> 580.178.04
  gsprm_load fallback, read NV_FUSE_STATUS_OPT_DISPLAY at 0x820c04 on
  Ampere/Ada+ (_nv030373rm) and propagate display_fused_off into hw facts,
  and fail explicitly (instead of silently skipping) when cold-boot Ada
  scrubber-580.bin is missing.
- display.rs, display_channels.rs, gsp_boot.rs, ga10x.rs: fix Ada
  DispSfUser BAR0 offset (0x6f0000 for all NvDisplay v03_00+ per
  _nv005909rm/_nv040109rm), fix Ada copy_engine class (0xc7b5
  AMPERE_DMA_COPY_B), enable ce_class_db filtering for ArchFamily::Ada,
  and pass real boot0 to configure_live_display().
- gsp_route.rs, rmapi_node.rs, modeset_ffi.rs, modeset_bridge.c: intercept
  NV_ESC_RM_BIND_CONTEXT_DMA (0x59) in pre() for host-side 0x0002 ->
  NvDisplay channel binds, keep modeset_gsp_alloc_ctxdma 100% host-side
  with Node RM video memory lookup via nv_rs_modeset_query_rm_mem, prevent
  double GSP memory registration, purge MODESET_MEMS/MODESET_CTXS on
  NVOS00 free, validate Stage 1 nv_rs_modeset_get_rm_ops against the
  configured 580.x driver_version, and fix NVOS64 debug status trace.

Stage 2 Ada NvDisplay v4.1 (0xc77d/0xc67e) & DRM pipeline fixes:
- nvidia_rs_modeset.c:
  - Separate full Core modeset/link-training from fast Window-only page
    flips and cursor-only Core updates; program Core FIRST on full modeset.
  - Resolve imported compositor/Vulkan/EGL VRAM handles via
    nv_rs_modeset_query_rm_mem and bind host-side NV01_CONTEXT_DMA to Core
    and Window channels for scanout.
  - Enforce BAR1 window bounds on 0x0040 allocations (falling back to
    BAR1-constrained nv_rs_modeset_vram_alloc on non-ReBAR 256 MiB GPUs)
    and propagate block-linear pte_kind.
  - Query NV0073_CTRL_CMD_SPECIFIC_OR_GET_INFO (0x0073028b) for SOR
    sublink A/B (DP_A/DP_B, SINGLE_TMDS_A/B, DUAL_TMDS), promote HDMI
    >600 MHz to SOR_PROTOCOL_HDMI_FRL (0xc), bracket DP link training with
    NV5070_CTRL_CMD_SET_SOR_FLUSH_MODE (0x50700457), support DP 1.4a HBR3
    (0x1e) via DP_GET_CAPS (0x00731369), and retry with FALLBACK_CONFIG.
  - Honor HSYNC/VSYNC polarity and 10 bpc depth in HEAD_SET_CONTROL_OR,
    emit HEAD_SET_CONTROL / PCLK_CFG / USAGE_BOUNDS / STORAGE_CURSOR,
    fix WIN_SET_PLANAR_STRG0 13-bit mask (& 0x1fff), add XBGR16161616F,
    and back off synthetic vblank timer when real HW vblank IRQs arrive
    (removing the 4 ms floor for 240/360 Hz displays).
- nvidia_rs_drm.c: fix VRAM BAR1 mmap vma->vm_pgoff bounds/offset,
  validate explicit FB modifiers and reject compressible modifiers, add
  XBGR16161616F, remove unimplemented NV12, set preferred_depth=24 and
  <6.13 allow_fb_modifiers=true, and pair drm_kms_helper_poll_init/fini.
- install_desktop_boot.sh, reload_stage1.sh: add Ada (ad102) GSP boot &
  scrubber firmware preflight check with extract_gsp_boot_ucode.py hint.
- Add unit tests in display.rs, gsp_boot.rs, nvdisp_pushbuf.rs, and
  gpu_tests.rs covering Ada classes, fuse register, and pushbuffer encode.

* ada/desktop: resolve all CodeRabbit review findings for RTX 40 desktop video

* ada/desktop: address round-2 CodeRabbit review findings

* ada/desktop: address final CodeRabbit review findings

* ada/desktop: track explicit fb modifiers, order disable before vblank_off, reserve Window room up front

---------

Co-authored-by: morebrackets <19673572+morebrackets@users.noreply.github.com>
2026-12-05 12:26:38 -08:00
..