Backed out changeset d139f68fd874 (bug 1500017) for build bustages on RenderCompositorANGLE.cpp

This commit is contained in:
Cosmin Sabou 2018-11-05 09:36:05 +02:00
Родитель e56fb1f874
Коммит 411aca55f1
12 изменённых файлов: 24 добавлений и 116 удалений

Просмотреть файл

@ -40,7 +40,6 @@ class gfxVarReceiver;
_(UseWebRender, bool, false) \
_(UseWebRenderANGLE, bool, false) \
_(UseWebRenderDCompWin, bool, false) \
_(UseWebRenderDCompWinTripleBuffering, bool, false) \
_(UseWebRenderProgramBinary, bool, false) \
_(UseWebRenderProgramBinaryDisk, bool, false) \
_(WebRenderDebugFlags, int32_t, 0) \

Просмотреть файл

@ -31,7 +31,6 @@ AsyncImagePipelineManager::AsyncImagePipeline::AsyncImagePipeline()
AsyncImagePipelineManager::AsyncImagePipelineManager(already_AddRefed<wr::WebRenderAPI>&& aApi)
: mApi(aApi)
, mIdNamespace(mApi->GetNamespace())
, mUseTripleBuffering(mApi->GetUseTripleBuffering())
, mResourceId(0)
, mAsyncImageEpoch{0}
, mWillGenerateFrame(false)
@ -551,6 +550,8 @@ AsyncImagePipelineManager::NotifyPipelinesUpdated(wr::WrPipelineInfo aInfo, bool
MOZ_ASSERT(wr::RenderThread::IsInRenderThread());
// Increment the count when render happens.
// XXX The count is going to be used to delay releasing TextureHosts for multiple rendering.
// See Bug 1500017.
uint64_t currCount = aRender ? ++mUpdatesCount : mUpdatesCount;
auto updates = MakeUnique<PipelineUpdates>(currCount, aRender);
@ -629,16 +630,15 @@ AsyncImagePipelineManager::ProcessPipelineUpdates()
updates->mQueue.pop();
if (epoch.isSome()) {
ProcessPipelineRendered(pipelineId, *epoch, updates->mUpdatesCount);
ProcessPipelineRendered(pipelineId, *epoch);
} else {
ProcessPipelineRemoved(pipelineId, updates->mUpdatesCount);
ProcessPipelineRemoved(pipelineId);
}
}
CheckForTextureHostsNotUsedByGPU();
}
void
AsyncImagePipelineManager::ProcessPipelineRendered(const wr::PipelineId& aPipelineId, const wr::Epoch& aEpoch, const uint64_t aUpdatesCount)
AsyncImagePipelineManager::ProcessPipelineRendered(const wr::PipelineId& aPipelineId, const wr::Epoch& aEpoch)
{
if (auto entry = mPipelineTexturesHolders.Lookup(wr::AsUint64(aPipelineId))) {
PipelineTexturesHolder* holder = entry.Data();
@ -647,8 +647,6 @@ AsyncImagePipelineManager::ProcessPipelineRendered(const wr::PipelineId& aPipeli
if (aEpoch <= holder->mTextureHosts.front().mEpoch) {
break;
}
// Need to extend holding TextureHost if it is direct bounded texture.
HoldUntilNotUsedByGPU(holder->mTextureHosts.front().mTexture, aUpdatesCount);
holder->mTextureHosts.pop();
}
while (!holder->mTextureHostWrappers.empty()) {
@ -670,7 +668,7 @@ AsyncImagePipelineManager::ProcessPipelineRendered(const wr::PipelineId& aPipeli
}
void
AsyncImagePipelineManager::ProcessPipelineRemoved(const wr::PipelineId& aPipelineId, const uint64_t aUpdatesCount)
AsyncImagePipelineManager::ProcessPipelineRemoved(const wr::PipelineId& aPipelineId)
{
if (mDestroyed) {
return;
@ -678,11 +676,6 @@ AsyncImagePipelineManager::ProcessPipelineRemoved(const wr::PipelineId& aPipelin
if (auto entry = mPipelineTexturesHolders.Lookup(wr::AsUint64(aPipelineId))) {
PipelineTexturesHolder* holder = entry.Data();
if (holder->mDestroyedEpoch.isSome()) {
while (!holder->mTextureHosts.empty()) {
// Need to extend holding TextureHost if it is direct bounded texture.
HoldUntilNotUsedByGPU(holder->mTextureHosts.front().mTexture, aUpdatesCount);
holder->mTextureHosts.pop();
}
// Explicitly release all of the shared surfaces.
while (!holder->mExternalImages.empty()) {
DebugOnly<bool> released =
@ -699,39 +692,6 @@ AsyncImagePipelineManager::ProcessPipelineRemoved(const wr::PipelineId& aPipelin
}
}
void
AsyncImagePipelineManager::HoldUntilNotUsedByGPU(const CompositableTextureHostRef& aTextureHost, uint64_t aUpdatesCount)
{
MOZ_ASSERT(aTextureHost);
if (aTextureHost->HasIntermediateBuffer()) {
// If texutre is not direct binding texture, gpu has already finished using it.
// We could release it now.
return;
}
// When Triple buffer is used, we need wait one more WebRender rendering,
if (mUseTripleBuffering) {
++aUpdatesCount;
}
mTexturesInUseByGPU.emplace(
std::make_pair(aUpdatesCount, aTextureHost));
}
void
AsyncImagePipelineManager::CheckForTextureHostsNotUsedByGPU()
{
uint64_t currCount = mUpdatesCount;
while (!mTexturesInUseByGPU.empty()) {
if (currCount <= mTexturesInUseByGPU.front().first) {
break;
}
mTexturesInUseByGPU.pop();
}
}
wr::Epoch
AsyncImagePipelineManager::GetNextImageEpoch()
{

Просмотреть файл

@ -115,8 +115,8 @@ public:
wr::ExternalImageId GetNextExternalImageId();
private:
void ProcessPipelineRendered(const wr::PipelineId& aPipelineId, const wr::Epoch& aEpoch, const uint64_t aUpdatesCount);
void ProcessPipelineRemoved(const wr::PipelineId& aPipelineId, const uint64_t aUpdatesCount);
void ProcessPipelineRendered(const wr::PipelineId& aPipelineId, const wr::Epoch& aEpoch);
void ProcessPipelineRemoved(const wr::PipelineId& aPipelineId);
wr::Epoch GetNextImageEpoch();
uint32_t GetNextResourceId() { return ++mResourceId; }
@ -216,13 +216,8 @@ private:
TextureHost::ResourceUpdateOp,
wr::TransactionBuilder& aTxn);
// If texture is direct binding texture, keep it until it is not used by GPU.
void HoldUntilNotUsedByGPU(const CompositableTextureHostRef& aTextureHost, uint64_t aUpdatesCount);
void CheckForTextureHostsNotUsedByGPU();
RefPtr<wr::WebRenderAPI> mApi;
const wr::IdNamespace mIdNamespace;
const bool mUseTripleBuffering;
wr::IdNamespace mIdNamespace;
uint32_t mResourceId;
nsClassHashtable<nsUint64HashKey, PipelineTexturesHolder> mPipelineTexturesHolders;
@ -252,6 +247,8 @@ private:
{}
bool NeedsToWait(const uint64_t aUpdatesCount) {
MOZ_ASSERT(mUpdatesCount <= aUpdatesCount);
// XXX Add support of delaying releasing TextureHosts for multiple rendering.
// See Bug 1500017.
if (mUpdatesCount == aUpdatesCount && !mRendered) {
// RenderTextureHosts related to this might be still used by GPU.
return true;
@ -268,9 +265,6 @@ private:
std::queue<std::pair<wr::PipelineId, Maybe<wr::Epoch>>> mQueue;
};
std::queue<UniquePtr<PipelineUpdates>> mUpdatesQueues;
// Queue to store TextureHosts that might still be used by GPU.
std::queue<std::pair<uint64_t, CompositableTextureHostRef>> mTexturesInUseByGPU;
};
} // namespace layers

Просмотреть файл

@ -135,13 +135,6 @@ WebRenderTextureHost::GetRGBStride()
return ImageDataSerializer::ComputeRGBStride(format, GetSize().width);
}
bool
WebRenderTextureHost::HasIntermediateBuffer() const
{
MOZ_ASSERT(mWrappedTextureHost);
return mWrappedTextureHost->HasIntermediateBuffer();
}
uint32_t
WebRenderTextureHost::NumSubTextures() const
{

Просмотреть файл

@ -64,8 +64,6 @@ public:
int32_t GetRGBStride();
virtual bool HasIntermediateBuffer() const override;
virtual uint32_t NumSubTextures() const override;
virtual void PushResourceUpdates(wr::TransactionBuilder& aResources,

Просмотреть файл

@ -2863,11 +2863,6 @@ gfxPlatform::InitWebRenderConfig()
gfxVars::SetUseWebRenderDCompWin(true);
}
}
if (Preferences::GetBool("gfx.webrender.dcomp-win-triple-buffering.enabled", false)) {
if (gfxVars::UseWebRenderDCompWin()) {
gfxVars::SetUseWebRenderDCompWinTripleBuffering(true);
}
}
#endif
}

Просмотреть файл

@ -48,8 +48,6 @@ public:
virtual bool UseDComp() const { return false; }
virtual bool UseTripleBuffering() const { return false; }
virtual LayoutDeviceIntSize GetBufferSize() = 0;
widget::CompositorWidget* GetWidget() const { return mWidget; }

Просмотреть файл

@ -10,7 +10,6 @@
#include "GLContextEGL.h"
#include "GLContextProvider.h"
#include "mozilla/gfx/DeviceManagerDx.h"
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/gfx/Logging.h"
#include "mozilla/layers/HelpersD3D11.h"
#include "mozilla/layers/SyncObject.h"
@ -43,7 +42,6 @@ RenderCompositorANGLE::RenderCompositorANGLE(RefPtr<widget::CompositorWidget>&&
: RenderCompositor(std::move(aWidget))
, mEGLConfig(nullptr)
, mEGLSurface(nullptr)
, mUseTripleBuffering(false)
{
}
@ -269,7 +267,6 @@ RenderCompositorANGLE::CreateSwapChainForDCompIfPossible(IDXGIFactory2* aDXGIFac
}
RefPtr<IDXGISwapChain1> swapChain1;
bool useTripleBuffering = gfx::gfxVars::UseWebRenderDCompWinTripleBuffering();
DXGI_SWAP_CHAIN_DESC1 desc{};
// DXGI does not like 0x0 swapchains. Swap chain creation failed when 0x0 was set.
@ -279,11 +276,7 @@ RenderCompositorANGLE::CreateSwapChainForDCompIfPossible(IDXGIFactory2* aDXGIFac
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
if (useTripleBuffering) {
desc.BufferCount = 3;
} else {
desc.BufferCount = 2;
}
desc.BufferCount = 2;
// DXGI_SCALING_NONE caused swap chain creation failure.
desc.Scaling = DXGI_SCALING_STRETCH;
desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
@ -298,7 +291,6 @@ RenderCompositorANGLE::CreateSwapChainForDCompIfPossible(IDXGIFactory2* aDXGIFac
mVisual->SetContent(swapChain1);
mCompositionTarget->SetRoot(mVisual);
mCompositionDevice = dCompDevice;
mUseTripleBuffering = useTripleBuffering;
}
}
@ -476,30 +468,24 @@ RenderCompositorANGLE::GetBufferSize()
void
RenderCompositorANGLE::InsertPresentWaitQuery()
{
RefPtr<ID3D11Query> query;
CD3D11_QUERY_DESC desc(D3D11_QUERY_EVENT);
HRESULT hr = mDevice->CreateQuery(&desc, getter_AddRefs(query));
if (FAILED(hr) || !query) {
HRESULT hr = mDevice->CreateQuery(&desc, getter_AddRefs(mNextWaitForPresentQuery));
if (FAILED(hr) || !mNextWaitForPresentQuery) {
gfxWarning() << "Could not create D3D11_QUERY_EVENT: " << gfx::hexa(hr);
return;
}
mCtx->End(query);
mWaitForPresentQueries.emplace(query);
mCtx->End(mNextWaitForPresentQuery);
}
void
RenderCompositorANGLE::WaitForPreviousPresentQuery()
{
int waitLatency = mUseTripleBuffering ? 3 : 2;
while (mWaitForPresentQueries.size() >= waitLatency) {
RefPtr<ID3D11Query>& query = mWaitForPresentQueries.front();
if (mWaitForPresentQuery) {
BOOL result;
layers::WaitForGPUQuery(mDevice, mCtx, query, &result);
mWaitForPresentQueries.pop();
layers::WaitForGPUQuery(mDevice, mCtx, mWaitForPresentQuery, &result);
}
mWaitForPresentQuery = mNextWaitForPresentQuery.forget();
}

Просмотреть файл

@ -7,8 +7,6 @@
#ifndef MOZILLA_GFX_RENDERCOMPOSITOR_ANGLE_H
#define MOZILLA_GFX_RENDERCOMPOSITOR_ANGLE_H
#include <queue>
#include "GLTypes.h"
#include "mozilla/Maybe.h"
#include "mozilla/webrender/RenderCompositor.h"
@ -49,8 +47,6 @@ public:
bool UseDComp() const override { return !!mCompositionDevice; }
bool UseTripleBuffering() const { return mUseTripleBuffering; }
LayoutDeviceIntSize GetBufferSize() override;
protected:
@ -65,8 +61,6 @@ protected:
EGLConfig mEGLConfig;
EGLSurface mEGLSurface;
int mUseTripleBuffering;
RefPtr<ID3D11Device> mDevice;
RefPtr<ID3D11DeviceContext> mCtx;
RefPtr<IDXGISwapChain> mSwapChain;
@ -75,7 +69,8 @@ protected:
RefPtr<IDCompositionTarget> mCompositionTarget;
RefPtr<IDCompositionVisual> mVisual;
std::queue<RefPtr<ID3D11Query>> mWaitForPresentQueries;
RefPtr<ID3D11Query> mWaitForPresentQuery;
RefPtr<ID3D11Query> mNextWaitForPresentQuery;
Maybe<LayoutDeviceIntSize> mBufferSize;
};

Просмотреть файл

@ -34,7 +34,6 @@ public:
uint32_t* aMaxTextureSize,
bool* aUseANGLE,
bool* aUseDComp,
bool* aUseTripleBuffering,
RefPtr<widget::CompositorWidget>&& aWidget,
layers::SynchronousTask* aTask,
LayoutDeviceIntSize aSize,
@ -43,7 +42,6 @@ public:
, mMaxTextureSize(aMaxTextureSize)
, mUseANGLE(aUseANGLE)
, mUseDComp(aUseDComp)
, mUseTripleBuffering(aUseTripleBuffering)
, mBridge(aBridge)
, mCompositorWidget(std::move(aWidget))
, mTask(aTask)
@ -70,7 +68,6 @@ public:
*mUseANGLE = compositor->UseANGLE();
*mUseDComp = compositor->UseDComp();
*mUseTripleBuffering = compositor->UseTripleBuffering();
bool supportLowPriorityTransactions = true; // TODO only for main windows.
wr::Renderer* wrRenderer = nullptr;
@ -113,7 +110,6 @@ private:
uint32_t* mMaxTextureSize;
bool* mUseANGLE;
bool* mUseDComp;
bool* mUseTripleBuffering;
layers::CompositorBridgeParent* mBridge;
RefPtr<widget::CompositorWidget> mCompositorWidget;
layers::SynchronousTask* mTask;
@ -302,14 +298,13 @@ WebRenderAPI::Create(layers::CompositorBridgeParent* aBridge,
uint32_t maxTextureSize = 0;
bool useANGLE = false;
bool useDComp = false;
bool useTripleBuffering = false;
layers::SyncHandle syncHandle = 0;
// Dispatch a synchronous task because the DocumentHandle object needs to be created
// on the render thread. If need be we could delay waiting on this task until
// the next time we need to access the DocumentHandle object.
layers::SynchronousTask task("Create Renderer");
auto event = MakeUnique<NewRenderer>(&docHandle, aBridge, &maxTextureSize, &useANGLE, &useDComp, &useTripleBuffering,
auto event = MakeUnique<NewRenderer>(&docHandle, aBridge, &maxTextureSize, &useANGLE, &useDComp,
std::move(aWidget), &task, aSize,
&syncHandle);
RenderThread::Get()->RunEvent(aWindowId, std::move(event));
@ -320,7 +315,7 @@ WebRenderAPI::Create(layers::CompositorBridgeParent* aBridge,
return nullptr;
}
return RefPtr<WebRenderAPI>(new WebRenderAPI(docHandle, aWindowId, maxTextureSize, useANGLE, useDComp, useTripleBuffering, syncHandle)).forget();
return RefPtr<WebRenderAPI>(new WebRenderAPI(docHandle, aWindowId, maxTextureSize, useANGLE, useDComp, syncHandle)).forget();
}
already_AddRefed<WebRenderAPI>
@ -329,7 +324,7 @@ WebRenderAPI::Clone()
wr::DocumentHandle* docHandle = nullptr;
wr_api_clone(mDocHandle, &docHandle);
RefPtr<WebRenderAPI> renderApi = new WebRenderAPI(docHandle, mId, mMaxTextureSize, mUseANGLE, mUseDComp, mUseTripleBuffering, mSyncHandle);
RefPtr<WebRenderAPI> renderApi = new WebRenderAPI(docHandle, mId, mMaxTextureSize, mUseANGLE, mUseDComp, mSyncHandle);
renderApi->mRootApi = this; // Hold root api
renderApi->mRootDocumentApi = this;
return renderApi.forget();
@ -349,7 +344,6 @@ WebRenderAPI::CreateDocument(LayoutDeviceIntSize aSize, int8_t aLayerIndex)
mMaxTextureSize,
mUseANGLE,
mUseDComp,
mUseTripleBuffering,
mSyncHandle));
api->mRootApi = this;
return api.forget();

Просмотреть файл

@ -232,19 +232,17 @@ public:
uint32_t GetMaxTextureSize() const { return mMaxTextureSize; }
bool GetUseANGLE() const { return mUseANGLE; }
bool GetUseDComp() const { return mUseDComp; }
bool GetUseTripleBuffering() const { return mUseTripleBuffering; }
layers::SyncHandle GetSyncHandle() const { return mSyncHandle; }
void Capture();
protected:
WebRenderAPI(wr::DocumentHandle* aHandle, wr::WindowId aId, uint32_t aMaxTextureSize, bool aUseANGLE, bool aUseDComp, bool aUseTripleBuffering, layers::SyncHandle aSyncHandle)
WebRenderAPI(wr::DocumentHandle* aHandle, wr::WindowId aId, uint32_t aMaxTextureSize, bool aUseANGLE, bool aUseDComp, layers::SyncHandle aSyncHandle)
: mDocHandle(aHandle)
, mId(aId)
, mMaxTextureSize(aMaxTextureSize)
, mUseANGLE(aUseANGLE)
, mUseDComp(aUseDComp)
, mUseTripleBuffering(aUseTripleBuffering)
, mSyncHandle(aSyncHandle)
{}
@ -257,7 +255,6 @@ protected:
uint32_t mMaxTextureSize;
bool mUseANGLE;
bool mUseDComp;
bool mUseTripleBuffering;
layers::SyncHandle mSyncHandle;
// We maintain alive the root api to know when to shut the render backend down,

Просмотреть файл

@ -912,7 +912,6 @@ pref("gfx.webrender.force-disabled", false);
#ifdef XP_WIN
pref("gfx.webrender.force-angle", true);
pref("gfx.webrender.dcomp-win.enabled", true);
pref("gfx.webrender.dcomp-win-triple-buffering.enabled", true);
pref("gfx.webrender.program-binary", true);
pref("gfx.webrender.program-binary-disk", true);
#endif