Skip to content

tenseleyFlow/texsub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

obs-texsub

A desktop capture source for OBS on X11 + NVIDIA that keeps frames in VRAM instead of copying them across PCIe.

Why

OBS's built-in XSHM display capture reads the framebuffer into CPU shared memory and re-uploads it to the GPU every frame. On a bandwidth-limited PCIe link this dominates GPU "utilization" — a 4K/60 capture measured 65% on a Gen3 x8 link, all of it bus transfer rather than compute.

texsub avoids the round trip:

  1. XCopyArea blits the root window into an X Pixmap. On the NVIDIA proprietary driver both are VRAM-backed, so this stays on the GPU.
  2. gs_texture_create_from_pixmap binds that pixmap as an OBS texture via eglCreateImageKHR / EGL_NATIVE_PIXMAP_KHR — zero copy.

Same 4K/60 capture measured ~10% GPU after the switch.

Requirements

  • OBS 32.x (X11 EGL backend — obs_get_nix_platform() must be X11_EGL)
  • NVIDIA proprietary driver
  • libobs, libX11, libxcb, libXrandr, libXcomposite dev headers

Does not work under Wayland or on the XCB-only software path; it relies on the NVIDIA driver keeping pixmaps in video memory.

Build

cmake -B build -DCMAKE_INSTALL_PREFIX=/usr/local
cmake --build build
sudo cp build/obs-texsub.so /usr/local/lib/obs-plugins/

(On FreeBSD, OBS loads plugins from /usr/local/lib/obs-plugins/, not the per-user ~/.config/obs-studio/plugins directory.)

Use

Add a "Display Capture (TexSub)" source and pick a monitor. "All monitors" captures the full X screen.

Notes

  • The texture is sampled raw (no sRGB decode). The pixmap-backed EGLImage is GS_BGRA_UNORM with no sRGB view, so requesting a decode washes the image out. The root window is depth 24, so the opaque effect fixes alpha at 1.0.
  • The pixmap lives on OBS's X connection (EGL needs the XID); a second connection runs XCopyArea so it doesn't stall OBS's event loop.
  • Cost scales with captured pixel count but never crosses PCIe, so it's flat with respect to link width/generation.

Status

Early. Known gaps: cursor is not yet composited, capture region doesn't track monitor hotplug/resolution changes, no damage tracking (blits every tick).

About

Zero-PCIe desktop capture plugin for OBS on X11/NVIDIA

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors