28std::array<PathCounters, kPathCount> s_counters{};
31std::array<std::array<std::atomic<quint64>, kReasonCount>, kPathCount> s_fallbackReasons{};
35 return s_counters[size_t(path)];
42 slot(path).mapFailures.fetch_add(1, std::memory_order_relaxed);
47 return slot(path).mapFailures.exchange(0, std::memory_order_relaxed);
52 return slot(path).mapFailures.load(std::memory_order_relaxed);
57 slot(path).textureReuseHits.fetch_add(1, std::memory_order_relaxed);
62 return slot(path).textureReuseHits.exchange(0, std::memory_order_relaxed);
67 auto& target = gpuSide ? slot(path).syncGpuWaits : slot(path).syncCpuWaits;
68 target.fetch_add(1, std::memory_order_relaxed);
73 gpuWaits = slot(path).syncGpuWaits.exchange(0, std::memory_order_relaxed);
74 return slot(path).syncCpuWaits.exchange(0, std::memory_order_relaxed);
79 slot(path).imageCacheHits.fetch_add(1, std::memory_order_relaxed);
84 slot(path).imageCacheMisses.fetch_add(1, std::memory_order_relaxed);
89 return slot(path).imageCacheHits.exchange(0, std::memory_order_relaxed);
94 return slot(path).imageCacheMisses.exchange(0, std::memory_order_relaxed);
97#if defined(QGC_HAS_ANY_GPU_PATH)
107 slot(path).delivered.fetch_add(1, std::memory_order_relaxed);
112 return slot(path).delivered.load(std::memory_order_relaxed);
117 return slot(path).delivered.exchange(0, std::memory_order_relaxed);
126 const quint64 sampleUs =
static_cast<quint64
>(nsecs) / 1000;
127 auto& ewma = slot(path).mapDurationUsEwma;
128 quint64 prev = ewma.load(std::memory_order_relaxed);
131 next = (prev == 0) ? sampleUs : prev - (prev >> 3) + (sampleUs >> 3);
132 }
while (!ewma.compare_exchange_weak(prev, next, std::memory_order_relaxed));
137 return slot(path).mapDurationUsEwma.load(std::memory_order_relaxed);
142 slot(path).fenceTimeouts.fetch_add(1, std::memory_order_relaxed);
147 return slot(path).fenceTimeouts.load(std::memory_order_relaxed);
152 return slot(path).fenceTimeouts.exchange(0, std::memory_order_relaxed);
157 slot(path).mmapBarrierHits.fetch_add(1, std::memory_order_relaxed);
162 return slot(path).mmapBarrierHits.load(std::memory_order_relaxed);
167 return slot(path).mmapBarrierHits.exchange(0, std::memory_order_relaxed);
172 slot(path).explicitFenceWaits.fetch_add(1, std::memory_order_relaxed);
177 return slot(path).explicitFenceWaits.exchange(0, std::memory_order_relaxed);
182 s_fallbackReasons[size_t(attemptedPath)][size_t(reason)].fetch_add(1, std::memory_order_relaxed);
187 return s_fallbackReasons[size_t(attemptedPath)][size_t(reason)].load(std::memory_order_relaxed);
192 return s_fallbackReasons[size_t(attemptedPath)][size_t(reason)].exchange(0, std::memory_order_relaxed);
197 slot(negotiated).streamDemotions.fetch_add(1, std::memory_order_relaxed);
202 return slot(negotiated).streamDemotions.exchange(0, std::memory_order_relaxed);
std::atomic< quint64 > explicitFenceWaits
std::atomic< quint64 > imageCacheHits
std::atomic< quint64 > delivered
std::atomic< quint64 > mapDurationUsEwma
std::atomic< quint64 > fenceTimeouts
std::atomic< quint64 > mmapBarrierHits
std::atomic< quint64 > mapFailures
std::atomic< quint64 > syncGpuWaits
std::atomic< quint64 > streamDemotions
std::atomic< quint64 > syncCpuWaits
std::atomic< quint64 > textureReuseHits
std::atomic< quint64 > imageCacheMisses
HwVideoBufferPath
Identifies which GPU path was chosen; used by the adapter to increment the right counter.
void recordSyncWait(HwVideoBufferPath path, bool gpuSide) noexcept
GL fence sync wait; split CPU-blocking vs GPU-side.
quint64 peekMapFailureCount(HwVideoBufferPath path) noexcept
quint64 takeExplicitFenceWaits(HwVideoBufferPath path) noexcept
quint64 peekFenceTimeouts(HwVideoBufferPath path) noexcept
void recordFallbackReason(HwVideoBufferPath attemptedPath, HwFallbackReason reason) noexcept
Per-(path,reason) fallback accounting; lets a bug report show why a path demoted to CPU.
quint64 takeTextureReuseHits(HwVideoBufferPath path) noexcept
void recordMapDuration(HwVideoBufferPath path, qint64 nsecs) noexcept
Per-path mapTextures() wall-time, fed into an EWMA; peek returns the smoothed value in microseconds.
quint64 peekFallbackReason(HwVideoBufferPath attemptedPath, HwFallbackReason reason) noexcept
quint64 takeImageCacheHits(HwVideoBufferPath path) noexcept
quint64 peekMmapBarrierHits(HwVideoBufferPath path) noexcept
void recordImageCacheHit(HwVideoBufferPath path) noexcept
Native image/texture cache hit/miss accounting.
quint64 takeSyncWaitCounts(HwVideoBufferPath path, quint64 &gpuWaits) noexcept
Reads-and-resets CPU waits; writes GPU waits into gpuWaits.
quint64 peekMapDurationUsEwma(HwVideoBufferPath path) noexcept
quint64 takeFenceTimeouts(HwVideoBufferPath path) noexcept
void recordStreamDemotion(HwVideoBufferPath negotiated) noexcept
One-shot-per-epoch event: a stream that negotiated a HW path demoted to CPU. Distinct from per-frame ...
void recordImageCacheMiss(HwVideoBufferPath path) noexcept
void recordExplicitFenceWait(HwVideoBufferPath path) noexcept
DMABuf imported the producer's dma-buf/native fence and did a GPU-side wait (skipped the mmap barrier...
quint64 takeStreamDemotions(HwVideoBufferPath negotiated) noexcept
void recordFenceTimeout(HwVideoBufferPath path) noexcept
DMABuf EGL fence wait timed out (GPU stall) and fell through to the mmap barrier.
quint64 peekDeliveredCount(HwVideoBufferPath path) noexcept
quint64 takeMapFailureCount(HwVideoBufferPath path) noexcept
void recordDelivered(HwVideoBufferPath path) noexcept
Frames successfully delivered via this path.
quint64 takeImageCacheMisses(HwVideoBufferPath path) noexcept
void recordTextureReuse(HwVideoBufferPath path) noexcept
Prior frame's QRhiTexture wrappers reused (decoder pool returned same native handle).
void recordMmapBarrierHit(HwVideoBufferPath path) noexcept
DMABuf mmap CPU-side completion barrier taken (no usable fence ext).
void recordMapFailure(HwVideoBufferPath path) noexcept
mapTextures() returned an invalid bundle (GPU import failed).
quint64 takeDeliveredCount(HwVideoBufferPath path) noexcept
quint64 takeFallbackReason(HwVideoBufferPath attemptedPath, HwFallbackReason reason) noexcept
HwFallbackReason
Specific cause a HW path was rejected for a sample; surfaced as a per-(path,reason) breakdown.
quint64 takeMmapBarrierHits(HwVideoBufferPath path) noexcept