Bug 1072093 - Support progressive-paint on OS X 10.7 or later. r=BenWa

This commit is contained in:
Kartikaya Gupta 2014-11-07 14:17:14 -05:00
parent f1020af683
commit f0bd3fa57b
9 changed files with 18 additions and 15 deletions

View File

@ -112,15 +112,7 @@ pref("layout.reflow.synthMouseMove", false);
pref("layers.enable-tiles", true);
pref("layers.low-precision-buffer", true);
pref("layers.low-precision-opacity", "0.5");
/*
Cross Process Mutex is not supported on Mac OS X so progressive
paint cannot be enabled for B2G on Mac OS X desktop
*/
#ifdef MOZ_WIDGET_COCOA
pref("layers.progressive-paint", false);
#else
pref("layers.progressive-paint", true);
#endif
/* download manager (don't show the window or alert) */
pref("browser.download.useDownloadDir", true);

View File

@ -3048,7 +3048,7 @@ void AsyncPanZoomController::UpdateSharedCompositorFrameMetrics()
FrameMetrics* frame = mSharedFrameMetricsBuffer ?
static_cast<FrameMetrics*>(mSharedFrameMetricsBuffer->memory()) : nullptr;
if (frame && mSharedLock && gfxPrefs::UseProgressiveTilePainting()) {
if (frame && mSharedLock && gfxPlatform::GetPlatform()->UseProgressivePaint()) {
mSharedLock->Lock();
*frame = mFrameMetrics.MakePODObject();
mSharedLock->Unlock();
@ -3062,7 +3062,7 @@ void AsyncPanZoomController::ShareCompositorFrameMetrics() {
// 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 && gfxPrefs::UseProgressiveTilePainting()) {
if (!mSharedFrameMetricsBuffer && compositor && gfxPlatform::GetPlatform()->UseProgressivePaint()) {
// Create shared memory and initialize it with the current FrameMetrics value
mSharedFrameMetricsBuffer = new ipc::SharedMemoryBasic;

View File

@ -193,7 +193,7 @@ ClientTiledPaintedLayer::UseFastPath()
}
const FrameMetrics& parentMetrics = scrollAncestor.Metrics();
bool multipleTransactionsNeeded = gfxPrefs::UseProgressiveTilePainting()
bool multipleTransactionsNeeded = gfxPlatform::GetPlatform()->UseProgressivePaint()
|| gfxPrefs::UseLowPrecisionBuffer()
|| !parentMetrics.mCriticalDisplayPort.IsEmpty();
bool isFixed = GetIsFixedPosition() || GetParent()->GetIsFixedPosition();
@ -214,7 +214,7 @@ ClientTiledPaintedLayer::RenderHighPrecision(nsIntRegion& aInvalidRegion,
// Only draw progressively when the resolution is unchanged, and we're not
// in a reftest scenario (that's what the HasShadowManager() check is for).
if (gfxPrefs::UseProgressiveTilePainting() &&
if (gfxPlatform::GetPlatform()->UseProgressivePaint() &&
!ClientManager()->HasShadowTarget() &&
mContentClient->mTiledBuffer.GetFrameResolution() == mPaintData.mResolution) {
// Store the old valid region, then clear it before painting.

View File

@ -876,7 +876,7 @@ LayerManagerComposite::ComputeRenderIntegrity()
{
// We only ever have incomplete rendering when progressive tiles are enabled.
Layer* root = GetRoot();
if (!gfxPrefs::UseProgressiveTilePainting() || !root) {
if (!gfxPlatform::GetPlatform()->UseProgressivePaint() || !root) {
return 1.f;
}

View File

@ -263,9 +263,10 @@ public:
virtual bool UseAcceleratedSkiaCanvas();
virtual void InitializeSkiaCacheLimits();
/// This should be used instead of directly accessing the preference,
/// These should be used instead of directly accessing the preference,
/// as different platforms may override the behaviour.
virtual bool UseTiling() { return gfxPrefs::LayersTilesEnabledDoNotUseDirectly(); }
virtual bool UseProgressivePaint() { return gfxPrefs::ProgressivePaintDoNotUseDirectly(); }
void GetAzureBackendInfo(mozilla::widget::InfoObject &aObj) {
aObj.DefineProperty("AzureCanvasBackend", GetBackendName(mPreferredCanvasBackend));

View File

@ -411,6 +411,14 @@ gfxPlatformMac::UseTiling()
return nsCocoaFeatures::OnLionOrLater() && gfxPlatform::UseTiling();
}
bool
gfxPlatformMac::UseProgressivePaint()
{
// 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();
}
void
gfxPlatformMac::GetPlatformCMSOutputProfile(void* &mem, size_t &size)
{

View File

@ -71,6 +71,7 @@ public:
bool UseAcceleratedCanvas();
virtual bool UseTiling() MOZ_OVERRIDE;
virtual bool UseProgressivePaint() MOZ_OVERRIDE;
// lower threshold on font anti-aliasing
uint32_t GetAntiAliasingThreshold() { return mFontAntiAliasingThreshold; }

View File

@ -293,7 +293,7 @@ private:
DECL_GFX_PREF(Live, "layers.orientation.sync.timeout", OrientationSyncMillis, uint32_t, (uint32_t)0);
DECL_GFX_PREF(Once, "layers.prefer-d3d9", LayersPreferD3D9, bool, false);
DECL_GFX_PREF(Once, "layers.prefer-opengl", LayersPreferOpenGL, bool, false);
DECL_GFX_PREF(Once, "layers.progressive-paint", UseProgressiveTilePainting, bool, false);
DECL_GFX_PREF(Once, "layers.progressive-paint", ProgressivePaintDoNotUseDirectly, bool, false);
DECL_GFX_PREF(Once, "layers.uniformity-info", UniformityInfo, bool, false);
DECL_GFX_PREF(Once, "layers.gralloc.disable", DisableGralloc, bool, false);

View File

@ -3906,6 +3906,7 @@ pref("layers.frame-counter", false);
pref("layers.enable-tiles", false);
pref("layers.tiled-drawtarget.enabled", false);
pref("layers.low-precision-buffer", false);
pref("layers.progressive-paint", false);
pref("layers.tile-width", 256);
pref("layers.tile-height", 256);
// Max number of layers per container. See Overwrite in mobile prefs.