Bug 1236035 - Share the compositor frame metrics even when progressive painting is disabled. r?kats
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -3556,31 +3556,31 @@ ScrollableLayerGuid AsyncPanZoomControll
void AsyncPanZoomController::UpdateSharedCompositorFrameMetrics()
{
mMonitor.AssertCurrentThreadIn();
FrameMetrics* frame = mSharedFrameMetricsBuffer ?
static_cast<FrameMetrics*>(mSharedFrameMetricsBuffer->memory()) : nullptr;
- if (frame && mSharedLock && gfxPlatform::GetPlatform()->UseProgressivePaint()) {
+ if (frame && mSharedLock && gfxPlatform::GetPlatform()->SupportsCrossProcessMutex()) {
mSharedLock->Lock();
*frame = mFrameMetrics.MakePODObject();
mSharedLock->Unlock();
}
}
void AsyncPanZoomController::ShareCompositorFrameMetrics() {
PCompositorParent* compositor = GetSharedFrameMetricsCompositor();
// Only create the shared memory buffer if it hasn't already been created,
// we are using progressive tile painting, and we have a
// compositor to pass the shared memory back to the content process/thread.
- if (!mSharedFrameMetricsBuffer && compositor && gfxPlatform::GetPlatform()->UseProgressivePaint()) {
+ if (!mSharedFrameMetricsBuffer && compositor && gfxPlatform::GetPlatform()->SupportsCrossProcessMutex()) {
// Create shared memory and initialize it with the current FrameMetrics value
mSharedFrameMetricsBuffer = new ipc::SharedMemoryBasic;
FrameMetrics* frame = nullptr;
mSharedFrameMetricsBuffer->Create(sizeof(FrameMetrics));
mSharedFrameMetricsBuffer->Map(sizeof(FrameMetrics));
frame = static_cast<FrameMetrics*>(mSharedFrameMetricsBuffer->memory());
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -2179,17 +2179,18 @@ gfxPlatform::AsyncPanZoomEnabled()
#else
return gfxPrefs::AsyncPanZoomEnabledDoNotUseDirectly();
#endif
}
/*virtual*/ bool
gfxPlatform::UseProgressivePaint()
{
- return gfxPrefs::ProgressivePaintDoNotUseDirectly();
+ return SupportsCrossProcessMutex() &&
+ gfxPrefs::ProgressivePaintDoNotUseDirectly();
}
/*static*/ bool
gfxPlatform::PerfWarnings()
{
return gfxPrefs::PerfWarnings();
}
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -241,30 +241,32 @@ public:
* will return false.
*/
bool SupportsAzureContentForDrawTarget(mozilla::gfx::DrawTarget* aTarget);
bool SupportsAzureContentForType(mozilla::gfx::BackendType aType) {
return BackendTypeBit(aType) & mContentBackendBitmask;
}
+ virtual bool SupportsCrossProcessMutex() { return true; }
+
/// This function lets us know if the current preferences/platform
/// combination allows for both accelerated and not accelerated canvas
/// implementations. If it does, and other relevant preferences are
/// asking for it, we will examine the commands in the first few seconds
/// of the canvas usage, and potentially change to accelerated or
/// non-accelerated canvas.
virtual bool HaveChoiceOfHWAndSWCanvas();
virtual bool UseAcceleratedSkiaCanvas();
virtual void InitializeSkiaCacheLimits();
/// These should be used instead of directly accessing the preference,
/// as different platforms may override the behaviour.
- virtual bool UseProgressivePaint();
+ bool UseProgressivePaint();
static bool AsyncPanZoomEnabled();
virtual void GetAzureBackendInfo(mozilla::widget::InfoObject &aObj) {
aObj.DefineProperty("AzureCanvasBackend", GetBackendName(mPreferredCanvasBackend));
aObj.DefineProperty("AzureSkiaAccelerated", UseAcceleratedSkiaCanvas());
aObj.DefineProperty("AzureFallbackCanvasBackend", GetBackendName(mFallbackCanvasBackend));
aObj.DefineProperty("AzureContentBackend", GetBackendName(mContentBackend));
--- a/gfx/thebes/gfxPlatformMac.cpp
+++ b/gfx/thebes/gfxPlatformMac.cpp
@@ -429,21 +429,20 @@ gfxPlatformMac::ReadAntiAliasingThreshol
bool
gfxPlatformMac::UseAcceleratedCanvas()
{
// Lion or later is required
return nsCocoaFeatures::OnLionOrLater() && Preferences::GetBool("gfx.canvas.azure.accelerated", false);
}
bool
-gfxPlatformMac::UseProgressivePaint()
+gfxPlatformMac::SupportsCrossProcessMutex()
{
- // Progressive painting requires cross-process mutexes, which don't work so
- // well on OS X 10.6 so we disable there.
- return nsCocoaFeatures::OnLionOrLater() && gfxPlatform::UseProgressivePaint();
+ // Cross-process mutexes don't work so well on OS X 10.6.
+ return nsCocoaFeatures::OnLionOrLater();
}
bool
gfxPlatformMac::AccelerateLayersByDefault()
{
// 10.6.2 and lower have a bug involving textures and pixel buffer objects
// that caused bug 629016, so we don't allow OpenGL-accelerated layers on
// those versions of the OS.
--- a/gfx/thebes/gfxPlatformMac.h
+++ b/gfx/thebes/gfxPlatformMac.h
@@ -87,17 +87,18 @@ public:
// On OS X in a VM, unaccelerated CompositorOGL shows black flashes, so we
// require accelerated GL for CompositorOGL but allow unaccelerated GL for
// BasicCompositor.
return true;
}
bool UseAcceleratedCanvas();
- virtual bool UseProgressivePaint() override;
+ bool SupportsCrossProcessMutex() override;
+
virtual already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() override;
// lower threshold on font anti-aliasing
uint32_t GetAntiAliasingThreshold() { return mFontAntiAliasingThreshold; }
protected:
bool AccelerateLayersByDefault() override;