Loading...
Searching...
No Matches
BorrowedHostImportCapture.hpp File Reference

Zero-copy capture from buffers the producer already owns, via VK_EXT_external_memory_host. More...

Detailed Description

Zero-copy capture from buffers the producer already owns, via VK_EXT_external_memory_host.

For producers that hand out a fixed set of page-aligned host buffers for the lifetime of a stream and can be told when the renderer has finished with one: V4L2 MMAP (the driver's mmap'd buffers), and a DeckLink allocator provider (buffers we hand the SDK so the card DMAs straight into them).

The difference from CpuStagedCapture is where the frame comes from. CpuStagedCapture owns its slots, so the producer copies each frame in; on Vulkan the slot pages are imported once and the upload is free, but the producer's memcpy remains. Here the producer's own buffers are the imported pages, so that copy disappears too and the whole path is card -> buffer (DMA) -> texture (DMA) with the CPU touching nothing.

The cost is a lifetime contract: the renderer samples producer memory, so a buffer must not be recycled while the GPU may still read it. That is what BorrowedSlotTracker arbitrates – ingestFrame publishes, takeReturnedSlots tells the producer which buffers it may reuse, and a producer that ignores the latter will starve its own queue.

Two backends can point the GPU at existing host pages: Vulkan through VK_EXT_external_memory_host, and D3D12 through ID3D12Device3::OpenExistingHeapFromAddress. init() picks whichever the live QRhi offers and returns false on the rest – OpenGL has no equivalent, and D3D11 has no public API to wrap application memory at all – so the renderer degrades to the CPU rung there.

The two disagree on what they will accept, and the stricter of the pair wins: D3D12 needs a 64 KB-granularity VirtualAlloc address (hence importableAlloc, which Vulkan also accepts) and a 256-byte-aligned row pitch.

Go to the source code of this file.

Classes

struct  score::gfx::interop::BorrowedHostBuffer
 One producer-owned frame buffer. More...
 
struct  score::gfx::interop::BorrowedHostBuffer::Plane
 
struct  score::gfx::interop::BorrowedHostImportCapture
 

Namespaces

namespace  score
 Base toolkit upon which the software is built.
 
namespace  score::gfx
 Graphics rendering pipeline for ossia score.