зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1567816 - Remove WebRenderTextureHostWrapper r=nical
Differential Revision: https://phabricator.services.mozilla.com/D38837 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
6d321304a4
Коммит
70e1a770b5
|
@ -151,13 +151,5 @@ void GPUVideoTextureHost::PushDisplayItems(
|
|||
aFilter, aImageKeys);
|
||||
}
|
||||
|
||||
bool GPUVideoTextureHost::SupportsWrNativeTexture() {
|
||||
MOZ_ASSERT(EnsureWrappedTextureHost());
|
||||
if (!EnsureWrappedTextureHost()) {
|
||||
return false;
|
||||
}
|
||||
return EnsureWrappedTextureHost()->SupportsWrNativeTexture();
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -62,8 +62,6 @@ class GPUVideoTextureHost : public TextureHost {
|
|||
const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
|
||||
const Range<wr::ImageKey>& aImageKeys) override;
|
||||
|
||||
bool SupportsWrNativeTexture() override;
|
||||
|
||||
protected:
|
||||
GPUVideoTextureHost(TextureFlags aFlags,
|
||||
const SurfaceDescriptorGPUVideo& aDescriptor);
|
||||
|
|
|
@ -675,8 +675,6 @@ class TextureHost : public AtomicRefCountedWithFinalize<TextureHost> {
|
|||
|
||||
virtual bool IsDirectMap() { return false; }
|
||||
|
||||
virtual bool SupportsWrNativeTexture() { return false; }
|
||||
|
||||
virtual bool NeedsYFlip() const;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -354,8 +354,6 @@ class DXGITextureHostD3D11 : public TextureHost {
|
|||
const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
|
||||
const Range<wr::ImageKey>& aImageKeys) override;
|
||||
|
||||
bool SupportsWrNativeTexture() override { return true; }
|
||||
|
||||
protected:
|
||||
bool LockInternal();
|
||||
void UnlockInternal();
|
||||
|
@ -423,8 +421,6 @@ class DXGIYCbCrTextureHostD3D11 : public TextureHost {
|
|||
const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
|
||||
const Range<wr::ImageKey>& aImageKeys) override;
|
||||
|
||||
bool SupportsWrNativeTexture() override { return true; }
|
||||
|
||||
private:
|
||||
bool EnsureTextureSource();
|
||||
|
||||
|
|
|
@ -270,7 +270,6 @@ EXPORTS.mozilla.layers += [
|
|||
'wr/WebRenderScrollData.h',
|
||||
'wr/WebRenderScrollDataWrapper.h',
|
||||
'wr/WebRenderTextureHost.h',
|
||||
'wr/WebRenderTextureHostWrapper.h',
|
||||
'wr/WebRenderUserData.h',
|
||||
'ZoomConstraints.h',
|
||||
]
|
||||
|
@ -521,7 +520,6 @@ UNIFIED_SOURCES += [
|
|||
'wr/WebRenderLayerManager.cpp',
|
||||
'wr/WebRenderLayersLogging.cpp',
|
||||
'wr/WebRenderScrollData.cpp',
|
||||
'wr/WebRenderTextureHostWrapper.cpp',
|
||||
'wr/WebRenderUserData.cpp',
|
||||
# XXX here are some unified build error.
|
||||
#'wr/WebRenderTextureHost.cpp'
|
||||
|
|
|
@ -440,8 +440,6 @@ class SurfaceTextureHost : public TextureHost {
|
|||
const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
|
||||
const Range<wr::ImageKey>& aImageKeys) override;
|
||||
|
||||
bool SupportsWrNativeTexture() override { return true; }
|
||||
|
||||
protected:
|
||||
bool EnsureAttached();
|
||||
|
||||
|
|
|
@ -220,18 +220,12 @@ Maybe<TextureHost::ResourceUpdateOp> AsyncImagePipelineManager::UpdateImageKeys(
|
|||
if (texture == previousTexture) {
|
||||
// The texture has not changed, just reuse previous ImageKeys.
|
||||
aKeys = aPipeline->mKeys;
|
||||
if (aPipeline->mWrTextureWrapper) {
|
||||
HoldExternalImage(aPipelineId, aEpoch, aPipeline->mWrTextureWrapper);
|
||||
}
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
if (!texture) {
|
||||
// We don't have a new texture, there isn't much we can do.
|
||||
aKeys = aPipeline->mKeys;
|
||||
if (aPipeline->mWrTextureWrapper) {
|
||||
HoldExternalImage(aPipelineId, aEpoch, aPipeline->mWrTextureWrapper);
|
||||
}
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
|
@ -246,14 +240,6 @@ Maybe<TextureHost::ResourceUpdateOp> AsyncImagePipelineManager::UpdateImageKeys(
|
|||
bool useExternalImage = !gfxEnv::EnableWebRenderRecording() && wrTexture;
|
||||
aPipeline->mUseExternalImage = useExternalImage;
|
||||
|
||||
// Use WebRenderTextureHostWrapper only for video.
|
||||
// And WebRenderTextureHostWrapper could be used only with
|
||||
// WebRenderTextureHost that supports NativeTexture
|
||||
bool useWrTextureWrapper =
|
||||
useExternalImage && wrTexture && wrTexture->SupportsWrNativeTexture();
|
||||
// XXX Re-enable fast path for async native texture updates(Bug 1559294)
|
||||
useWrTextureWrapper = false;
|
||||
|
||||
// The non-external image code path falls back to converting the texture into
|
||||
// an rgb image.
|
||||
auto numKeys = useExternalImage ? texture->NumSubTextures() : 1;
|
||||
|
@ -266,12 +252,6 @@ Maybe<TextureHost::ResourceUpdateOp> AsyncImagePipelineManager::UpdateImageKeys(
|
|||
previousTexture->NeedsYFlip() == texture->NeedsYFlip() &&
|
||||
aPipeline->mKeys.Length() == numKeys;
|
||||
|
||||
// Check if WebRenderTextureHostWrapper could be reused.
|
||||
if (aPipeline->mWrTextureWrapper && (!useWrTextureWrapper || !canUpdate)) {
|
||||
aPipeline->mWrTextureWrapper = nullptr;
|
||||
canUpdate = false;
|
||||
}
|
||||
|
||||
if (!canUpdate) {
|
||||
for (auto key : aPipeline->mKeys) {
|
||||
// Destroy ImageKeys on transaction of scene builder thread, since
|
||||
|
@ -295,34 +275,9 @@ Maybe<TextureHost::ResourceUpdateOp> AsyncImagePipelineManager::UpdateImageKeys(
|
|||
|
||||
wrTexture->MaybeNofityForUse(aMaybeFastTxn);
|
||||
|
||||
if (useWrTextureWrapper && aPipeline->mWrTextureWrapper) {
|
||||
MOZ_ASSERT(canUpdate);
|
||||
// Reuse WebRenderTextureHostWrapper. With it, rendered frame could be
|
||||
// updated without batch re-creation.
|
||||
aPipeline->mWrTextureWrapper->UpdateWebRenderTextureHost(aMaybeFastTxn,
|
||||
wrTexture);
|
||||
// Ensure frame generation.
|
||||
SetWillGenerateFrame(aPipeline->mRenderRoot);
|
||||
} else {
|
||||
if (useWrTextureWrapper) {
|
||||
aPipeline->mWrTextureWrapper = new WebRenderTextureHostWrapper(this);
|
||||
aPipeline->mWrTextureWrapper->UpdateWebRenderTextureHost(aMaybeFastTxn,
|
||||
wrTexture);
|
||||
}
|
||||
Range<wr::ImageKey> keys(&aKeys[0], aKeys.Length());
|
||||
auto externalImageKey =
|
||||
aPipeline->mWrTextureWrapper
|
||||
? aPipeline->mWrTextureWrapper->GetExternalImageKey()
|
||||
: wrTexture->GetExternalImageKey();
|
||||
wrTexture->PushResourceUpdates(aMaybeFastTxn, op, keys, externalImageKey);
|
||||
}
|
||||
|
||||
if (aPipeline->mWrTextureWrapper) {
|
||||
// Force frame rendering, since WebRenderTextureHost update its data outside
|
||||
// of WebRender.
|
||||
aMaybeFastTxn.InvalidateRenderedFrame();
|
||||
HoldExternalImage(aPipelineId, aEpoch, aPipeline->mWrTextureWrapper);
|
||||
}
|
||||
Range<wr::ImageKey> keys(&aKeys[0], aKeys.Length());
|
||||
auto externalImageKey = wrTexture->GetExternalImageKey();
|
||||
wrTexture->PushResourceUpdates(aMaybeFastTxn, op, keys, externalImageKey);
|
||||
|
||||
return Some(op);
|
||||
}
|
||||
|
@ -552,25 +507,6 @@ void AsyncImagePipelineManager::HoldExternalImage(
|
|||
holder->mTextureHosts.push(ForwardingTextureHost(aEpoch, aTexture));
|
||||
}
|
||||
|
||||
void AsyncImagePipelineManager::HoldExternalImage(
|
||||
const wr::PipelineId& aPipelineId, const wr::Epoch& aEpoch,
|
||||
WebRenderTextureHostWrapper* aWrTextureWrapper) {
|
||||
if (mDestroyed) {
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(aWrTextureWrapper);
|
||||
|
||||
PipelineTexturesHolder* holder =
|
||||
mPipelineTexturesHolders.Get(wr::AsUint64(aPipelineId));
|
||||
MOZ_ASSERT(holder);
|
||||
if (!holder) {
|
||||
return;
|
||||
}
|
||||
// Hold WebRenderTextureHostWrapper until end of its usage on RenderThread
|
||||
holder->mTextureHostWrappers.push(
|
||||
ForwardingTextureHostWrapper(aEpoch, aWrTextureWrapper));
|
||||
}
|
||||
|
||||
void AsyncImagePipelineManager::HoldExternalImage(
|
||||
const wr::PipelineId& aPipelineId, const wr::Epoch& aEpoch,
|
||||
const wr::ExternalImageId& aImageId) {
|
||||
|
@ -676,12 +612,6 @@ void AsyncImagePipelineManager::ProcessPipelineRendered(
|
|||
aUpdatesCount);
|
||||
holder->mTextureHosts.pop();
|
||||
}
|
||||
while (!holder->mTextureHostWrappers.empty()) {
|
||||
if (aEpoch <= holder->mTextureHostWrappers.front().mEpoch) {
|
||||
break;
|
||||
}
|
||||
holder->mTextureHostWrappers.pop();
|
||||
}
|
||||
while (!holder->mExternalImages.empty()) {
|
||||
if (aEpoch <= holder->mExternalImages.front()->mEpoch) {
|
||||
break;
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "CompositableHost.h"
|
||||
#include "mozilla/gfx/Point.h"
|
||||
#include "mozilla/layers/TextureHost.h"
|
||||
#include "mozilla/layers/WebRenderTextureHostWrapper.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/webrender/WebRenderAPI.h"
|
||||
#include "mozilla/webrender/WebRenderTypes.h"
|
||||
|
@ -32,7 +31,6 @@ class CompositableHost;
|
|||
class CompositorVsyncScheduler;
|
||||
class WebRenderImageHost;
|
||||
class WebRenderTextureHost;
|
||||
class WebRenderTextureHostWrapper;
|
||||
|
||||
class AsyncImagePipelineManager final {
|
||||
public:
|
||||
|
@ -55,9 +53,6 @@ class AsyncImagePipelineManager final {
|
|||
|
||||
void HoldExternalImage(const wr::PipelineId& aPipelineId,
|
||||
const wr::Epoch& aEpoch, TextureHost* aTexture);
|
||||
void HoldExternalImage(const wr::PipelineId& aPipelineId,
|
||||
const wr::Epoch& aEpoch,
|
||||
WebRenderTextureHostWrapper* aWrTextureWrapper);
|
||||
void HoldExternalImage(const wr::PipelineId& aPipelineId,
|
||||
const wr::Epoch& aEpoch,
|
||||
const wr::ExternalImageId& aImageId);
|
||||
|
@ -151,14 +146,6 @@ class AsyncImagePipelineManager final {
|
|||
CompositableTextureHostRef mTexture;
|
||||
};
|
||||
|
||||
struct ForwardingTextureHostWrapper {
|
||||
ForwardingTextureHostWrapper(const wr::Epoch& aEpoch,
|
||||
WebRenderTextureHostWrapper* aWrTextureWrapper)
|
||||
: mEpoch(aEpoch), mWrTextureWrapper(aWrTextureWrapper) {}
|
||||
wr::Epoch mEpoch;
|
||||
RefPtr<WebRenderTextureHostWrapper> mWrTextureWrapper;
|
||||
};
|
||||
|
||||
struct ForwardingExternalImage {
|
||||
ForwardingExternalImage(const wr::Epoch& aEpoch,
|
||||
const wr::ExternalImageId& aImageId)
|
||||
|
@ -171,7 +158,6 @@ class AsyncImagePipelineManager final {
|
|||
struct PipelineTexturesHolder {
|
||||
// Holds forwarding WebRenderTextureHosts.
|
||||
std::queue<ForwardingTextureHost> mTextureHosts;
|
||||
std::queue<ForwardingTextureHostWrapper> mTextureHostWrappers;
|
||||
std::queue<UniquePtr<ForwardingExternalImage>> mExternalImages;
|
||||
Maybe<wr::Epoch> mDestroyedEpoch;
|
||||
WebRenderBridgeParent* MOZ_NON_OWNING_REF mWrBridge = nullptr;
|
||||
|
@ -206,7 +192,6 @@ class AsyncImagePipelineManager final {
|
|||
wr::MixBlendMode mMixBlendMode;
|
||||
RefPtr<WebRenderImageHost> mImageHost;
|
||||
CompositableTextureHostRef mCurrentTexture;
|
||||
RefPtr<WebRenderTextureHostWrapper> mWrTextureWrapper;
|
||||
nsTArray<wr::ImageKey> mKeys;
|
||||
};
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ void WebRenderTextureHost::PushResourceUpdates(
|
|||
wr::TransactionBuilder& aResources, ResourceUpdateOp aOp,
|
||||
const Range<wr::ImageKey>& aImageKeys, const wr::ExternalImageId& aExtID) {
|
||||
MOZ_ASSERT(mWrappedTextureHost);
|
||||
MOZ_ASSERT(mExternalImageId == aExtID || SupportsWrNativeTexture());
|
||||
MOZ_ASSERT(mExternalImageId == aExtID);
|
||||
|
||||
mWrappedTextureHost->PushResourceUpdates(aResources, aOp, aImageKeys, aExtID);
|
||||
}
|
||||
|
@ -226,10 +226,6 @@ void WebRenderTextureHost::PushDisplayItems(
|
|||
aImageKeys);
|
||||
}
|
||||
|
||||
bool WebRenderTextureHost::SupportsWrNativeTexture() {
|
||||
return mWrappedTextureHost->SupportsWrNativeTexture();
|
||||
}
|
||||
|
||||
bool WebRenderTextureHost::NeedsYFlip() const {
|
||||
bool yFlip = TextureHost::NeedsYFlip();
|
||||
if (mWrappedTextureHost->AsSurfaceTextureHost()) {
|
||||
|
|
|
@ -81,8 +81,6 @@ class WebRenderTextureHost : public TextureHost {
|
|||
const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
|
||||
const Range<wr::ImageKey>& aImageKeys) override;
|
||||
|
||||
bool SupportsWrNativeTexture() override;
|
||||
|
||||
bool NeedsYFlip() const override;
|
||||
|
||||
void MaybeNofityForUse(wr::TransactionBuilder& aTxn);
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "WebRenderTextureHostWrapper.h"
|
||||
|
||||
#include "mozilla/layers/AsyncImagePipelineManager.h"
|
||||
#include "mozilla/layers/WebRenderTextureHost.h"
|
||||
#include "mozilla/webrender/RenderTextureHostWrapper.h"
|
||||
#include "mozilla/webrender/RenderThread.h"
|
||||
#include "mozilla/webrender/WebRenderAPI.h"
|
||||
#include "mozilla/webrender/RenderThread.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
class ScheduleUpdateRenderTextureHost : public wr::NotificationHandler {
|
||||
public:
|
||||
ScheduleUpdateRenderTextureHost(uint64_t aSrcExternalImageId,
|
||||
uint64_t aWrappedExternalImageId)
|
||||
: mSrcExternalImageId(aSrcExternalImageId),
|
||||
mWrappedExternalImageId(aWrappedExternalImageId) {}
|
||||
|
||||
virtual void Notify(wr::Checkpoint aCheckpoint) override {
|
||||
if (aCheckpoint == wr::Checkpoint::FrameTexturesUpdated) {
|
||||
MOZ_ASSERT(wr::RenderThread::IsInRenderThread());
|
||||
wr::RenderThread::Get()->UpdateRenderTextureHost(mSrcExternalImageId,
|
||||
mWrappedExternalImageId);
|
||||
} else {
|
||||
MOZ_ASSERT(aCheckpoint == wr::Checkpoint::TransactionDropped);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
uint64_t mSrcExternalImageId;
|
||||
uint64_t mWrappedExternalImageId;
|
||||
};
|
||||
|
||||
WebRenderTextureHostWrapper::WebRenderTextureHostWrapper(
|
||||
AsyncImagePipelineManager* aManager)
|
||||
: mExternalImageId(aManager->GetNextExternalImageId()) {
|
||||
MOZ_ASSERT(aManager);
|
||||
MOZ_COUNT_CTOR(WebRenderTextureHostWrapper);
|
||||
|
||||
RefPtr<wr::RenderTextureHost> texture = new wr::RenderTextureHostWrapper();
|
||||
wr::RenderThread::Get()->RegisterExternalImage(wr::AsUint64(mExternalImageId),
|
||||
texture.forget());
|
||||
}
|
||||
|
||||
WebRenderTextureHostWrapper::~WebRenderTextureHostWrapper() {
|
||||
MOZ_COUNT_DTOR(WebRenderTextureHostWrapper);
|
||||
wr::RenderThread::Get()->UnregisterExternalImage(
|
||||
wr::AsUint64(mExternalImageId));
|
||||
}
|
||||
|
||||
void WebRenderTextureHostWrapper::UpdateWebRenderTextureHost(
|
||||
wr::TransactionBuilder& aTxn, WebRenderTextureHost* aTextureHost) {
|
||||
MOZ_ASSERT(aTextureHost);
|
||||
|
||||
// AsyncImagePipelineManager is responsible of holding compositable ref of
|
||||
// wrapped WebRenderTextureHost by using ForwardingTextureHost.
|
||||
// ScheduleUpdateRenderTextureHost does not need to handle it.
|
||||
|
||||
aTxn.Notify(wr::Checkpoint::FrameTexturesUpdated,
|
||||
MakeUnique<ScheduleUpdateRenderTextureHost>(
|
||||
wr::AsUint64(mExternalImageId),
|
||||
wr::AsUint64(aTextureHost->GetExternalImageKey())));
|
||||
|
||||
mWrTextureHost = aTextureHost;
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
|
@ -1,44 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef MOZILLA_GFX_WEBRENDERTEXTUREHOSTWRAPPER_H
|
||||
#define MOZILLA_GFX_WEBRENDERTEXTUREHOSTWRAPPER_H
|
||||
|
||||
#include "mozilla/webrender/WebRenderTypes.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace wr {
|
||||
class TransactionBuilder;
|
||||
}
|
||||
|
||||
namespace layers {
|
||||
|
||||
class WebRenderTextureHost;
|
||||
class AsyncImagePipelineManager;
|
||||
|
||||
class WebRenderTextureHostWrapper {
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebRenderTextureHostWrapper)
|
||||
|
||||
public:
|
||||
explicit WebRenderTextureHostWrapper(AsyncImagePipelineManager* aManager);
|
||||
|
||||
void UpdateWebRenderTextureHost(wr::TransactionBuilder& aTxn,
|
||||
WebRenderTextureHost* aTextureHost);
|
||||
|
||||
wr::ExternalImageId GetExternalImageKey() { return mExternalImageId; }
|
||||
|
||||
protected:
|
||||
virtual ~WebRenderTextureHostWrapper();
|
||||
|
||||
RefPtr<WebRenderTextureHost> mWrTextureHost;
|
||||
wr::ExternalImageId mExternalImageId;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // MOZILLA_GFX_WEBRENDERTEXTUREHOSTWRAPPER_H
|
|
@ -24,7 +24,6 @@ namespace wr {
|
|||
|
||||
class RenderBufferTextureHost;
|
||||
class RenderTextureHostOGL;
|
||||
class RenderTextureHostWrapper;
|
||||
|
||||
void ActivateBindAndTexParameteri(gl::GLContext* aGL, GLenum aActiveTexture,
|
||||
GLenum aBindTarget, GLuint aBindTexture,
|
||||
|
@ -41,10 +40,6 @@ class RenderTextureHost {
|
|||
virtual void Unlock() = 0;
|
||||
virtual void ClearCachedResources() {}
|
||||
|
||||
virtual RenderTextureHostWrapper* AsRenderTextureHostWrapper() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual void PrepareForUse() {}
|
||||
virtual void NofityForUse() {}
|
||||
virtual void NotifyNotUsed() {}
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "RenderTextureHostWrapper.h"
|
||||
|
||||
#include "mozilla/gfx/Logging.h"
|
||||
#include "mozilla/layers/ImageDataSerializer.h"
|
||||
#include "mozilla/layers/SourceSurfaceSharedData.h"
|
||||
#include "mozilla/webrender/RenderThread.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace wr {
|
||||
|
||||
RenderTextureHostWrapper::RenderTextureHostWrapper()
|
||||
: mInited(false), mLocked(false) {
|
||||
MOZ_COUNT_CTOR_INHERITED(RenderTextureHostWrapper, RenderTextureHost);
|
||||
}
|
||||
|
||||
RenderTextureHostWrapper::~RenderTextureHostWrapper() {
|
||||
MOZ_COUNT_DTOR_INHERITED(RenderTextureHostWrapper, RenderTextureHost);
|
||||
}
|
||||
|
||||
wr::WrExternalImage RenderTextureHostWrapper::Lock(
|
||||
uint8_t aChannelIndex, gl::GLContext* aGL, wr::ImageRendering aRendering) {
|
||||
if (!mTextureHost) {
|
||||
MOZ_ASSERT_UNREACHABLE("unexpected to happen");
|
||||
return InvalidToWrExternalImage();
|
||||
}
|
||||
|
||||
mLocked = true;
|
||||
return mTextureHost->Lock(aChannelIndex, aGL, aRendering);
|
||||
}
|
||||
|
||||
void RenderTextureHostWrapper::Unlock() {
|
||||
if (mTextureHost) {
|
||||
mTextureHost->Unlock();
|
||||
}
|
||||
mLocked = false;
|
||||
}
|
||||
|
||||
void RenderTextureHostWrapper::ClearCachedResources() {
|
||||
if (mTextureHost) {
|
||||
mTextureHost->ClearCachedResources();
|
||||
}
|
||||
}
|
||||
|
||||
void RenderTextureHostWrapper::UpdateRenderTextureHost(
|
||||
RenderTextureHost* aTextureHost) {
|
||||
MOZ_ASSERT(RenderThread::IsInRenderThread());
|
||||
MOZ_RELEASE_ASSERT(!mLocked);
|
||||
|
||||
mInited = true;
|
||||
mTextureHost = aTextureHost;
|
||||
}
|
||||
|
||||
} // namespace wr
|
||||
} // namespace mozilla
|
|
@ -1,43 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef MOZILLA_GFX_RENDERTEXTUREHOSTWRAPPER_H
|
||||
#define MOZILLA_GFX_RENDERTEXTUREHOSTWRAPPER_H
|
||||
|
||||
#include "RenderTextureHost.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace wr {
|
||||
|
||||
class RenderTextureHostWrapper final : public RenderTextureHost {
|
||||
public:
|
||||
explicit RenderTextureHostWrapper();
|
||||
|
||||
wr::WrExternalImage Lock(uint8_t aChannelIndex, gl::GLContext* aGL,
|
||||
wr::ImageRendering aRendering) override;
|
||||
void Unlock() override;
|
||||
void ClearCachedResources() override;
|
||||
|
||||
RenderTextureHostWrapper* AsRenderTextureHostWrapper() override {
|
||||
return this;
|
||||
}
|
||||
|
||||
void UpdateRenderTextureHost(RenderTextureHost* aTextureHost);
|
||||
bool IsInited() { return mInited; }
|
||||
|
||||
private:
|
||||
virtual ~RenderTextureHostWrapper();
|
||||
|
||||
bool mInited;
|
||||
bool mLocked;
|
||||
RefPtr<RenderTextureHost> mTextureHost;
|
||||
};
|
||||
|
||||
} // namespace wr
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // MOZILLA_GFX_RENDERTEXTUREHOSTWRAPPER_H
|
|
@ -693,30 +693,6 @@ void RenderThread::NotifyNotUsed(uint64_t aExternalImageId) {
|
|||
texture->NotifyNotUsed();
|
||||
}
|
||||
|
||||
void RenderThread::UpdateRenderTextureHost(uint64_t aSrcExternalImageId,
|
||||
uint64_t aWrappedExternalImageId) {
|
||||
MOZ_ASSERT(aSrcExternalImageId != aWrappedExternalImageId);
|
||||
MOZ_ASSERT(RenderThread::IsInRenderThread());
|
||||
|
||||
MutexAutoLock lock(mRenderTextureMapLock);
|
||||
if (mHasShutdown) {
|
||||
return;
|
||||
}
|
||||
auto src = mRenderTextures.find(aSrcExternalImageId);
|
||||
auto wrapped = mRenderTextures.find(aWrappedExternalImageId);
|
||||
if (src == mRenderTextures.end() || wrapped == mRenderTextures.end()) {
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(src->second->AsRenderTextureHostWrapper());
|
||||
MOZ_ASSERT(!wrapped->second->AsRenderTextureHostWrapper());
|
||||
RenderTextureHostWrapper* wrapper = src->second->AsRenderTextureHostWrapper();
|
||||
if (!wrapper) {
|
||||
MOZ_ASSERT_UNREACHABLE("unexpected to happen");
|
||||
return;
|
||||
}
|
||||
wrapper->UpdateRenderTextureHost(wrapped->second);
|
||||
}
|
||||
|
||||
void RenderThread::NofityForUse(uint64_t aExternalImageId) {
|
||||
MOZ_ASSERT(RenderThread::IsInRenderThread());
|
||||
|
||||
|
|
|
@ -204,10 +204,6 @@ class RenderThread final {
|
|||
/// Can be called from any thread.
|
||||
void NotifyNotUsed(uint64_t aExternalImageId);
|
||||
|
||||
/// Can only be called from the render thread.
|
||||
void UpdateRenderTextureHost(uint64_t aSrcExternalImageId,
|
||||
uint64_t aWrappedExternalImageId);
|
||||
|
||||
/// Can only be called from the render thread.
|
||||
void NofityForUse(uint64_t aExternalImageId);
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ EXPORTS.mozilla.webrender += [
|
|||
'RenderSharedSurfaceTextureHost.h',
|
||||
'RenderTextureHost.h',
|
||||
'RenderTextureHostOGL.h',
|
||||
'RenderTextureHostWrapper.h',
|
||||
'RenderThread.h',
|
||||
'webrender_ffi.h',
|
||||
'WebRenderAPI.h',
|
||||
|
@ -35,7 +34,6 @@ UNIFIED_SOURCES += [
|
|||
'RenderSharedSurfaceTextureHost.cpp',
|
||||
'RenderTextureHost.cpp',
|
||||
'RenderTextureHostOGL.cpp',
|
||||
'RenderTextureHostWrapper.cpp',
|
||||
'RenderThread.cpp',
|
||||
'WebRenderAPI.cpp',
|
||||
'WebRenderTypes.cpp',
|
||||
|
|
Загрузка…
Ссылка в новой задаче