Expand description
The GPU semaphore an X server’s blit signals for the encoder, made through Vulkan.
A GPU semaphore an X server’s renderer signals and the encoder’s CUDA stream waits on, so the
encoder’s work on a frame is queued behind the server’s blit on the GPU itself instead of after
the CPU has learnt the blit landed (crate::x11’s DRI3 path, through the SELKIES-SEMAPHORE
extension of the images’ Xvfb).
Neither CUDA nor GL can make a semaphore another API imports, so Vulkan makes it, a binary one
exported as an OPAQUE_FD, on the device whose UUID is the CUDA device’s. Two fds of it go out,
one for CUDA’s import and one for the server’s GL, and the device and the semaphore are gone
again once they are: the imports hold the payload between them. The instance the device is
made from stays for the life of the process ([Vulkan]), since destroying one leaks
descriptors in NVIDIA’s driver.
Structs§
- Application
Info 🔒 - Device
Create 🔒Info - Device
Queue 🔒Create Info - Export
Semaphore 🔒Create Info - Instance
Create 🔒Info - Physical
Device 🔒IdProperties - Physical
Device 🔒Properties2 VkPhysicalDeviceProperties2, with the core properties (824 bytes, 8-aligned) left opaque: only the ID properties chained after them are read.- Semaphore
Create 🔒Info - Semaphore
GetFd 🔒Info - Vulkan 🔒
- The Vulkan loader and the one instance every semaphore’s device is made from, kept for the life
of the process. NVIDIA’s driver leaves a
/dev/nvidiactland a render-node descriptor open for every instance it destroys whileDISPLAYnames an X server without NV-GLX, as the images’ Xvfb is, so an instance per capture start runs a server that streams to reconnecting clients out of descriptors; the devices made from a kept instance are destroyed without leaking any.
Constants§
- EXTERNAL_
SEMAPHORE_ 🔒HANDLE_ TYPE_ OPAQUE_ FD - STRUCTURE_
TYPE_ 🔒APPLICATION_ INFO - STRUCTURE_
TYPE_ 🔒DEVICE_ CREATE_ INFO - STRUCTURE_
TYPE_ 🔒DEVICE_ QUEUE_ CREATE_ INFO - STRUCTURE_
TYPE_ 🔒EXPORT_ SEMAPHORE_ CREATE_ INFO - STRUCTURE_
TYPE_ 🔒INSTANCE_ CREATE_ INFO - STRUCTURE_
TYPE_ 🔒PHYSICAL_ DEVICE_ ID_ PROPERTIES - STRUCTURE_
TYPE_ 🔒PHYSICAL_ DEVICE_ PROPERTIES_ 2 - STRUCTURE_
TYPE_ 🔒SEMAPHORE_ CREATE_ INFO - STRUCTURE_
TYPE_ 🔒SEMAPHORE_ GET_ FD_ INFO_ KHR - VK_
API_ 🔒VERSION_ 1_ 1
Functions§
- opaque_
fd_ 🔒pair - Two fds of one new binary semaphore exportable as OPAQUE_FD, made on the Vulkan device whose
UUID is
uuid(the CUDA device’s, ascuDeviceGetUuidreports it).