Title: [275146] trunk/Source/WebKit
- Revision
- 275146
- Author
- [email protected]
- Date
- 2021-03-27 20:26:26 -0700 (Sat, 27 Mar 2021)
Log Message
Have DisplayLink compute its displayNominalFramesPerSecond just once
https://bugs.webkit.org/show_bug.cgi?id=223845
Reviewed by Zalan Bujtas.
Rather than calling CVDisplayLinkGetNominalOutputVideoRefreshPeriod() every time,
just store displayNominalFramesPerSecond in a member variable.
* UIProcess/mac/DisplayLink.cpp:
(WebKit::DisplayLink::DisplayLink):
(WebKit::DisplayLink::nominalFramesPerSecondFromDisplayLink):
(WebKit::DisplayLink::nominalFramesPerSecond const): Deleted.
* UIProcess/mac/DisplayLink.h:
(WebKit::DisplayLink::nominalFramesPerSecond const):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (275145 => 275146)
--- trunk/Source/WebKit/ChangeLog 2021-03-28 03:22:34 UTC (rev 275145)
+++ trunk/Source/WebKit/ChangeLog 2021-03-28 03:26:26 UTC (rev 275146)
@@ -1,5 +1,22 @@
2021-03-27 Simon Fraser <[email protected]>
+ Have DisplayLink compute its displayNominalFramesPerSecond just once
+ https://bugs.webkit.org/show_bug.cgi?id=223845
+
+ Reviewed by Zalan Bujtas.
+
+ Rather than calling CVDisplayLinkGetNominalOutputVideoRefreshPeriod() every time,
+ just store displayNominalFramesPerSecond in a member variable.
+
+ * UIProcess/mac/DisplayLink.cpp:
+ (WebKit::DisplayLink::DisplayLink):
+ (WebKit::DisplayLink::nominalFramesPerSecondFromDisplayLink):
+ (WebKit::DisplayLink::nominalFramesPerSecond const): Deleted.
+ * UIProcess/mac/DisplayLink.h:
+ (WebKit::DisplayLink::nominalFramesPerSecond const):
+
+2021-03-27 Simon Fraser <[email protected]>
+
Allow DisplayRefreshMonitor to be more long-lived objects
https://bugs.webkit.org/show_bug.cgi?id=223844
Modified: trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp (275145 => 275146)
--- trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp 2021-03-28 03:22:34 UTC (rev 275145)
+++ trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp 2021-03-28 03:26:26 UTC (rev 275146)
@@ -58,6 +58,8 @@
WTFLogAlways("Could not set the display link output callback for display %u: error %d", displayID, error);
return;
}
+
+ m_displayNominalFramesPerSecond = nominalFramesPerSecondFromDisplayLink(m_displayLink);
}
DisplayLink::~DisplayLink()
@@ -73,9 +75,9 @@
CVDisplayLinkRelease(m_displayLink);
}
-Optional<unsigned> DisplayLink::nominalFramesPerSecond() const
+WebCore::FramesPerSecond DisplayLink::nominalFramesPerSecondFromDisplayLink(CVDisplayLinkRef displayLink)
{
- CVTime refreshPeriod = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(m_displayLink);
+ CVTime refreshPeriod = CVDisplayLinkGetNominalOutputVideoRefreshPeriod(displayLink);
return round((double)refreshPeriod.timeScale / (double)refreshPeriod.timeValue);
}
Modified: trunk/Source/WebKit/UIProcess/mac/DisplayLink.h (275145 => 275146)
--- trunk/Source/WebKit/UIProcess/mac/DisplayLink.h 2021-03-28 03:22:34 UTC (rev 275145)
+++ trunk/Source/WebKit/UIProcess/mac/DisplayLink.h 2021-03-28 03:26:26 UTC (rev 275146)
@@ -29,6 +29,7 @@
#include "DisplayLinkObserverID.h"
#include <CoreVideo/CVDisplayLink.h>
+#include <WebCore/AnimationFrameRate.h>
#include <WebCore/PlatformScreen.h>
#include <wtf/HashMap.h>
#include <wtf/Lock.h>
@@ -51,7 +52,7 @@
WebCore::PlatformDisplayID displayID() const { return m_displayID; }
- Optional<unsigned> nominalFramesPerSecond() const;
+ WebCore::FramesPerSecond nominalFramesPerSecond() const { return m_displayNominalFramesPerSecond; }
// When responsiveness is critical, we send the IPC to a background queue. Otherwise, we send it to the
// main thread to avoid unnecessary thread hopping and save power.
@@ -60,11 +61,14 @@
private:
static CVReturn displayLinkCallback(CVDisplayLinkRef, const CVTimeStamp*, const CVTimeStamp*, CVOptionFlags, CVOptionFlags*, void* data);
void notifyObserversDisplayWasRefreshed();
+
+ static WebCore::FramesPerSecond nominalFramesPerSecondFromDisplayLink(CVDisplayLinkRef);
CVDisplayLinkRef m_displayLink { nullptr };
Lock m_observersLock;
HashMap<RefPtr<IPC::Connection>, Vector<DisplayLinkObserverID>> m_observers;
WebCore::PlatformDisplayID m_displayID;
+ WebCore::FramesPerSecond m_displayNominalFramesPerSecond { 0 };
unsigned m_fireCountWithoutObservers { 0 };
static bool shouldSendIPCOnBackgroundQueue;
};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes