Back out 4 csets from bug 1326421 because of various test failures. r=backout

This commit is contained in:
Kartikaya Gupta 2017-01-13 17:07:59 -05:00
parent 7e0247dbdd
commit 1f97dac250
21 changed files with 64 additions and 134 deletions

View File

@ -425,14 +425,6 @@ TabChild::TabChild(nsIContentChild* aManager,
}
}
const CompositorOptions&
TabChild::GetCompositorOptions() const
{
// If you're calling this before mCompositorOptions is set, well.. don't.
MOZ_ASSERT(mCompositorOptions);
return mCompositorOptions.ref();
}
bool
TabChild::AsyncPanZoomEnabled() const
{
@ -2319,6 +2311,11 @@ TabChild::RecvSetDocShellIsActive(const bool& aIsActive,
}
mLayerObserverEpoch = aLayerObserverEpoch;
MOZ_ASSERT(mPuppetWidget);
MOZ_ASSERT(mPuppetWidget->GetLayerManager());
MOZ_ASSERT(mPuppetWidget->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT
|| mPuppetWidget->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_WR);
auto clearForcePaint = MakeScopeExit([&] {
// We might force a paint, or we might already have painted and this is a
// no-op. In either case, once we exit this scope, we need to alert the
@ -2330,21 +2327,10 @@ TabChild::RecvSetDocShellIsActive(const bool& aIsActive,
}
});
if (mCompositorOptions) {
// Note that |GetLayerManager()| has side-effects in that it creates a layer
// manager if one doesn't exist already. Calling it inside a debug-only
// assertion is generally bad but in this case we call it unconditionally
// just below so it's ok.
MOZ_ASSERT(mPuppetWidget);
MOZ_ASSERT(mPuppetWidget->GetLayerManager());
MOZ_ASSERT(mPuppetWidget->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT
|| mPuppetWidget->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_WR);
// We send the current layer observer epoch to the compositor so that
// TabParent knows whether a layer update notification corresponds to the
// latest SetDocShellIsActive request that was made.
mPuppetWidget->GetLayerManager()->SetLayerObserverEpoch(aLayerObserverEpoch);
}
// docshell is consider prerendered only if not active yet
mIsPrerendered &= !aIsActive;

View File

@ -618,7 +618,6 @@ public:
return mParentIsActive;
}
const mozilla::layers::CompositorOptions& GetCompositorOptions() const;
bool AsyncPanZoomEnabled() const;
virtual ScreenIntSize GetInnerSize() override;

View File

@ -34,8 +34,7 @@ public:
static bool
FindFBConfigForWindow(Display* display, int screen, Window window,
ScopedXFree<GLXFBConfig>* const out_scopedConfigArr,
GLXFBConfig* const out_config, int* const out_visid,
bool aWebRender);
GLXFBConfig* const out_config, int* const out_visid);
~GLContextGLX();

View File

@ -13,7 +13,6 @@
#include "prenv.h"
#include "GeckoProfiler.h"
#include "mozilla/gfx/MacIOSurface.h"
#include "mozilla/layers/CompositorOptions.h"
#include "mozilla/widget/CompositorWidget.h"
#include <OpenGL/OpenGL.h>
@ -249,15 +248,11 @@ CreateWithFormat(const NSOpenGLPixelFormatAttribute* attribs)
already_AddRefed<GLContext>
GLContextProviderCGL::CreateForCompositorWidget(CompositorWidget* aCompositorWidget, bool aForceAccelerated)
{
return CreateForWindow(aCompositorWidget->RealWidget(),
aCompositorWidget->GetCompositorOptions().UseWebRender(),
aForceAccelerated);
return CreateForWindow(aCompositorWidget->RealWidget(), aForceAccelerated);
}
already_AddRefed<GLContext>
GLContextProviderCGL::CreateForWindow(nsIWidget* aWidget,
bool aWebRender,
bool aForceAccelerated)
GLContextProviderCGL::CreateForWindow(nsIWidget* aWidget, bool aForceAccelerated)
{
if (!sCGLLibrary.EnsureInitialized()) {
return nullptr;
@ -271,7 +266,7 @@ GLContextProviderCGL::CreateForWindow(nsIWidget* aWidget,
const NSOpenGLPixelFormatAttribute* attribs;
if (sCGLLibrary.UseDoubleBufferedWindows()) {
if (aWebRender) {
if (gfxPrefs::WebRenderEnabled()) {
attribs = aForceAccelerated ? kAttribs_doubleBuffered_accel_webrender : kAttribs_doubleBuffered;
} else {
attribs = aForceAccelerated ? kAttribs_doubleBuffered_accel : kAttribs_doubleBuffered;

View File

@ -11,7 +11,6 @@
#include "gfxFailure.h"
#include "prenv.h"
#include "mozilla/Preferences.h"
#include "mozilla/layers/CompositorOptions.h"
#include "mozilla/widget/CompositorWidget.h"
#include "GeckoProfiler.h"
@ -211,15 +210,11 @@ CreateEAGLContext(CreateContextFlags flags, bool aOffscreen, GLContextEAGL* shar
already_AddRefed<GLContext>
GLContextProviderEAGL::CreateForCompositorWidget(CompositorWidget* aCompositorWidget, bool aForceAccelerated)
{
return CreateForWindow(aCompositorWidget->RealWidget(),
aCompositorWidget->GetCompositorOptions().UseWebRender(),
aForceAccelerated);
return CreateForWindow(aCompositorWidget->RealWidget(), aForceAccelerated);
}
already_AddRefed<GLContext>
GLContextProviderEAGL::CreateForWindow(nsIWidget* aWidget,
bool aWebRender,
bool aForceAccelerated)
GLContextProviderEAGL::CreateForWindow(nsIWidget* aWidget, bool aForceAccelerated)
{
RefPtr<GLContext> glContext = CreateEAGLContext(CreateContextFlags::NONE, false,
GetGlobalContextEAGL());

View File

@ -89,7 +89,6 @@
#include "GLLibraryEGL.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/layers/CompositorOptions.h"
#include "mozilla/widget/CompositorWidget.h"
#include "nsDebug.h"
#include "nsIWidget.h"
@ -711,15 +710,11 @@ GLContextProviderEGL::CreateWrappingExisting(void* aContext, void* aSurface)
already_AddRefed<GLContext>
GLContextProviderEGL::CreateForCompositorWidget(CompositorWidget* aCompositorWidget, bool aForceAccelerated)
{
return CreateForWindow(aCompositorWidget->RealWidget(),
aCompositorWidget->GetCompositorOptions().UseWebRender(),
aForceAccelerated);
return CreateForWindow(aCompositorWidget->RealWidget(), aForceAccelerated);
}
already_AddRefed<GLContext>
GLContextProviderEGL::CreateForWindow(nsIWidget* aWidget,
bool aWebRender,
bool aForceAccelerated)
GLContextProviderEGL::CreateForWindow(nsIWidget* aWidget, bool aForceAccelerated)
{
nsCString discardFailureId;
if (!sEGLLibrary.EnsureInitialized(false, &discardFailureId)) {
@ -742,7 +737,7 @@ GLContextProviderEGL::CreateForWindow(nsIWidget* aWidget,
}
CreateContextFlags flags = CreateContextFlags::NONE;
if (aWebRender) {
if (gfxPrefs::WebRenderEnabled()) {
flags |= CreateContextFlags::PREFER_ES3;
}
SurfaceCaps caps = SurfaceCaps::Any();

View File

@ -15,7 +15,6 @@
#include "mozilla/MathAlgorithms.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/layers/CompositorOptions.h"
#include "mozilla/widget/CompositorWidget.h"
#include "mozilla/widget/X11CompositorWidget.h"
#include "mozilla/Unused.h"
@ -1100,9 +1099,7 @@ GLContextProviderGLX::CreateWrappingExisting(void* aContext, void* aSurface)
}
already_AddRefed<GLContext>
CreateForWidget(Display* aXDisplay, Window aXWindow,
bool aWebRender,
bool aForceAccelerated)
CreateForWidget(Display* aXDisplay, Window aXWindow, bool aForceAccelerated)
{
if (!sGLXLibrary.EnsureInitialized()) {
return nullptr;
@ -1126,7 +1123,7 @@ CreateForWidget(Display* aXDisplay, Window aXWindow,
GLXFBConfig config;
int visid;
if (!GLContextGLX::FindFBConfigForWindow(aXDisplay, xscreen, aXWindow, &cfgs,
&config, &visid, aWebRender))
&config, &visid))
{
return nullptr;
}
@ -1134,7 +1131,7 @@ CreateForWidget(Display* aXDisplay, Window aXWindow,
SurfaceCaps caps = SurfaceCaps::Any();
GLContextGLX* shareContext = GetGlobalContextGLX();
RefPtr<GLContextGLX> gl;
if (aWebRender) {
if (gfxPrefs::WebRenderEnabled()) {
gl = GLContextGLX::CreateGLContext(CreateContextFlags::NONE,
caps, shareContext, false,
aXDisplay, aXWindow, config,
@ -1158,21 +1155,17 @@ GLContextProviderGLX::CreateForCompositorWidget(CompositorWidget* aCompositorWid
return CreateForWidget(compWidget->XDisplay(),
compWidget->XWindow(),
compWidget->GetCompositorOptions().UseWebRender(),
aForceAccelerated);
}
already_AddRefed<GLContext>
GLContextProviderGLX::CreateForWindow(nsIWidget* aWidget,
bool aWebRender,
bool aForceAccelerated)
GLContextProviderGLX::CreateForWindow(nsIWidget* aWidget, bool aForceAccelerated)
{
Display* display = (Display*)aWidget->GetNativeData(NS_NATIVE_COMPOSITOR_DISPLAY);
Window window = GET_NATIVE_WINDOW(aWidget);
return CreateForWidget(display,
window,
aWebRender,
aForceAccelerated);
}
@ -1236,8 +1229,7 @@ ChooseConfig(GLXLibrary* glx, Display* display, int screen, const SurfaceCaps& m
bool
GLContextGLX::FindFBConfigForWindow(Display* display, int screen, Window window,
ScopedXFree<GLXFBConfig>* const out_scopedConfigArr,
GLXFBConfig* const out_config, int* const out_visid,
bool aWebRender)
GLXFBConfig* const out_config, int* const out_visid)
{
ScopedXFree<GLXFBConfig>& cfgs = *out_scopedConfigArr;
int numConfigs;
@ -1253,7 +1245,7 @@ GLContextGLX::FindFBConfigForWindow(Display* display, int screen, Window window,
0
};
if (aWebRender) {
if (gfxPrefs::WebRenderEnabled()) {
cfgs = sGLXLibrary.xChooseFBConfig(display,
screen,
webrenderAttribs,
@ -1271,7 +1263,7 @@ GLContextGLX::FindFBConfigForWindow(Display* display, int screen, Window window,
0
};
if (aWebRender) {
if (gfxPrefs::WebRenderEnabled()) {
cfgs = sGLXLibrary.xChooseFBConfig(display,
screen,
webrenderAttribs,
@ -1302,7 +1294,7 @@ GLContextGLX::FindFBConfigForWindow(Display* display, int screen, Window window,
printf("[GLX] window %lx has VisualID 0x%lx\n", window, windowVisualID);
#endif
if (aWebRender) {
if (gfxPrefs::WebRenderEnabled()) {
for (int i = 0; i < numConfigs; i++) {
int visid = X11None;
sGLXLibrary.xGetFBConfigAttrib(display, cfgs[i], LOCAL_GLX_VISUAL_ID, &visid);

View File

@ -61,13 +61,12 @@ public:
* a GL layer manager.
*
* @param aWidget Widget whose surface to create a context for
* @param aWebRender If the compositor is a WebRender compositor
* @param aForceAccelerated true if only accelerated contexts are allowed
*
* @return Context to use for the window
*/
static already_AddRefed<GLContext>
CreateForWindow(nsIWidget* aWidget, bool aWebRender, bool aForceAccelerated);
CreateForWindow(nsIWidget* aWidget, bool aForceAccelerated);
/**
* Create a context for offscreen rendering. The target of this

View File

@ -17,9 +17,7 @@ GLContextProviderNull::CreateForCompositorWidget(CompositorWidget* aCompositorWi
}
already_AddRefed<GLContext>
GLContextProviderNull::CreateForWindow(nsIWidget* aWidget,
bool aWebRender,
bool aForceAccelerated)
GLContextProviderNull::CreateForWindow(nsIWidget* aWidget, bool aForceAccelerated)
{
return nullptr;
}

View File

@ -18,7 +18,6 @@
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/Preferences.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/layers/CompositorOptions.h"
#include "mozilla/widget/CompositorWidget.h"
namespace mozilla {
@ -56,6 +55,11 @@ WGLLibrary::CreateDummyWindow(HDC* aWindowDC)
NS_ENSURE_TRUE(dc, nullptr);
if (mWindowPixelFormat == 0) {
int depthBits = 0;
if (gfxPrefs::WebRenderEnabled()) {
depthBits = 24;
}
PIXELFORMATDESCRIPTOR pfd;
ZeroMemory(&pfd, sizeof(PIXELFORMATDESCRIPTOR));
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
@ -67,15 +71,7 @@ WGLLibrary::CreateDummyWindow(HDC* aWindowDC)
pfd.cGreenBits = 8;
pfd.cBlueBits = 8;
pfd.cAlphaBits = 8;
#ifdef MOZ_ENABLE_WEBRENDER
// XXX We might need to set this to 0 if the compositor that requires
// this context is not a WebRender compositor. Getting the
// CompositorOptions here is nontrivial though so for now we just use
// the ifdef guard.
pfd.cDepthBits = 24;
#else
pfd.cDepthBits = 0;
#endif
pfd.cDepthBits = depthBits;
pfd.iLayerType = PFD_MAIN_PLANE;
mWindowPixelFormat = ChoosePixelFormat(dc, &pfd);
@ -445,15 +441,11 @@ GLContextProviderWGL::CreateWrappingExisting(void*, void*)
already_AddRefed<GLContext>
GLContextProviderWGL::CreateForCompositorWidget(CompositorWidget* aCompositorWidget, bool aForceAccelerated)
{
return CreateForWindow(aCompositorWidget->RealWidget(),
aCompositorWidget->GetCompositorOptions().UseWebRender(),
aForceAccelerated);
return CreateForWindow(aCompositorWidget->RealWidget(), aForceAccelerated);
}
already_AddRefed<GLContext>
GLContextProviderWGL::CreateForWindow(nsIWidget* aWidget,
bool aWebRender,
bool aForceAccelerated)
GLContextProviderWGL::CreateForWindow(nsIWidget* aWidget, bool aForceAccelerated)
{
if (!sWGLLib.EnsureInitialized()) {
return nullptr;

View File

@ -150,11 +150,7 @@ IsAccelAngleSupported(const nsCOMPtr<nsIGfxInfo>& gfxInfo,
nsACString* const out_failureId)
{
if (CompositorThreadHolder::IsInCompositorThread()) {
// We can only enter here with WebRender, so assert that this is a
// WebRender-enabled build.
#ifndef MOZ_ENABLE_WEBRENDER
MOZ_ASSERT(false);
#endif
MOZ_ASSERT(gfxPrefs::WebRenderEnabled());
return true;
}
int32_t angleSupport;

View File

@ -31,25 +31,20 @@ public:
// This constructor needed for IPDL purposes, don't use it anywhere else.
CompositorOptions()
: mUseAPZ(false)
, mUseWebRender(false)
{
}
explicit CompositorOptions(bool aUseAPZ,
bool aUseWebRender)
explicit CompositorOptions(bool aUseAPZ)
: mUseAPZ(aUseAPZ)
, mUseWebRender(aUseWebRender)
{
}
bool UseAPZ() const { return mUseAPZ; }
bool UseWebRender() const { return mUseWebRender; }
friend struct IPC::ParamTraits<CompositorOptions>;
private:
bool mUseAPZ;
bool mUseWebRender;
// Make sure to add new fields to the ParamTraits implementation
};

View File

@ -1326,12 +1326,10 @@ struct ParamTraits<mozilla::layers::CompositorOptions>
static void Write(Message* aMsg, const paramType& aParam) {
WriteParam(aMsg, aParam.mUseAPZ);
WriteParam(aMsg, aParam.mUseWebRender);
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
return ReadParam(aMsg, aIter, &aResult->mUseAPZ)
&& ReadParam(aMsg, aIter, &aResult->mUseWebRender);
return ReadParam(aMsg, aIter, &aResult->mUseAPZ);
}
};

View File

@ -390,7 +390,7 @@ CompositorBridgeParent::Initialize()
LayerScope::SetPixelScale(mScale.scale);
if (!mOptions.UseWebRender()) {
if (!gfxPrefs::WebRenderEnabled()) {
mCompositorScheduler = new CompositorVsyncScheduler(this, mWidget);
}
}

View File

@ -940,9 +940,9 @@ gfxPlatform::InitLayersIPC()
if (XRE_IsParentProcess())
{
#ifdef MOZ_ENABLE_WEBRENDER
if (gfxPrefs::WebRenderEnabled()) {
RenderThread::Start();
#endif
}
layers::CompositorThreadHolder::Start();
}
}
@ -969,9 +969,9 @@ gfxPlatform::ShutdownLayersIPC()
// This has to happen after shutting down the child protocols.
layers::CompositorThreadHolder::Shutdown();
#ifdef MOZ_ENABLE_WEBRENDER
if (gfxPrefs::WebRenderEnabled()) {
RenderThread::ShutDown();
#endif
}
} else {
// TODO: There are other kind of processes and we should make sure gfx
// stuff is either not created there or shut down properly.
@ -2223,12 +2223,10 @@ gfxPlatform::InitGPUProcessPrefs()
return;
}
#ifdef MOZ_ENABLE_WEBRENDER
// XXX disable GPU proces when webrender is enabled for now. See bug 1321527.
if (true) {
// XXX disable GPU proces when webrender is enabled for now.
if (gfxPrefs::WebRenderEnabled()) {
return;
}
#endif
FeatureState& gpuProc = gfxConfig::GetFeature(Feature::GPU_PROCESS);
@ -2468,6 +2466,12 @@ gfxPlatform::AsyncPanZoomEnabled()
if (!BrowserTabsRemoteAutostart()) {
return false;
}
#ifdef MOZ_ENABLE_WEBRENDER
// For webrender hacking we have a special pref to disable APZ even with e10s
if (gfxPrefs::WebRenderEnabled() && !gfxPrefs::APZAllowWithWebRender()) {
return false;
}
#endif // MOZ_ENABLE_WEBRENDER
#endif
#ifdef MOZ_WIDGET_ANDROID
return true;

View File

@ -735,10 +735,8 @@ public:
ScopedXFree<GLXFBConfig> cfgs;
GLXFBConfig config;
int visid;
bool forWebRender = false;
if (!gl::GLContextGLX::FindFBConfigForWindow(mXDisplay, screen, root,
&cfgs, &config, &visid,
forWebRender)) {
&cfgs, &config, &visid)) {
lock.NotifyAll();
return;
}

View File

@ -426,10 +426,10 @@ private:
DECL_GFX_PREF(Once, "gfx.work-around-driver-bugs", WorkAroundDriverBugs, bool, true);
DECL_GFX_PREF(Once, "gfx.screen-mirroring.enabled", ScreenMirroringEnabled, bool, false);
#ifdef MOZ_ENABLE_WEBRENDER
DECL_GFX_PREF(Live, "gfx.webrender.enabled", WebRenderEnabledDoNotUseDirectly, bool, false);
DECL_GFX_PREF(Once, "gfx.webrender.enabled", WebRenderEnabled, bool, false);
#else
public:
static bool WebRenderEnabledDoNotUseDirectly() { return false; }
static bool WebRenderEnabled() { return false; }
private:
#endif

View File

@ -585,7 +585,7 @@ PuppetWidget::GetLayerManager(PLayerTransactionChild* aShadowManager,
LayerManagerPersistence aPersistence)
{
if (!mLayerManager) {
if (mTabChild->GetCompositorOptions().UseWebRender()) {
if (gfxPrefs::WebRenderEnabled()) {
mLayerManager = new WebRenderLayerManager(this);
} else {
mLayerManager = new ClientLayerManager(this);
@ -601,7 +601,7 @@ PuppetWidget::GetLayerManager(PLayerTransactionChild* aShadowManager,
LayerManager*
PuppetWidget::RecreateLayerManager(PLayerTransactionChild* aShadowManager)
{
if (mTabChild->GetCompositorOptions().UseWebRender()) {
if (gfxPrefs::WebRenderEnabled()) {
mLayerManager = new WebRenderLayerManager(this);
} else {
mLayerManager = new ClientLayerManager(this);

View File

@ -279,7 +279,7 @@ public:
{
// Contrary to CompositorOGL, we allow unaccelerated OpenGL contexts to be
// used. BasicCompositor only requires very basic GL functionality.
RefPtr<GLContext> context = gl::GLContextProvider::CreateForWindow(aWindow, false, false);
RefPtr<GLContext> context = gl::GLContextProvider::CreateForWindow(aWindow, false);
return context ? MakeUnique<GLPresenter>(context) : nullptr;
}

View File

@ -1298,26 +1298,15 @@ void nsBaseWidget::CreateCompositor(int aWidth, int aHeight)
CreateCompositorVsyncDispatcher();
// For now we decide whether or not to enable WR on this widget by the current
// value of the pref (this is the only place in the code allowed to check the
// value of the pref). We might want to change this eventually and drop the
// pref entirely.
bool enableWR = gfxPrefs::WebRenderEnabledDoNotUseDirectly();
bool enableAPZ = UseAPZ();
if (enableWR && !gfxPrefs::APZAllowWithWebRender()) {
// Disable APZ on widgets using WebRender, since it doesn't work yet. Allow
// it on non-WR widgets or if the pref forces it on.
enableAPZ = false;
}
CompositorOptions options(enableAPZ, enableWR);
RefPtr<LayerManager> lm;
if (options.UseWebRender()) {
if (gfxPrefs::WebRenderEnabled()) {
lm = new WebRenderLayerManager(this);
} else {
lm = new ClientLayerManager(this);
}
CompositorOptions options(UseAPZ());
gfx::GPUProcessManager* gpu = gfx::GPUProcessManager::Get();
mCompositorSession = gpu->CreateTopLevelCompositor(
this,

View File

@ -3910,7 +3910,7 @@ nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager,
reinterpret_cast<uintptr_t>(static_cast<nsIWidget*>(this)),
mTransparencyMode);
// If we're not using the compositor, the options don't actually matter.
CompositorOptions options(false, false);
CompositorOptions options(false);
mBasicLayersSurface = new InProcessWinCompositorWidget(initData, options, this);
mCompositorWidgetDelegate = mBasicLayersSurface;
mLayerManager = CreateBasicLayerManager();