Skip to content

feat(vk_native): opt-in Linux direct-scanout present path (ST-5539, #755)#756

Draft
dfattal wants to merge 1 commit into
mainfrom
feat/linux-direct-scanout
Draft

feat(vk_native): opt-in Linux direct-scanout present path (ST-5539, #755)#756
dfattal wants to merge 1 commit into
mainfrom
feat/linux-direct-scanout

Conversation

@dfattal

@dfattal dfattal commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Closes the presentation-overhead half of ST-5539 (sw-runtime-linux). Fixes #755.

What

Opt-in, fullscreen-only direct-scanout present path for the Linux Vulkan compositor: acquire the 3D-panel connector as a VkDisplayKHR (VK_EXT_acquire_xlib_display on Xorg) and scan out to it directly, bypassing Xorg + gnome-shell — the ~44% presentation cost Suki measured.

Why it's runtime-only (re-scope from the report)

The report attributed the present to the Leia plug-in, but on Linux the plug-in weaves into a caller-provided target and does not own a swapchain or present (contract §3.3). comp_vk_native owns the swapchain + present. No plug-in / srSDK change.

Changes

  • comp_vk_native_window_direct.{c,h} — RandR output → VkDisplayKHR → acquire → display-plane surface (Monado comp_window_direct_randr model).
  • Activated the dormant aux-layer VK_KHR_display pathVK_USE_PLATFORM_DISPLAY_KHR / _XLIB_XRANDR_EXT were in xrt_config_vulkan.h.cmake_in but never set(); new XRT_HAVE_XLIB_XRANDR (pkg x11+xrandr) drives them. This is why the report saw "VK_KHR_display referenced but not wired."
  • null_compositor — requests the display exts as optional → graceful XCB fallback.
  • comp_vk_native_targetcreate_from_surface() consumes a pre-made (borrowed) surface; external_surface guards teardown.
  • compositor — fullscreen hosted path tries direct when DXR_LINUX_DIRECT_SCANOUT=1, silently falls back to XCB on any failure. Default path untouched.

Testing

  • Compile-checked by this PR's Linux CI (CI has libx11-dev+libxrandr-devXRT_HAVE_XLIB_XRANDR on).
  • ⚠️ Draft — needs on-hardware validation on the P1 + DS1 box (@ handoff to Suki): DXR_LINUX_DIRECT_SCANOUT=1 + a fullscreen app (model-viewer / gauss), confirm the connector is scanned out directly and intel_gpu_top shows the Xorg share drop.

Notes

  • Fullscreen-only by nature (model-viewer, gauss) — matches the in-thread conclusion.
  • clang-format not run locally (not installed on the authoring box); style matched by hand — reformat if the linter nits.
  • Wayland/DRM-lease (VK_EXT_acquire_drm_display) documented as the future path, not built here.

🤖 Generated with Claude Code

Reclaims the ~44% Xorg+gnome-shell presentation cost measured in ST-5539 by
acquiring the 3D-panel connector as a VkDisplayKHR (VK_EXT_acquire_xlib_display)
and scanning out to it directly, bypassing the desktop compositor.

Re-scope: on Linux the Leia plug-in weaves into a caller-provided target and
does NOT present (contract §3.3) — comp_vk_native owns the swapchain/present.
So this is a runtime-only change; no plug-in or srSDK change.

- comp_vk_native_window_direct.{c,h}: RandR output -> VkDisplayKHR -> acquire ->
  display-plane surface (Monado comp_window_direct_randr model).
- Activate the dormant aux-layer VK_KHR_display helpers: VK_USE_PLATFORM_DISPLAY_KHR
  and VK_USE_PLATFORM_XLIB_XRANDR_EXT were in xrt_config_vulkan.h.cmake_in but
  never set() — new XRT_HAVE_XLIB_XRANDR (pkg x11+xrandr) drives them.
- null_compositor: request VK_KHR_display / direct_mode / acquire_xlib as OPTIONAL
  instance exts -> graceful XCB fallback when absent.
- comp_vk_native_target: create_from_surface() consumes a pre-made (borrowed)
  VkSurfaceKHR; external_surface guards teardown.
- compositor: fullscreen hosted path tries direct when DXR_LINUX_DIRECT_SCANOUT=1,
  falls back silently to XCB on any failure; default path untouched.

Fullscreen-only (model-viewer, gauss). Compile-checked via Linux CI; needs
on-hardware validation on P1 + DS1 (Suki). Wayland/DRM-lease deferred.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

Linux direct-scanout present path (reclaim ~44% Xorg/compositor GPU on fullscreen) — ST-5539

1 participant