Merge pull request #9047 from jherico/stutter

Add stutter tracking
This commit is contained in:
Chris Collins 2016-11-11 11:39:00 -08:00 committed by GitHub
commit b9b90cc646
9 changed files with 37 additions and 3 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

@ -1197,6 +1197,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
properties["present_rate"] = displayPlugin->presentRate();
properties["new_frame_present_rate"] = displayPlugin->newFramePresentRate();
properties["dropped_frame_rate"] = displayPlugin->droppedFrameRate();
properties["stutter_rate"] = displayPlugin->stutterRate();
properties["sim_rate"] = getAverageSimsPerSecond();
properties["avatar_sim_rate"] = getAvatarSimrate();
properties["has_async_reprojection"] = displayPlugin->hasAsyncReprojection();

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

@ -710,3 +710,7 @@ void HmdDisplayPlugin::compositeExtra() {
HmdDisplayPlugin::~HmdDisplayPlugin() {
qDebug() << "Destroying HmdDisplayPlugin";
}
float HmdDisplayPlugin::stutterRate() const {
return _stutterRate.rate();
}

View file

@ -44,6 +44,8 @@ public:
return false;
}
float stutterRate() const override;
protected:
virtual void hmdPresent() = 0;
virtual bool isHmdMounted() const = 0;
@ -108,8 +110,9 @@ protected:
QMap<uint32_t, FrameInfo> _frameInfos;
FrameInfo _currentPresentFrameInfo;
FrameInfo _currentRenderFrameInfo;
RateCounter<> _stutterRate;
bool _disablePreview{ true };
bool _disablePreview { true };
private:
ivec4 getViewportForSourceSize(const uvec2& size) const;
float getLeftCenterPixel() const;

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

@ -146,6 +146,16 @@ void OculusDisplayPlugin::hmdPresent() {
if (!OVR_SUCCESS(result)) {
logWarning("Failed to present");
}
static int droppedFrames = 0;
ovrPerfStats perfStats;
ovr_GetPerfStats(_session, &perfStats);
for (int i = 0; i < perfStats.FrameStatsCount; ++i) {
const auto& frameStats = perfStats.FrameStats[i];
int delta = frameStats.CompositorDroppedFrameCount - droppedFrames;
_stutterRate.increment(delta);
droppedFrames = frameStats.CompositorDroppedFrameCount;
}
}
_presentRate.increment();
}

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() {