QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
HwBuffers.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <QtCore/QString>
6#include <QtCore/qglobal.h>
7#include <gst/gst.h>
8
9class QQuickWindow;
10
11// HwVideoBufferContext/Path and telemetry are unconditional (CPU path uses them); GstHwVideoBuffer needs
12// MultimediaPrivate so it's GPU-only.
13#include "GstHwPathTelemetry.h"
14#include "GstHwVideoBufferFactory.h" // HwVideoBufferContext, HwVideoBufferPath, makeHwVideoBuffer
15#if defined(QGC_HAS_ANY_GPU_PATH)
16#include "GstHwVideoBuffer.h"
17#endif
18
19namespace HwBuffers {
20
22void initializeOnce() noexcept;
23
27{
28 bool dmaBufCache = false; // QGC_GST_DMABUF_CACHE (default off)
29 bool dmaBufSingleEglImage = true; // QGC_GST_DMABUF_SINGLE_EGLIMAGE (default on)
30 bool dmaBufNoMmapFence = false; // QGC_GST_DMABUF_NO_MMAP_FENCE (default off)
31 bool offerDmaDrmLinear = false; // QGC_GST_OFFER_DMA_DRM_LINEAR (default off)
32};
33
35const HwBufferEnvConfig& hwBufferEnvConfig() noexcept;
36
38GstBusSyncReply onBusSyncMessage(GstBus* bus, GstMessage* msg, gpointer userData) noexcept;
39
41void dispatchBusMessage(GstMessage* msg) noexcept;
42
44void onPipelineRestart() noexcept;
45
47void resetCachedGpuResources() noexcept;
48
50void connectMainWindow(QQuickWindow* window) noexcept;
51
52#if defined(QGC_HAS_ANY_GPU_PATH)
54HwVideoBufferContext makeAdapterContext(bool gpuEnabled) noexcept;
55#endif
56
58bool answerSinkBinContextQuery(GstQuery* query) noexcept;
59
62{
63 QString line;
64 quint64 totalDelivered = 0;
65};
66
67PathStats formatPathStats(bool reset) noexcept;
68
70QString takeExtraPathStats() noexcept;
71
72} // namespace HwBuffers
void initializeOnce() noexcept
One-time process init; single call site for future lazy bridge registration.
Definition HwBuffers.cc:139
bool answerSinkBinContextQuery(GstQuery *query) noexcept
Synchronously answer GST_QUERY_CONTEXT (gst.gl.GLDisplay/app_context); false -> let bus NEED_CONTEXT ...
Definition HwBuffers.cc:271
QString takeExtraPathStats() noexcept
Path-specific extras after formatPathStats (GL reuse/sync waits); reads-and-clears,...
Definition HwBuffers.cc:320
void onPipelineRestart() noexcept
Pipeline-restart hook; re-arms one-shot priming latches so a restart can prime on the next NEED_CONTE...
Definition HwBuffers.cc:180
void resetCachedGpuResources() noexcept
Drop process-wide native GPU handles tied to the current Qt scene-graph device/context.
Definition HwBuffers.cc:192
void connectMainWindow(QQuickWindow *window) noexcept
Wire the main QQuickWindow into the RHI-capture path so snapshots follow its QRhi; no-op without GPU.
Definition HwBuffers.cc:203
GstBusSyncReply onBusSyncMessage(GstBus *, GstMessage *msg, gpointer) noexcept
Bus sync handler (GstBusSyncHandler) installed on every pipeline; no-op when no GPU path compiled.
Definition HwBuffers.cc:169
void dispatchBusMessage(GstMessage *msg) noexcept
Receiver-side bus hook; drops cached GPU devices on GST_MESSAGE_ERROR. No-op when no GPU paths compil...
Definition HwBuffers.cc:114
const HwBufferEnvConfig & hwBufferEnvConfig() noexcept
Lazily parses + logs the toggle config on first call; thread-safe via static-init guarantees.
Definition HwBuffers.cc:144
PathStats formatPathStats(bool reset) noexcept
Definition HwBuffers.cc:296
Formatted per-path counters + delivered total; reset=true reads-and-clears (teardown),...
Definition HwBuffers.h:62
Platform context for the factory; encapsulates EGL handles so callers don't need path-specific ifdefs...