[host] measure ready time at framebuffer publication

Exclude command queue reset and cleanup from the ready stage, and keep
the wall-clock residual only as the legacy timing fallback.
This commit is contained in:
Geoffrey McRae
2026-08-03 16:22:07 +10:00
parent aa289fa022
commit 24be0a8869
16 changed files with 157 additions and 67 deletions

View File

@@ -401,6 +401,7 @@ static bool sendFrame(CaptureResult result, bool * restart)
fi->captureTime = frame.captureTime;
fi->postProcessTime = 0;
fi->copyTime = 0;
fi->readyTime = 0;
fi->timingSerial = 0;
__atomic_store_n(&fi->timingValid, 0, __ATOMIC_RELAXED);
if (frame.hdrMetadata)
@@ -449,9 +450,19 @@ static bool sendFrame(CaptureResult result, bool * restart)
const uint64_t copyEnd = nanotime();
fi->postProcessTime = frame.postProcessTime;
frame.copyTime = copyEnd - copyStart > frame.postProcessTime ?
copyEnd - copyStart - frame.postProcessTime : 0;
const uint64_t totalTime = copyEnd - copyStart;
const bool splitTimingValid = frame.copyTimingValid &&
frame.postProcessTime <= totalTime &&
frame.copyTime <= totalTime - frame.postProcessTime &&
frame.readyTime <= totalTime - frame.postProcessTime - frame.copyTime;
if (!splitTimingValid)
{
frame.copyTime = totalTime > frame.postProcessTime ?
totalTime - frame.postProcessTime : 0;
frame.readyTime = 0;
}
fi->copyTime = frame.copyTime;
fi->readyTime = frame.readyTime;
fi->timingSerial = fi->frameSerial;
__atomic_store_n(&fi->timingValid, 1, __ATOMIC_RELEASE);