QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GstHw Namespace Reference

Defined only in builds with the DMABuf path (QGC_HAS_GST_DMABUF_GPU_PATH) on GStreamer 1.24 or later. More...

Classes

class  GstHwImportCache
struct  MapDiagnostics
 One-shot warning flags per failure cause; paths with extra causes (DMABuf, D3D, IOSurface) derive and add members. More...

Functions

constexpr const char * toString (HwVideoBufferPath path) noexcept
bool texturePadsPicture (QSize textureSize, QSize picture, bool evenSizes)
bool dmaDrmAwareVideoInfo (GstCaps *caps, GstVideoInfo *info)
bool hasCpuLayout (GstCaps *caps)
int planeHeight (const GstVideoInfo &info, int plane)
int planeRowBytes (const GstVideoInfo &info, int plane)
bool setFrameSize (GstVideoInfo &info, int width, int height)
std::string buildSupportedDmaDrmCaps (std::span< const GstVideoFormat > formats, void *display)
std::string buildVulkanDmaDrmCaps (std::span< const GstVideoFormat > formats)

Variables

constexpr std::size_t kPathCount = static_cast<std::size_t>(HwVideoBufferPath::Count)
constexpr int kMaxPlanes = 4
 Matches GST_VIDEO_MAX_PLANES (gst-video pins it at 4); single source of truth for every per-platform buffer.

Detailed Description

Defined only in builds with the DMABuf path (QGC_HAS_GST_DMABUF_GPU_PATH) on GStreamer 1.24 or later.

Function Documentation

◆ buildSupportedDmaDrmCaps()

std::string GstHw::buildSupportedDmaDrmCaps ( std::span< const GstVideoFormat > formats,
void * display )

Best-effort DMA_DRM caps string built from the (format, modifier) pairs EGL display (Qt's EGLDisplay, as HwBuffers::dmaBufImportDisplay() returns it) reports, intersected with formats: a pair is offered when Qt's DMABuf importer can sample every plane of the format with that modifier (no compression or auxiliary planes). Returns a single ready-to-prepend "video/x-raw(memory:DMABuf), format=DMA_DRM, drm-format={ FMT:0xMOD, ... }; " fragment, or "" on ANY failure (null display, no modifier query). Additive only: callers must keep the existing system catch-all.

◆ buildVulkanDmaDrmCaps()

std::string GstHw::buildVulkanDmaDrmCaps ( std::span< const GstVideoFormat > formats)

The same fragment for Qt Quick on Vulkan: the (format, modifier) pairs of formats every plane of which Qt's Vulkan device imports as an image of its own (GstDmaBufVulkan::probeDevice()). "" until that device is known, when it can't import, and in builds without the DMABuf import under Vulkan.

◆ dmaDrmAwareVideoInfo()

bool GstHw::dmaDrmAwareVideoInfo ( GstCaps * caps,
GstVideoInfo * info )

Parse caps into info, handling the GStreamer 1.24+ DMA_DRM format that plain gst_video_info_from_caps cannot decode. False on parse failure or null args.

Definition at line 23 of file GstHwVideoInfo.cc.

Referenced by gst_qgc_q_video_sink_set_caps(), and GstQgc::populateAllocationQuery().

◆ hasCpuLayout()

bool GstHw::hasCpuLayout ( GstCaps * caps)

False for DMA_DRM caps whose modifier isn't LINEAR: a tiled or driver-chosen layout has no CPU reading, and the GstVideoInfo dmaDrmAwareVideoInfo() derives describes linear rows. True for any other caps.

Definition at line 38 of file GstHwVideoInfo.cc.

Referenced by mapSampleToFrame().

◆ planeHeight()

int GstHw::planeHeight ( const GstVideoInfo & info,
int plane )

Rows of plane, taken from the first component stored in it: plane and component indices differ in general (AV12's third plane holds component 3, the full-height alpha, not the half-height V component 2). 0 for a plane without components.

Definition at line 52 of file GstHwVideoInfo.cc.

Referenced by CpuVideoFramePool::computeLayout(), CpuVideoFramePool::copyFromBuffer(), and CpuVideoFramePool::mapDataFor().

◆ planeRowBytes()

int GstHw::planeRowBytes ( const GstVideoInfo & info,
int plane )

Bytes of image data in one row of plane, i.e. the stride without its alignment padding: up to the last byte of any component stored in the plane.

Definition at line 61 of file GstHwVideoInfo.cc.

Referenced by CpuVideoFramePool::copyFromBuffer().

◆ setFrameSize()

bool GstHw::setFrameSize ( GstVideoInfo & info,
int width,
int height )

Gives info the size width x height, with gst-video's default plane layout for it; format, colorimetry and frame rate stay. False, with info unchanged, when the format has no layout of that size.

Definition at line 87 of file GstHwVideoInfo.cc.

Referenced by CpuVideoFramePool::copyFromBuffer().

◆ texturePadsPicture()

bool GstHw::texturePadsPicture ( QSize textureSize,
QSize picture,
bool evenSizes )

True when a native texture of textureSize holds picture in its top-left corner with padding around it: decoders pad their surfaces to their alignment without crop meta. evenSizes: the texture format (4:2:0) only has even sizes, so an odd picture dimension rounded up is no padding.

Definition at line 13 of file GstHwVideoBuffer.cc.

◆ toString()

const char * GstHw::toString ( HwVideoBufferPath path)
constexprnoexcept

Label used in logs and stats. Kept out of the enum's namespace so QTest's unqualified toString() can't find it through ADL for a QCOMPARE on HwVideoBufferPath (QTest delete[]s what toString() returns).

Definition at line 37 of file GstHwTypes.h.

References AHardwareBuffer, Count, D3D11, D3D12, DmaBuf, GlMemory, IOSurface, None, and Vulkan.

Referenced by HwBuffers::extraPathStatsSince(), GstQgc::formatSinkStats(), gst_qgc_q_video_sink_show_frame(), HwBuffers::makeAdapterContext(), makeHwVideoBuffer(), DecodingBranch::sampleStats(), and GstQgc::sinkFramesField().

Variable Documentation

◆ kMaxPlanes

int GstHw::kMaxPlanes = 4
constexpr

Matches GST_VIDEO_MAX_PLANES (gst-video pins it at 4); single source of truth for every per-platform buffer.

Definition at line 21 of file GstHwVideoBuffer.h.

Referenced by GstHwVideoBuffer::validatePlanes().

◆ kPathCount

std::size_t GstHw::kPathCount = static_cast<std::size_t>(HwVideoBufferPath::Count)
inlineconstexpr