Backed out changeset 7a0d8feb1575 (bug 774388) for build failures during startup cache precompilation; CLOSED TREE

This commit is contained in:
Ed Morley 2014-06-06 16:01:43 +01:00
parent 7858f7a6b1
commit 1d75f87c67
16 changed files with 97 additions and 87 deletions

View File

@ -1710,7 +1710,8 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
// PBrowsers are created, because they rely on the Compositor
// already being around. (Creation is async, so can't happen
// on demand.)
if (gfxPlatform::UsesOffMainThreadCompositing()) {
bool useOffMainThreadCompositing = !!CompositorParent::CompositorLoop();
if (useOffMainThreadCompositing) {
DebugOnly<bool> opened = PCompositor::Open(this);
MOZ_ASSERT(opened);

View File

@ -1892,9 +1892,9 @@ TabParent::GetWidget() const
bool
TabParent::UseAsyncPanZoom()
{
return gfxPlatform::UsesOffMainThreadCompositing() &&
gfxPrefs::AsyncPanZoomEnabled() &&
GetScrollingBehavior() == ASYNC_PAN_ZOOM;
bool usingOffMainThreadCompositing = !!CompositorParent::CompositorLoop();
return (usingOffMainThreadCompositing && gfxPrefs::AsyncPanZoomEnabled() &&
GetScrollingBehavior() == ASYNC_PAN_ZOOM);
}
nsEventStatus

View File

@ -277,9 +277,6 @@ gfxPlatform::gfxPlatform()
uint32_t contentMask = BackendTypeBit(BackendType::CAIRO);
InitBackendPrefs(canvasMask, BackendType::CAIRO,
contentMask, BackendType::CAIRO);
mUsesOffMainThreadCompositing = ComputeUsesOffMainThreadCompositing();
mAlreadyShutDownLayersIPC = false;
}
gfxPlatform*
@ -367,12 +364,17 @@ gfxPlatform::Init()
mozilla::gl::GLContext::StaticInit();
#endif
if (UsesOffMainThreadCompositing() &&
XRE_GetProcessType() == GeckoProcessType_Default)
{
mozilla::layers::CompositorParent::StartUp();
bool useOffMainThreadCompositing = OffMainThreadCompositionRequired() ||
GetPrefLayersOffMainThreadCompositionEnabled();
if (!OffMainThreadCompositionRequired()) {
useOffMainThreadCompositing &= GetPlatform()->SupportsOffMainThreadCompositing();
}
if (useOffMainThreadCompositing && (XRE_GetProcessType() == GeckoProcessType_Default)) {
CompositorParent::StartUp();
if (gfxPrefs::AsyncVideoEnabled()) {
mozilla::layers::ImageBridgeChild::StartUp();
ImageBridgeChild::StartUp();
}
#ifdef MOZ_WIDGET_GONK
SharedBufferManagerChild::StartUp();
@ -442,9 +444,6 @@ gfxPlatform::Init()
void
gfxPlatform::Shutdown()
{
MOZ_ASSERT(gPlatform, "gfxPlatform already down!");
MOZ_ASSERT(gPlatform->mAlreadyShutDownLayersIPC, "ShutdownLayersIPC should have been called before this point!");
// These may be called before the corresponding subsystems have actually
// started up. That's OK, they can handle it.
gfxFontCache::Shutdown();
@ -507,25 +506,6 @@ gfxPlatform::Shutdown()
gPlatform = nullptr;
}
/* static */ void
gfxPlatform::ShutdownLayersIPC()
{
MOZ_ASSERT(!gPlatform->mAlreadyShutDownLayersIPC);
if (UsesOffMainThreadCompositing() &&
XRE_GetProcessType() == GeckoProcessType_Default)
{
// This must happen after the shutdown of media and widgets, which
// are triggered by the NS_XPCOM_SHUTDOWN_OBSERVER_ID notification.
layers::ImageBridgeChild::ShutDown();
#ifdef MOZ_WIDGET_GONK
layers::SharedBufferManagerChild::ShutDown();
#endif
layers::CompositorParent::ShutDown();
}
gPlatform->mAlreadyShutDownLayersIPC = true;
}
gfxPlatform::~gfxPlatform()
{
mScreenReferenceSurface = nullptr;
@ -552,6 +532,7 @@ gfxPlatform::~gfxPlatform()
bool
gfxPlatform::PreferMemoryOverShmem() const {
MOZ_ASSERT(!CompositorParent::IsInCompositorThread());
return mLayersPreferMemoryOverShmem;
}
@ -1561,7 +1542,9 @@ gfxPlatform::GetBackendPref(const char* aBackendPrefName, uint32_t &aBackendBitm
bool
gfxPlatform::OffMainThreadCompositingEnabled()
{
return UsesOffMainThreadCompositing();
return XRE_GetProcessType() == GeckoProcessType_Default ?
CompositorParent::CompositorLoop() != nullptr :
CompositorChild::ChildProcessHasCompositor();
}
eCMSMode
@ -2025,6 +2008,27 @@ InitLayersAccelerationPrefs()
}
}
bool
gfxPlatform::GetPrefLayersOffMainThreadCompositionEnabled()
{
InitLayersAccelerationPrefs();
return gfxPrefs::LayersOffMainThreadCompositionEnabled() ||
gfxPrefs::LayersOffMainThreadCompositionForceEnabled() ||
gfxPrefs::LayersOffMainThreadCompositionTestingEnabled();
}
bool gfxPlatform::OffMainThreadCompositionRequired()
{
InitLayersAccelerationPrefs();
#if defined(MOZ_WIDGET_GTK) && defined(NIGHTLY_BUILD)
// Linux users who chose OpenGL are being grandfathered in to OMTC
return sPrefBrowserTabsRemoteAutostart ||
gfxPrefs::LayersAccelerationForceEnabled();
#else
return sPrefBrowserTabsRemoteAutostart;
#endif
}
bool
gfxPlatform::CanUseDirect3D9()
{
@ -2071,25 +2075,3 @@ gfxPlatform::GetScaledFontForFontWithCairoSkia(DrawTarget* aTarget, gfxFont* aFo
return nullptr;
}
bool
gfxPlatform::ComputeUsesOffMainThreadCompositing()
{
InitLayersAccelerationPrefs();
bool result =
sPrefBrowserTabsRemoteAutostart ||
gfxPrefs::LayersOffMainThreadCompositionEnabled() ||
gfxPrefs::LayersOffMainThreadCompositionForceEnabled() ||
gfxPrefs::LayersOffMainThreadCompositionTestingEnabled();
#if defined(MOZ_WIDGET_GTK) && defined(NIGHTLY_BUILD)
// Linux users who chose OpenGL are being grandfathered in to OMTC
result |=
gfxPrefs::LayersAccelerationForceEnabled() ||
PR_GetEnv("MOZ_USE_OMTC") ||
PR_GetEnv("MOZ_OMTC_ENABLED"); // yeah, these two env vars do the same thing.
// I'm told that one of them is enabled on some test slaves config.
// so be slightly careful if you think you can
// remove one of them.
#endif
return result;
}

View File

@ -170,8 +170,6 @@ public:
*/
static void Shutdown();
static void ShutdownLayersIPC();
/**
* Create an offscreen surface of the given dimensions
* and image format.
@ -435,9 +433,16 @@ public:
static bool OffMainThreadCompositingEnabled();
/** Use gfxPlatform::GetPref* methods instead of direct calls to Preferences
* to get the values for layers preferences. These will only be evaluated
* only once, and remain the same until restart.
*/
static bool GetPrefLayersOffMainThreadCompositionEnabled();
static bool CanUseDirect3D9();
static bool CanUseDirect3D11();
static bool OffMainThreadCompositionRequired();
/**
* Is it possible to use buffer rotation. Note that these
* check the preference, but also allow for the override to
@ -544,10 +549,6 @@ public:
virtual bool IsInGonkEmulator() const { return false; }
static bool UsesOffMainThreadCompositing() {
return GetPlatform()->mUsesOffMainThreadCompositing;
}
protected:
gfxPlatform();
virtual ~gfxPlatform();
@ -617,13 +618,6 @@ protected:
// max number of entries in word cache
int32_t mWordCacheMaxEntries;
// Whether we use OMTC/OMPC (as opposed to main-thread compositing)
bool mUsesOffMainThreadCompositing;
// Whether ShutdownLayersIPC has alrady been called. Used to enforce that
// it is called before Shutdown.
bool mAlreadyShutDownLayersIPC;
private:
/**
* Start up Thebes.
@ -638,7 +632,7 @@ private:
virtual void GetPlatformCMSOutputProfile(void *&mem, size_t &size);
bool ComputeUsesOffMainThreadCompositing();
virtual bool SupportsOffMainThreadCompositing() { return true; }
nsRefPtr<gfxASurface> mScreenReferenceSurface;
mozilla::RefPtr<mozilla::gfx::DrawTarget> mScreenReferenceDrawTarget;

View File

@ -252,6 +252,18 @@ gfxPlatformGtk::GetScreenDepth() const
return sDepth;
}
bool
gfxPlatformGtk::SupportsOffMainThreadCompositing()
{
// Nightly builds have OMTC support by default for Electrolysis testing.
#if defined(MOZ_X11) && !defined(NIGHTLY_BUILD)
return (PR_GetEnv("MOZ_USE_OMTC") != nullptr) ||
(PR_GetEnv("MOZ_OMTC_ENABLED") != nullptr);
#else
return true;
#endif
}
void
gfxPlatformGtk::GetPlatformCMSOutputProfile(void *&mem, size_t &size)
{

View File

@ -98,6 +98,7 @@ protected:
private:
virtual void GetPlatformCMSOutputProfile(void *&mem, size_t &size);
virtual bool SupportsOffMainThreadCompositing();
#ifdef MOZ_X11
static bool sUseXRender;
#endif

View File

@ -435,6 +435,12 @@ gfxPlatformMac::UseAcceleratedCanvas()
return nsCocoaFeatures::OnLionOrLater() && Preferences::GetBool("gfx.canvas.azure.accelerated", false);
}
bool
gfxPlatformMac::SupportsOffMainThreadCompositing()
{
return true;
}
void
gfxPlatformMac::GetPlatformCMSOutputProfile(void* &mem, size_t &size)
{

View File

@ -72,6 +72,8 @@ public:
private:
virtual void GetPlatformCMSOutputProfile(void* &mem, size_t &size);
virtual bool SupportsOffMainThreadCompositing();
// read in the pref value for the lower threshold on font anti-aliasing
static uint32_t ReadAntiAliasingThreshold();

View File

@ -160,6 +160,17 @@ gfxQtPlatform::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
aFontData, aLength);
}
bool
gfxQtPlatform::SupportsOffMainThreadCompositing()
{
#if defined(MOZ_X11) && !defined(NIGHTLY_BUILD)
return (PR_GetEnv("MOZ_USE_OMTC") != nullptr) ||
(PR_GetEnv("MOZ_OMTC_ENABLED") != nullptr);
#else
return true;
#endif
}
bool
gfxQtPlatform::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
{

View File

@ -83,6 +83,8 @@ public:
virtual int GetScreenDepth() const MOZ_OVERRIDE;
virtual bool SupportsOffMainThreadCompositing() MOZ_OVERRIDE;
protected:
static gfxFontconfigUtils *sFontconfigUtils;

View File

@ -1380,8 +1380,8 @@ gfxWindowsPlatform::GetD3D9DeviceManager()
// We should only create the d3d9 device on the compositor thread
// or we don't have a compositor thread.
if (!mDeviceManager &&
(!gfxPlatform::UsesOffMainThreadCompositing() ||
CompositorParent::IsInCompositorThread())) {
(CompositorParent::IsInCompositorThread() ||
!CompositorParent::CompositorLoop())) {
mDeviceManager = new DeviceManagerD3D9();
if (!mDeviceManager->Init()) {
NS_WARNING("Could not initialise device manager");

View File

@ -71,6 +71,7 @@
#include "nsDOMBlobBuilder.h"
#include "nsDOMFileReader.h"
#include "gfxPlatform.h"
#include "nsFormData.h"
#include "nsHostObjectProtocolHandler.h"
#include "nsHostObjectURI.h"

View File

@ -737,7 +737,7 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader,
}
}
if (gfxPlatform::UsesOffMainThreadCompositing()) {
if (CompositorParent::CompositorLoop()) {
// Our remote frame will push layers updates to the compositor,
// and we'll keep an indirect reference to that tree.
*aId = mLayersId = CompositorParent::AllocateLayerTreeId();

View File

@ -998,8 +998,7 @@ MetroWidget::ShouldUseOffMainThreadCompositing()
return false;
}
// toolkit or test widgets can't use omtc, they don't have ICoreWindow.
return gfxPlatform::UsesOffMainThreadCompositing() &&
mWindowType == eWindowType_toplevel;
return (CompositorParent::CompositorLoop() && mWindowType == eWindowType_toplevel);
}
bool
@ -1009,8 +1008,7 @@ MetroWidget::ShouldUseMainThreadD3D10Manager()
if (!mView) {
return false;
}
return !gfxPlatform::UsesOffMainThreadCompositing() &&
mWindowType == eWindowType_toplevel;
return (!CompositorParent::CompositorLoop() && mWindowType == eWindowType_toplevel);
}
bool

View File

@ -888,9 +888,6 @@ CheckForBasicBackends(nsTArray<LayersBackend>& aHints)
void nsBaseWidget::CreateCompositor(int aWidth, int aHeight)
{
MOZ_ASSERT(gfxPlatform::UsesOffMainThreadCompositing(),
"This function assumes OMTC");
// Recreating this is tricky, as we may still have an old and we need
// to make sure it's properly destroyed by calling DestroyCompositor!
@ -949,7 +946,7 @@ void nsBaseWidget::CreateCompositor(int aWidth, int aHeight)
bool nsBaseWidget::ShouldUseOffMainThreadCompositing()
{
return gfxPlatform::UsesOffMainThreadCompositing();
return CompositorParent::CompositorLoop();
}
LayerManager* nsBaseWidget::GetLayerManager(PLayerTransactionChild* aShadowManager,

View File

@ -149,8 +149,6 @@ extern nsresult nsStringInputStreamConstructor(nsISupports *, REFNSIID, void **)
#include "jsapi.h"
#include "gfxPlatform.h"
using namespace mozilla;
using base::AtExitManager;
using mozilla::ipc::BrowserProcessSubThread;
@ -799,6 +797,13 @@ ShutdownXPCOM(nsIServiceManager* servMgr)
}
}
// This must happen after the shutdown of media and widgets, which
// are triggered by the NS_XPCOM_SHUTDOWN_OBSERVER_ID notification.
layers::ImageBridgeChild::ShutDown();
#ifdef MOZ_WIDGET_GONK
layers::SharedBufferManagerChild::ShutDown();
#endif
NS_ProcessPendingEvents(thread);
mozilla::scache::StartupCache::DeleteSingleton();
if (observerService)
@ -806,9 +811,7 @@ ShutdownXPCOM(nsIServiceManager* servMgr)
NotifyObservers(nullptr, NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID,
nullptr);
// This must happen after the shutdown of media and widgets, which
// are triggered by the NS_XPCOM_SHUTDOWN_OBSERVER_ID notification.
gfxPlatform::ShutdownLayersIPC();
layers::CompositorParent::ShutDown();
gXPCOMThreadsShutDown = true;
NS_ProcessPendingEvents(thread);