mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 916118 - Backed out changeset bafb8bf3b279 on a CLOSED TREE
This commit is contained in:
parent
13044eee98
commit
5088531545
@ -60,11 +60,12 @@ const TextureFlags TEXTURE_TILE = 1 << 15;
|
||||
// from the previous texture.
|
||||
const TextureFlags TEXTURE_COPY_PREVIOUS = 1 << 24;
|
||||
// Who is responsible for deallocating the shared data.
|
||||
// if TEXTURE_DEALLOCATE_CLIENT is set, the shared data is deallocated on the
|
||||
// client side and requires some extra synchronizaion to ensure race-free
|
||||
// deallocation.
|
||||
// The default behaviour is to deallocate on the host side.
|
||||
// if none of the following two flags is set, the shared data will not be
|
||||
// deallocated by the layers system. It is not necessarily a leak, it could
|
||||
// be a choice from another part of gecko that wants to keep the data alive
|
||||
// for some reason. The default behaviour is to deallocate on the host side.
|
||||
const TextureFlags TEXTURE_DEALLOCATE_CLIENT = 1 << 25;
|
||||
const TextureFlags TEXTURE_DEALLOCATE_HOST = 1 << 26;
|
||||
// After being shared ith the compositor side, an immutable texture is never
|
||||
// modified, it can only be read. It is safe to not Lock/Unlock immutable
|
||||
// textures.
|
||||
@ -79,7 +80,8 @@ const TextureFlags TEXTURE_IMMEDIATE_UPLOAD = 1 << 28;
|
||||
const TextureFlags TEXTURE_DOUBLE_BUFFERED = 1 << 29;
|
||||
|
||||
// the default flags
|
||||
const TextureFlags TEXTURE_FLAGS_DEFAULT = TEXTURE_FRONT;
|
||||
const TextureFlags TEXTURE_FLAGS_DEFAULT = TEXTURE_DEALLOCATE_HOST
|
||||
| TEXTURE_FRONT;
|
||||
|
||||
static inline bool
|
||||
TextureRequiresLocking(TextureFlags aFlags)
|
||||
|
@ -290,7 +290,8 @@ GrallocImage::GetTextureClient()
|
||||
return nullptr;
|
||||
}
|
||||
const SurfaceDescriptorGralloc& desc = sd.get_SurfaceDescriptorGralloc();
|
||||
TextureFlags flags = desc.external() ? TEXTURE_DEALLOCATE_CLIENT : 0;
|
||||
TextureFlags flags = desc.external() ? TEXTURE_DEALLOCATE_CLIENT
|
||||
: TEXTURE_DEALLOCATE_HOST;
|
||||
if (desc.isRBSwapped()) {
|
||||
flags |= TEXTURE_RB_SWAPPED;
|
||||
}
|
||||
|
@ -225,6 +225,7 @@ AppendToString(nsACString& s, TextureFlags flags,
|
||||
AppendFlag(TEXTURE_DISALLOW_BIGIMAGE);
|
||||
AppendFlag(TEXTURE_ALLOW_REPEAT);
|
||||
AppendFlag(TEXTURE_NEW_TILE);
|
||||
AppendFlag(TEXTURE_DEALLOCATE_HOST);
|
||||
|
||||
#undef AppendFlag
|
||||
}
|
||||
|
@ -42,11 +42,11 @@ CanvasClient::CreateCanvasClient(CanvasClientType aType,
|
||||
{
|
||||
if (aType == CanvasClientGLContext &&
|
||||
aForwarder->GetCompositorBackendType() == LAYERS_OPENGL) {
|
||||
aFlags &= TEXTURE_DEALLOCATE_CLIENT;
|
||||
aFlags &= ~TEXTURE_DEALLOCATE_HOST;
|
||||
return new DeprecatedCanvasClientSurfaceStream(aForwarder, aFlags);
|
||||
}
|
||||
if (gfxPlatform::GetPlatform()->UseDeprecatedTextures()) {
|
||||
aFlags &= TEXTURE_DEALLOCATE_CLIENT;
|
||||
aFlags &= ~TEXTURE_DEALLOCATE_HOST;
|
||||
return new DeprecatedCanvasClient2D(aForwarder, aFlags);
|
||||
}
|
||||
return new CanvasClient2D(aForwarder, aFlags);
|
||||
|
@ -98,12 +98,12 @@ ClientCanvasLayer::RenderLayer()
|
||||
}
|
||||
|
||||
if (!mGLContext) {
|
||||
// We don't support locking for buffer surfaces currently
|
||||
flags |= TEXTURE_IMMEDIATE_UPLOAD;
|
||||
} else {
|
||||
// GLContext's SurfaceStream handles ownership itself,
|
||||
// and doesn't require layers to do any deallocation.
|
||||
flags |= TEXTURE_DEALLOCATE_CLIENT;
|
||||
flags |= TEXTURE_DEALLOCATE_HOST;
|
||||
|
||||
// We don't support locking for buffer surfaces currently
|
||||
flags |= TEXTURE_IMMEDIATE_UPLOAD;
|
||||
}
|
||||
mCanvasClient = CanvasClient::CreateCanvasClient(GetCanvasClientType(),
|
||||
ClientManager(), flags);
|
||||
|
@ -231,7 +231,7 @@ CompositableClient::RemoveTextureClient(TextureClient* aClient)
|
||||
MOZ_ASSERT(aClient);
|
||||
mTexturesToRemove.AppendElement(TextureIDAndFlags(aClient->GetID(),
|
||||
aClient->GetFlags()));
|
||||
if (aClient->GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
|
||||
if (!(aClient->GetFlags() & TEXTURE_DEALLOCATE_HOST)) {
|
||||
TextureClientData* data = aClient->DropTextureData();
|
||||
if (data) {
|
||||
mTexturesToRemoveCallbacks[aClient->GetID()] = data;
|
||||
|
@ -201,7 +201,7 @@ ContentClientRemoteBuffer::BuildDeprecatedTextureClients(ContentType aType,
|
||||
|
||||
mContentType = aType;
|
||||
mSize = gfx::IntSize(aRect.width, aRect.height);
|
||||
mTextureInfo.mTextureFlags = aFlags & ~TEXTURE_DEALLOCATE_CLIENT;
|
||||
mTextureInfo.mTextureFlags = aFlags | TEXTURE_DEALLOCATE_HOST;
|
||||
|
||||
if (!CreateAndAllocateDeprecatedTextureClient(mDeprecatedTextureClient)) {
|
||||
return;
|
||||
|
@ -404,7 +404,7 @@ private:
|
||||
|
||||
void NotifyBufferCreated(ContentType aType, uint32_t aFlags)
|
||||
{
|
||||
mTextureInfo.mTextureFlags = aFlags & ~TEXTURE_DEALLOCATE_CLIENT;
|
||||
mTextureInfo.mTextureFlags = aFlags | TEXTURE_DEALLOCATE_HOST;
|
||||
mContentType = aType;
|
||||
|
||||
mForwarder->CreatedIncrementalBuffer(this,
|
||||
|
@ -165,7 +165,7 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
|
||||
|
||||
bool bufferCreated = false;
|
||||
if (!mFrontBuffer) {
|
||||
mFrontBuffer = CreateBufferTextureClient(gfx::FORMAT_YUV, TEXTURE_FLAGS_DEFAULT);
|
||||
mFrontBuffer = CreateBufferTextureClient(gfx::FORMAT_YUV, TEXTURE_DEALLOCATE_HOST);
|
||||
gfx::IntSize ySize(data->mYSize.width, data->mYSize.height);
|
||||
gfx::IntSize cbCrSize(data->mCbCrSize.width, data->mCbCrSize.height);
|
||||
if (!mFrontBuffer->AsTextureClientYCbCr()->AllocateForYCbCr(ySize, cbCrSize, data->mStereoMode)) {
|
||||
@ -226,7 +226,7 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
|
||||
gfxImageFormat format
|
||||
= gfxPlatform::GetPlatform()->OptimalFormatForContent(surface->GetContentType());
|
||||
mFrontBuffer = CreateBufferTextureClient(gfx::ImageFormatToSurfaceFormat(format),
|
||||
TEXTURE_FLAGS_DEFAULT);
|
||||
TEXTURE_DEALLOCATE_HOST);
|
||||
MOZ_ASSERT(mFrontBuffer->AsTextureClientSurface());
|
||||
mFrontBuffer->AsTextureClientSurface()->AllocateForSurface(size);
|
||||
|
||||
|
@ -398,7 +398,7 @@ DeprecatedTextureClientShmem::ReleaseResources()
|
||||
ShadowLayerForwarder::CloseDescriptor(mDescriptor);
|
||||
}
|
||||
|
||||
if (!(mTextureInfo.mTextureFlags & TEXTURE_DEALLOCATE_CLIENT)) {
|
||||
if (mTextureInfo.mTextureFlags & TEXTURE_DEALLOCATE_HOST) {
|
||||
mDescriptor = SurfaceDescriptor();
|
||||
return;
|
||||
}
|
||||
|
@ -195,6 +195,13 @@ protected:
|
||||
void AddFlags(TextureFlags aFlags)
|
||||
{
|
||||
MOZ_ASSERT(!IsSharedWithCompositor());
|
||||
// make sure we don't deallocate on both client and host;
|
||||
MOZ_ASSERT(!(aFlags & TEXTURE_DEALLOCATE_CLIENT && aFlags & TEXTURE_DEALLOCATE_HOST));
|
||||
if (aFlags & TEXTURE_DEALLOCATE_CLIENT) {
|
||||
mFlags &= ~TEXTURE_DEALLOCATE_HOST;
|
||||
} else if (aFlags & TEXTURE_DEALLOCATE_HOST) {
|
||||
mFlags &= ~TEXTURE_DEALLOCATE_CLIENT;
|
||||
}
|
||||
mFlags |= aFlags;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ CompositableHost::~CompositableHost()
|
||||
|
||||
RefPtr<TextureHost> it = mFirstTexture;
|
||||
while (it) {
|
||||
if (!(it->GetFlags() & TEXTURE_DEALLOCATE_CLIENT)) {
|
||||
if (it->GetFlags() & TEXTURE_DEALLOCATE_HOST) {
|
||||
it->DeallocateSharedData();
|
||||
}
|
||||
it = it->GetNextSibling();
|
||||
|
@ -260,7 +260,7 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
|
||||
|
||||
TextureFlags flags = texture->GetFlags();
|
||||
|
||||
if (!(flags & TEXTURE_DEALLOCATE_CLIENT)) {
|
||||
if (flags & TEXTURE_DEALLOCATE_HOST) {
|
||||
texture->DeallocateSharedData();
|
||||
}
|
||||
|
||||
@ -269,7 +269,7 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
|
||||
// if it is not the host that deallocates the shared data, then we need
|
||||
// to notfy the client side to tell when it is safe to deallocate or
|
||||
// reuse it.
|
||||
if (flags & TEXTURE_DEALLOCATE_CLIENT) {
|
||||
if (!(flags & TEXTURE_DEALLOCATE_HOST)) {
|
||||
replyv.push_back(ReplyTextureRemoved(op.compositableParent(), nullptr,
|
||||
op.textureID()));
|
||||
}
|
||||
|
@ -122,16 +122,16 @@ ImageBridgeChild::RemoveTexture(CompositableClient* aCompositable,
|
||||
uint64_t aTexture,
|
||||
TextureFlags aFlags)
|
||||
{
|
||||
if (aFlags & TEXTURE_DEALLOCATE_CLIENT) {
|
||||
// if deallocation happens on the host side, we need the transaction
|
||||
if (aFlags & TEXTURE_DEALLOCATE_HOST) {
|
||||
// if deallocation happens on the host side, we don't need the transaction
|
||||
// to be synchronous.
|
||||
mTxn->AddEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
|
||||
aTexture,
|
||||
aFlags));
|
||||
} else {
|
||||
mTxn->AddNoSwapEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
|
||||
aTexture,
|
||||
aFlags));
|
||||
} else {
|
||||
mTxn->AddEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
|
||||
aTexture,
|
||||
aFlags));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -411,7 +411,7 @@ ShadowLayerForwarder::RemoveTexture(CompositableClient* aCompositable,
|
||||
mTxn->AddEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
|
||||
aTexture,
|
||||
aFlags));
|
||||
if (aFlags & TEXTURE_DEALLOCATE_CLIENT) {
|
||||
if (!(aFlags & TEXTURE_DEALLOCATE_HOST)) {
|
||||
mTxn->MarkSyncTransaction();
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ SharedTextureClientOGL::SharedTextureClientOGL(TextureFlags aFlags)
|
||||
, mHandle(0)
|
||||
, mInverted(false)
|
||||
{
|
||||
MOZ_ASSERT(aFlags & TEXTURE_DEALLOCATE_CLIENT,
|
||||
"SharedTextureClientOGL is always owned externally");
|
||||
MOZ_ASSERT(!(aFlags & (TEXTURE_DEALLOCATE_CLIENT|TEXTURE_DEALLOCATE_HOST)),
|
||||
"SharedTextureClientOGL doesn't know how to release textures!");
|
||||
}
|
||||
|
||||
SharedTextureClientOGL::~SharedTextureClientOGL()
|
||||
|
Loading…
Reference in New Issue
Block a user