Add stutter tracking

This commit is contained in:
Brad Davis 2016-11-08 09:13:53 -08:00
parent af2f6e831a
commit 90f55f0cd5
6 changed files with 25 additions and 2 deletions

View file

@ -69,6 +69,10 @@ Item {
StatText {
text: "Present Drop Rate: " + root.presentdroprate.toFixed(2);
}
StatText {
text: "Stutter Rate: " + root.stutterrate.toFixed(3);
visible: root.stutterrate != -1;
}
StatText {
text: "Simrate: " + root.simrate
}

View file

@ -128,7 +128,8 @@ void Stats::updateStats(bool force) {
STAT_UPDATE(renderrate, displayPlugin->renderRate());
STAT_UPDATE(presentrate, displayPlugin->presentRate());
STAT_UPDATE(presentnewrate, displayPlugin->newFramePresentRate());
STAT_UPDATE(presentdroprate, qApp->getActiveDisplayPlugin()->droppedFrameRate());
STAT_UPDATE(presentdroprate, displayPlugin->droppedFrameRate());
STAT_UPDATE(stutterrate, displayPlugin->stutterRate());
} else {
STAT_UPDATE(presentrate, -1);
STAT_UPDATE(presentnewrate, -1);

View file

@ -36,7 +36,9 @@ class Stats : public QQuickItem {
STATS_PROPERTY(float, renderrate, 0)
// How often the display plugin is presenting to the device
STATS_PROPERTY(float, presentrate, 0)
// How often the display device reprojecting old frames
STATS_PROPERTY(float, stutterrate, 0)
STATS_PROPERTY(float, presentnewrate, 0)
STATS_PROPERTY(float, presentdroprate, 0)
STATS_PROPERTY(int, simrate, 0)
@ -140,6 +142,7 @@ signals:
void presentrateChanged();
void presentnewrateChanged();
void presentdroprateChanged();
void stutterrateChanged();
void simrateChanged();
void avatarSimrateChanged();
void avatarCountChanged();

View file

@ -188,6 +188,8 @@ public:
virtual float renderRate() const { return -1.0f; }
// Rate at which we present to the display device
virtual float presentRate() const { return -1.0f; }
// Rate at which old frames are presented to the device display
virtual float stutterRate() const { return -1.0f; }
// Rate at which new frames are being presented to the display device
virtual float newFramePresentRate() const { return -1.0f; }
// Rate at which rendered frames are being skipped

View file

@ -641,6 +641,12 @@ void OpenVrDisplayPlugin::hmdPresent() {
vr::VRCompositor()->PostPresentHandoff();
_presentRate.increment();
}
vr::Compositor_FrameTiming frameTiming;
memset(&frameTiming, 0, sizeof(vr::Compositor_FrameTiming));
frameTiming.m_nSize = sizeof(vr::Compositor_FrameTiming);
vr::VRCompositor()->GetFrameTiming(&frameTiming);
_stutterRate.increment(frameTiming.m_nNumDroppedFrames);
}
void OpenVrDisplayPlugin::postPreview() {
@ -702,3 +708,7 @@ bool OpenVrDisplayPlugin::isKeyboardVisible() {
int OpenVrDisplayPlugin::getRequiredThreadCount() const {
return Parent::getRequiredThreadCount() + (_threadedSubmit ? 1 : 0);
}
float OpenVrDisplayPlugin::stutterRate() const {
return _stutterRate.rate();
}

View file

@ -58,6 +58,8 @@ public:
// Possibly needs an additional thread for VR submission
int getRequiredThreadCount() const override;
float stutterRate() const override;
protected:
bool internalActivate() override;
void internalDeactivate() override;
@ -77,6 +79,7 @@ private:
vr::HmdMatrix34_t _lastGoodHMDPose;
mat4 _sensorResetMat;
bool _threadedSubmit { true };
RateCounter<> _stutterRate;
CompositeInfo::Array _compositeInfos;
size_t _renderingIndex { 0 };