Bug 1558100 - Recycle TextureClient in CanvasClient2D with WebRender r=nical

Differential Revision: https://phabricator.services.mozilla.com/D34495

--HG--
extra : moz-landing-system : lando
This commit is contained in:
sotaro 2019-06-12 21:29:47 +00:00
Родитель 710630afc9
Коммит 67e4b24fb3
2 изменённых файлов: 12 добавлений и 0 удалений

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

@ -22,6 +22,7 @@
#include "mozilla/layers/LayersTypes.h"
#include "mozilla/layers/TextureClient.h" // for TextureClient, etc
#include "mozilla/layers/TextureClientOGL.h"
#include "mozilla/layers/TextureClientRecycleAllocator.h"
#include "nsDebug.h" // for printf_stderr, NS_ASSERTION
#include "nsXULAppAPI.h" // for XRE_GetProcessType, etc
#include "TextureClientSharedSurface.h"
@ -172,6 +173,15 @@ already_AddRefed<TextureClient> CanvasClient2D::CreateTextureClientForCanvas(
}
#ifdef XP_WIN
// With WebRender, host side uses data of TextureClient longer.
// Then back buffer reuse in CanvasClient2D::Update() does not work. It causes
// a lot of TextureClient allocations.
// For reducing the allocations, TextureClientRecycler is used.
if (GetForwarder() &&
GetForwarder()->GetCompositorBackendType() == LayersBackend::LAYERS_WR) {
return GetTextureClientRecycler()->CreateOrRecycle(
aFormat, aSize, BackendSelector::Canvas, aFlags);
}
return CreateTextureClientForDrawing(aFormat, aSize, BackendSelector::Canvas,
aFlags);
#else

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

@ -112,6 +112,8 @@ void WebRenderTextureHost::UnbindTextureSource() {
if (mWrappedTextureHost && mWrappedTextureHost->AsBufferTextureHost()) {
mWrappedTextureHost->UnbindTextureSource();
}
// Handle read unlock
TextureHost::UnbindTextureSource();
}
void WebRenderTextureHost::SetTextureSourceProvider(