mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Back out ef1cd14c8cac (bug 1067455) for Windows assertion failures
CLOSED TREE
This commit is contained in:
parent
cce4aa7ac7
commit
5e348eaecc
@ -13,7 +13,6 @@
|
||||
#include "mozilla/gfx/Rect.h" // for Rect, IntRect
|
||||
#include "mozilla/gfx/Types.h" // for Float
|
||||
#include "mozilla/layers/CompositorTypes.h" // for DiagnosticTypes, etc
|
||||
#include "mozilla/layers/FenceUtils.h" // for FenceHandle
|
||||
#include "mozilla/layers/LayersTypes.h" // for LayersBackend
|
||||
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
|
||||
#include "nsRegion.h"
|
||||
@ -354,11 +353,6 @@ public:
|
||||
|
||||
virtual void SetFBAcquireFence(Layer* aLayer) {}
|
||||
|
||||
virtual FenceHandle GetReleaseFence()
|
||||
{
|
||||
return FenceHandle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Post-rendering stuff if the rendering is done outside of this Compositor
|
||||
* e.g., by Composer2D.
|
||||
|
@ -358,7 +358,7 @@ public:
|
||||
|
||||
virtual void SetReleaseFenceHandle(FenceHandle aReleaseFenceHandle)
|
||||
{
|
||||
mReleaseFenceHandle.Merge(aReleaseFenceHandle);
|
||||
mReleaseFenceHandle = aReleaseFenceHandle;
|
||||
}
|
||||
|
||||
const FenceHandle& GetReleaseFenceHandle() const
|
||||
|
@ -80,6 +80,8 @@ public:
|
||||
|
||||
void CompositorRecycle();
|
||||
|
||||
void SendFenceHandleIfPresent();
|
||||
|
||||
virtual bool RecvClientRecycle() MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvClearTextureHostSync() MOZ_OVERRIDE;
|
||||
@ -145,6 +147,14 @@ TextureHost::GetIPDLActor()
|
||||
return mActor;
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
TextureHost::SendFenceHandleIfPresent(PTextureParent* actor)
|
||||
{
|
||||
TextureParent* parent = static_cast<TextureParent*>(actor);
|
||||
parent->SendFenceHandleIfPresent();
|
||||
}
|
||||
|
||||
FenceHandle
|
||||
TextureHost::GetAndResetReleaseFenceHandle()
|
||||
{
|
||||
@ -704,6 +714,7 @@ void
|
||||
TextureParent::CompositorRecycle()
|
||||
{
|
||||
mTextureHost->ClearRecycleCallback();
|
||||
SendFenceHandleIfPresent();
|
||||
|
||||
if (mTextureHost->GetFlags() & TextureFlags::RECYCLE) {
|
||||
mozilla::unused << SendCompositorRecycle();
|
||||
@ -713,6 +724,28 @@ TextureParent::CompositorRecycle()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TextureParent::SendFenceHandleIfPresent()
|
||||
{
|
||||
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
|
||||
if (mTextureHost) {
|
||||
TextureHostOGL* hostOGL = mTextureHost->AsHostOGL();
|
||||
if (!hostOGL) {
|
||||
return;
|
||||
}
|
||||
android::sp<android::Fence> fence = hostOGL->GetAndResetReleaseFence();
|
||||
if (fence.get() && fence->isValid()) {
|
||||
// HWC might not provide Fence.
|
||||
// In this case, HWC implicitly handles buffer's fence.
|
||||
|
||||
FenceHandle handle = FenceHandle(fence);
|
||||
RefPtr<FenceDeliveryTracker> tracker = new FenceDeliveryTracker(handle);
|
||||
mCompositableManager->SendFenceHandle(tracker, this, handle);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
TextureParent::RecvClientRecycle()
|
||||
{
|
||||
|
@ -421,6 +421,8 @@ public:
|
||||
*/
|
||||
PTextureParent* GetIPDLActor();
|
||||
|
||||
static void SendFenceHandleIfPresent(PTextureParent* actor);
|
||||
|
||||
FenceHandle GetAndResetReleaseFenceHandle();
|
||||
|
||||
/**
|
||||
|
@ -162,7 +162,7 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
|
||||
MOZ_ASSERT(tex.get());
|
||||
compositable->RemoveTextureHost(tex);
|
||||
// send FenceHandle if present.
|
||||
SendFenceHandleIfPresent(op.textureParent(), compositable);
|
||||
TextureHost::SendFenceHandleIfPresent(op.textureParent());
|
||||
break;
|
||||
}
|
||||
case CompositableOperation::TOpRemoveTextureAsync: {
|
||||
@ -179,8 +179,7 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
|
||||
GetChildProcessId(),
|
||||
op.holderId(),
|
||||
op.transactionId(),
|
||||
op.textureParent(),
|
||||
compositable);
|
||||
op.textureParent());
|
||||
|
||||
// If the message is recievied via PLayerTransaction,
|
||||
// Send message back via PImageBridge.
|
||||
@ -191,7 +190,7 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
|
||||
op.transactionId()));
|
||||
} else {
|
||||
// send FenceHandle if present.
|
||||
SendFenceHandleIfPresent(op.textureParent(), compositable);
|
||||
TextureHost::SendFenceHandleIfPresent(op.textureParent());
|
||||
|
||||
ReplyRemoveTexture(OpReplyRemoveTexture(false, // isMain
|
||||
op.holderId(),
|
||||
@ -259,42 +258,6 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CompositableParentManager::SendPendingAsyncMessges()
|
||||
{
|
||||
if (mPendingAsyncMessage.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Some type of AsyncParentMessageData message could have
|
||||
// one file descriptor (e.g. OpDeliverFence).
|
||||
// A number of file descriptors per gecko ipc message have a limitation
|
||||
// on OS_POSIX (MACOSX or LINUX).
|
||||
#if defined(OS_POSIX)
|
||||
static const uint32_t kMaxMessageNumber = FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE;
|
||||
#else
|
||||
// default number that works everywhere else
|
||||
static const uint32_t kMaxMessageNumber = 250;
|
||||
#endif
|
||||
|
||||
InfallibleTArray<AsyncParentMessageData> messages;
|
||||
messages.SetCapacity(mPendingAsyncMessage.size());
|
||||
for (size_t i = 0; i < mPendingAsyncMessage.size(); i++) {
|
||||
messages.AppendElement(mPendingAsyncMessage[i]);
|
||||
// Limit maximum number of messages.
|
||||
if (messages.Length() >= kMaxMessageNumber) {
|
||||
SendAsyncMessage(messages);
|
||||
// Initialize Messages.
|
||||
messages.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (messages.Length() > 0) {
|
||||
SendAsyncMessage(messages);
|
||||
}
|
||||
mPendingAsyncMessage.clear();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
|
@ -30,17 +30,12 @@ class CompositableParentManager : public ISurfaceAllocator
|
||||
, public AsyncTransactionTrackersHolder
|
||||
{
|
||||
public:
|
||||
virtual void SendFenceHandleIfPresent(PTextureParent* aTexture,
|
||||
CompositableHost* aCompositableHost) = 0;
|
||||
|
||||
virtual void SendFenceHandle(AsyncTransactionTracker* aTracker,
|
||||
PTextureParent* aTexture,
|
||||
const FenceHandle& aFence) = 0;
|
||||
|
||||
virtual void SendAsyncMessage(const InfallibleTArray<AsyncParentMessageData>& aMessage) = 0;
|
||||
|
||||
void SendPendingAsyncMessges();
|
||||
|
||||
/**
|
||||
* Get child side's process Id.
|
||||
*/
|
||||
@ -62,7 +57,6 @@ protected:
|
||||
|
||||
virtual void ReplyRemoveTexture(const OpReplyRemoveTexture& aReply) {}
|
||||
|
||||
std::vector<AsyncParentMessageData> mPendingAsyncMessage;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
@ -26,7 +26,6 @@ struct FenceHandle {
|
||||
explicit FenceHandle(const FenceHandleFromChild& aFenceHandle) {}
|
||||
bool operator==(const FenceHandle&) const { return false; }
|
||||
bool IsValid() const { return false; }
|
||||
void Merge(const FenceHandle& aFenceHandle) {}
|
||||
};
|
||||
|
||||
struct FenceHandleFromChild {
|
||||
|
@ -49,7 +49,6 @@ ParamTraits<FenceHandle>::Write(Message* aMsg,
|
||||
flattenable->flatten(data, nbytes, fds, nfds);
|
||||
#endif
|
||||
aMsg->WriteSize(nbytes);
|
||||
aMsg->WriteSize(nfds);
|
||||
aMsg->WriteBytes(data, nbytes);
|
||||
for (size_t n = 0; n < nfds; ++n) {
|
||||
// These buffers can't die in transit because they're created
|
||||
@ -64,20 +63,14 @@ ParamTraits<FenceHandle>::Read(const Message* aMsg,
|
||||
void** aIter, paramType* aResult)
|
||||
{
|
||||
size_t nbytes;
|
||||
size_t nfds;
|
||||
const char* data;
|
||||
|
||||
if (!aMsg->ReadSize(aIter, &nbytes) ||
|
||||
!aMsg->ReadSize(aIter, &nfds) ||
|
||||
!aMsg->ReadBytes(aIter, &data, nbytes)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if nfds is correct.
|
||||
// aMsg->num_fds() could include fds of another ParamTraits<>s.
|
||||
if (nfds > aMsg->num_fds()) {
|
||||
return false;
|
||||
}
|
||||
size_t nfds = aMsg->num_fds();
|
||||
int fds[nfds];
|
||||
|
||||
for (size_t n = 0; n < nfds; ++n) {
|
||||
@ -145,7 +138,6 @@ ParamTraits<FenceHandleFromChild>::Write(Message* aMsg,
|
||||
flattenable->flatten(data, nbytes, fds, nfds);
|
||||
#endif
|
||||
aMsg->WriteSize(nbytes);
|
||||
aMsg->WriteSize(nfds);
|
||||
aMsg->WriteBytes(data, nbytes);
|
||||
for (size_t n = 0; n < nfds; ++n) {
|
||||
// If the Fence was shared cross-process, SCM_RIGHTS does
|
||||
@ -169,20 +161,14 @@ ParamTraits<FenceHandleFromChild>::Read(const Message* aMsg,
|
||||
void** aIter, paramType* aResult)
|
||||
{
|
||||
size_t nbytes;
|
||||
size_t nfds;
|
||||
const char* data;
|
||||
|
||||
if (!aMsg->ReadSize(aIter, &nbytes) ||
|
||||
!aMsg->ReadSize(aIter, &nfds) ||
|
||||
!aMsg->ReadBytes(aIter, &data, nbytes)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if nfds is correct.
|
||||
// aMsg->num_fds() could include fds of another ParamTraits<>s.
|
||||
if (nfds > aMsg->num_fds()) {
|
||||
return false;
|
||||
}
|
||||
size_t nfds = aMsg->num_fds();
|
||||
int fds[nfds];
|
||||
|
||||
for (size_t n = 0; n < nfds; ++n) {
|
||||
@ -225,30 +211,6 @@ FenceHandle::FenceHandle(const FenceHandleFromChild& aFenceHandle) {
|
||||
mFence = aFenceHandle.mFence;
|
||||
}
|
||||
|
||||
void
|
||||
FenceHandle::Merge(const FenceHandle& aFenceHandle)
|
||||
{
|
||||
if (!aFenceHandle.IsValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsValid()) {
|
||||
mFence = aFenceHandle.mFence;
|
||||
} else {
|
||||
android::sp<android::Fence> mergedFence = android::Fence::merge(
|
||||
android::String8::format("FenceHandle"),
|
||||
mFence, aFenceHandle.mFence);
|
||||
if (!mergedFence.get()) {
|
||||
// synchronization is broken, the best we can do is hope fences
|
||||
// signal in order so the new fence will act like a union.
|
||||
// This error handling is same as android::ConsumerBase does.
|
||||
mFence = aFenceHandle.mFence;
|
||||
return;
|
||||
}
|
||||
mFence = mergedFence;
|
||||
}
|
||||
}
|
||||
|
||||
FenceHandleFromChild::FenceHandleFromChild(const sp<Fence>& aFence)
|
||||
: mFence(aFence)
|
||||
{
|
||||
|
@ -23,9 +23,9 @@ struct FenceHandle {
|
||||
|
||||
FenceHandle()
|
||||
{ }
|
||||
explicit FenceHandle(const android::sp<Fence>& aFence);
|
||||
FenceHandle(const android::sp<Fence>& aFence);
|
||||
|
||||
explicit FenceHandle(const FenceHandleFromChild& aFenceHandle);
|
||||
FenceHandle(const FenceHandleFromChild& aFenceHandle);
|
||||
|
||||
bool operator==(const FenceHandle& aOther) const {
|
||||
return mFence.get() == aOther.mFence.get();
|
||||
@ -36,8 +36,6 @@ struct FenceHandle {
|
||||
return mFence.get() && mFence->isValid();
|
||||
}
|
||||
|
||||
void Merge(const FenceHandle& aFenceHandle);
|
||||
|
||||
android::sp<Fence> mFence;
|
||||
};
|
||||
|
||||
@ -46,9 +44,9 @@ struct FenceHandleFromChild {
|
||||
|
||||
FenceHandleFromChild()
|
||||
{ }
|
||||
explicit FenceHandleFromChild(const android::sp<Fence>& aFence);
|
||||
FenceHandleFromChild(const android::sp<Fence>& aFence);
|
||||
|
||||
explicit FenceHandleFromChild(const FenceHandle& aFence) {
|
||||
FenceHandleFromChild(const FenceHandle& aFence) {
|
||||
mFence = aFence.mFence;
|
||||
}
|
||||
|
||||
|
@ -96,25 +96,9 @@ ImageBridgeParent::ActorDestroy(ActorDestroyReason aWhy)
|
||||
NewRunnableMethod(this, &ImageBridgeParent::DeferredDestroy));
|
||||
}
|
||||
|
||||
class MOZ_STACK_CLASS AutoImageBridgeParentAsyncMessageSender
|
||||
{
|
||||
public:
|
||||
explicit AutoImageBridgeParentAsyncMessageSender(ImageBridgeParent* aImageBridge)
|
||||
: mImageBridge(aImageBridge) {}
|
||||
|
||||
~AutoImageBridgeParentAsyncMessageSender()
|
||||
{
|
||||
mImageBridge->SendPendingAsyncMessges();
|
||||
}
|
||||
private:
|
||||
ImageBridgeParent* mImageBridge;
|
||||
};
|
||||
|
||||
bool
|
||||
ImageBridgeParent::RecvUpdate(const EditArray& aEdits, EditReplyArray* aReply)
|
||||
{
|
||||
AutoImageBridgeParentAsyncMessageSender autoAsyncMessageSender(this);
|
||||
|
||||
// If we don't actually have a compositor, then don't bother
|
||||
// creating any textures.
|
||||
if (Compositor::GetBackend() == LayersBackend::LAYERS_NONE) {
|
||||
@ -352,7 +336,9 @@ bool ImageBridgeParent::IsSameProcess() const
|
||||
void
|
||||
ImageBridgeParent::ReplyRemoveTexture(const OpReplyRemoveTexture& aReply)
|
||||
{
|
||||
mPendingAsyncMessage.push_back(aReply);
|
||||
InfallibleTArray<AsyncParentMessageData> messages;
|
||||
messages.AppendElement(aReply);
|
||||
mozilla::unused << SendParentAsyncMessages(messages);
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
@ -366,80 +352,35 @@ ImageBridgeParent::ReplyRemoveTexture(base::ProcessId aChildProcessId,
|
||||
imageBridge->ReplyRemoveTexture(aReply);
|
||||
}
|
||||
|
||||
void
|
||||
ImageBridgeParent::SendFenceHandleIfPresent(PTextureParent* aTexture,
|
||||
CompositableHost* aCompositableHost)
|
||||
{
|
||||
RefPtr<TextureHost> texture = TextureHost::AsTextureHost(aTexture);
|
||||
if (!texture) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Send a ReleaseFence of CompositorOGL.
|
||||
if (aCompositableHost && aCompositableHost->GetCompositor()) {
|
||||
FenceHandle fence = aCompositableHost->GetCompositor()->GetReleaseFence();
|
||||
if (fence.IsValid()) {
|
||||
RefPtr<FenceDeliveryTracker> tracker = new FenceDeliveryTracker(fence);
|
||||
HoldUntilComplete(tracker);
|
||||
mPendingAsyncMessage.push_back(OpDeliverFence(tracker->GetId(),
|
||||
aTexture, nullptr,
|
||||
fence));
|
||||
}
|
||||
}
|
||||
|
||||
// Send a ReleaseFence that is set by HwcComposer2D.
|
||||
FenceHandle fence = texture->GetAndResetReleaseFenceHandle();
|
||||
if (fence.IsValid()) {
|
||||
RefPtr<FenceDeliveryTracker> tracker = new FenceDeliveryTracker(fence);
|
||||
HoldUntilComplete(tracker);
|
||||
mPendingAsyncMessage.push_back(OpDeliverFence(tracker->GetId(),
|
||||
aTexture, nullptr,
|
||||
fence));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
/*static*/ void
|
||||
ImageBridgeParent::SendFenceHandleToTrackerIfPresent(uint64_t aDestHolderId,
|
||||
uint64_t aTransactionId,
|
||||
PTextureParent* aTexture,
|
||||
CompositableHost* aCompositableHost)
|
||||
PTextureParent* aTexture)
|
||||
{
|
||||
RefPtr<TextureHost> texture = TextureHost::AsTextureHost(aTexture);
|
||||
if (!texture) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Send a ReleaseFence of CompositorOGL.
|
||||
if (aCompositableHost && aCompositableHost->GetCompositor()) {
|
||||
FenceHandle fence = aCompositableHost->GetCompositor()->GetReleaseFence();
|
||||
if (fence.IsValid()) {
|
||||
RefPtr<FenceDeliveryTracker> tracker = new FenceDeliveryTracker(fence);
|
||||
HoldUntilComplete(tracker);
|
||||
mPendingAsyncMessage.push_back(OpDeliverFenceToTracker(tracker->GetId(),
|
||||
aDestHolderId,
|
||||
aTransactionId,
|
||||
fence));
|
||||
}
|
||||
}
|
||||
|
||||
// Send a ReleaseFence that is set by HwcComposer2D.
|
||||
FenceHandle fence = texture->GetAndResetReleaseFenceHandle();
|
||||
if (fence.IsValid()) {
|
||||
RefPtr<FenceDeliveryTracker> tracker = new FenceDeliveryTracker(fence);
|
||||
HoldUntilComplete(tracker);
|
||||
mPendingAsyncMessage.push_back(OpDeliverFenceToTracker(tracker->GetId(),
|
||||
aDestHolderId,
|
||||
aTransactionId,
|
||||
fence));
|
||||
if (!fence.IsValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<FenceDeliveryTracker> tracker = new FenceDeliveryTracker(fence);
|
||||
HoldUntilComplete(tracker);
|
||||
InfallibleTArray<AsyncParentMessageData> messages;
|
||||
messages.AppendElement(OpDeliverFenceToTracker(tracker->GetId(),
|
||||
aDestHolderId,
|
||||
aTransactionId,
|
||||
fence));
|
||||
mozilla::unused << SendParentAsyncMessages(messages);
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
ImageBridgeParent::SendFenceHandleToTrackerIfPresent(base::ProcessId aChildProcessId,
|
||||
uint64_t aDestHolderId,
|
||||
uint64_t aTransactionId,
|
||||
PTextureParent* aTexture,
|
||||
CompositableHost* aCompositableHost)
|
||||
PTextureParent* aTexture)
|
||||
{
|
||||
ImageBridgeParent* imageBridge = ImageBridgeParent::GetInstance(aChildProcessId);
|
||||
if (!imageBridge) {
|
||||
@ -447,19 +388,9 @@ ImageBridgeParent::SendFenceHandleToTrackerIfPresent(base::ProcessId aChildProce
|
||||
}
|
||||
imageBridge->SendFenceHandleToTrackerIfPresent(aDestHolderId,
|
||||
aTransactionId,
|
||||
aTexture,
|
||||
aCompositableHost);
|
||||
aTexture);
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
ImageBridgeParent::SendPendingAsyncMessges(base::ProcessId aChildProcessId)
|
||||
{
|
||||
ImageBridgeParent* imageBridge = ImageBridgeParent::GetInstance(aChildProcessId);
|
||||
if (!imageBridge) {
|
||||
return;
|
||||
}
|
||||
imageBridge->SendPendingAsyncMessges();
|
||||
}
|
||||
|
||||
} // layers
|
||||
} // mozilla
|
||||
|
@ -56,9 +56,6 @@ public:
|
||||
Create(Transport* aTransport, ProcessId aChildProcessId);
|
||||
|
||||
// CompositableParentManager
|
||||
virtual void SendFenceHandleIfPresent(PTextureParent* aTexture,
|
||||
CompositableHost* aCompositableHost) MOZ_OVERRIDE;
|
||||
|
||||
virtual void SendFenceHandle(AsyncTransactionTracker* aTracker,
|
||||
PTextureParent* aTexture,
|
||||
const FenceHandle& aFence) MOZ_OVERRIDE;
|
||||
@ -125,17 +122,12 @@ public:
|
||||
|
||||
void SendFenceHandleToTrackerIfPresent(uint64_t aDestHolderId,
|
||||
uint64_t aTransactionId,
|
||||
PTextureParent* aTexture,
|
||||
CompositableHost* aCompositableHost);
|
||||
PTextureParent* aTexture);
|
||||
|
||||
static void SendFenceHandleToTrackerIfPresent(base::ProcessId aChildProcessId,
|
||||
uint64_t aDestHolderId,
|
||||
uint64_t aTransactionId,
|
||||
PTextureParent* aTexture,
|
||||
CompositableHost* aCompositableHost);
|
||||
|
||||
using CompositableParentManager::SendPendingAsyncMessges;
|
||||
static void SendPendingAsyncMessges(base::ProcessId aChildProcessId);
|
||||
PTextureParent* aTexture);
|
||||
|
||||
static ImageBridgeParent* GetInstance(ProcessId aId);
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "mozilla/layers/ColorLayerComposite.h"
|
||||
#include "mozilla/layers/Compositor.h" // for Compositor
|
||||
#include "mozilla/layers/ContainerLayerComposite.h"
|
||||
#include "mozilla/layers/ImageBridgeParent.h" // for ImageBridgeParent
|
||||
#include "mozilla/layers/ImageLayerComposite.h"
|
||||
#include "mozilla/layers/LayerManagerComposite.h"
|
||||
#include "mozilla/layers/LayersMessages.h" // for EditReply, etc
|
||||
@ -193,21 +192,6 @@ LayerTransactionParent::RecvUpdateNoSwap(const InfallibleTArray<Edit>& cset,
|
||||
aTransactionStart, nullptr);
|
||||
}
|
||||
|
||||
class MOZ_STACK_CLASS AutoLayerTransactionParentAsyncMessageSender
|
||||
{
|
||||
public:
|
||||
explicit AutoLayerTransactionParentAsyncMessageSender(LayerTransactionParent* aLayerTransaction)
|
||||
: mLayerTransaction(aLayerTransaction) {}
|
||||
|
||||
~AutoLayerTransactionParentAsyncMessageSender()
|
||||
{
|
||||
mLayerTransaction->SendPendingAsyncMessges();
|
||||
ImageBridgeParent::SendPendingAsyncMessges(mLayerTransaction->GetChildProcessId());
|
||||
}
|
||||
private:
|
||||
LayerTransactionParent* mLayerTransaction;
|
||||
};
|
||||
|
||||
bool
|
||||
LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
||||
const uint64_t& aTransactionId,
|
||||
@ -239,7 +223,6 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
||||
}
|
||||
|
||||
EditReplyVector replyv;
|
||||
AutoLayerTransactionParentAsyncMessageSender autoAsyncMessageSender(this);
|
||||
|
||||
{
|
||||
AutoResolveRefLayers resolve(mShadowLayersManager->GetCompositionManager(this));
|
||||
@ -906,38 +889,6 @@ bool LayerTransactionParent::IsSameProcess() const
|
||||
return OtherProcess() == ipc::kInvalidProcessHandle;
|
||||
}
|
||||
|
||||
void
|
||||
LayerTransactionParent::SendFenceHandleIfPresent(PTextureParent* aTexture,
|
||||
CompositableHost* aCompositableHost)
|
||||
{
|
||||
RefPtr<TextureHost> texture = TextureHost::AsTextureHost(aTexture);
|
||||
if (!texture) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Send a ReleaseFence of CompositorOGL.
|
||||
if (aCompositableHost && aCompositableHost->GetCompositor()) {
|
||||
FenceHandle fence = aCompositableHost->GetCompositor()->GetReleaseFence();
|
||||
if (fence.IsValid()) {
|
||||
RefPtr<FenceDeliveryTracker> tracker = new FenceDeliveryTracker(fence);
|
||||
HoldUntilComplete(tracker);
|
||||
mPendingAsyncMessage.push_back(OpDeliverFence(tracker->GetId(),
|
||||
aTexture, nullptr,
|
||||
fence));
|
||||
}
|
||||
}
|
||||
|
||||
// Send a ReleaseFence that is set by HwcComposer2D.
|
||||
FenceHandle fence = texture->GetAndResetReleaseFenceHandle();
|
||||
if (fence.IsValid()) {
|
||||
RefPtr<FenceDeliveryTracker> tracker = new FenceDeliveryTracker(fence);
|
||||
HoldUntilComplete(tracker);
|
||||
mPendingAsyncMessage.push_back(OpDeliverFence(tracker->GetId(),
|
||||
aTexture, nullptr,
|
||||
fence));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LayerTransactionParent::SendFenceHandle(AsyncTransactionTracker* aTracker,
|
||||
PTextureParent* aTexture,
|
||||
|
@ -86,9 +86,6 @@ public:
|
||||
void SetPendingTransactionId(uint64_t aId) { mPendingTransaction = aId; }
|
||||
|
||||
// CompositableParentManager
|
||||
virtual void SendFenceHandleIfPresent(PTextureParent* aTexture,
|
||||
CompositableHost* aCompositableHost) MOZ_OVERRIDE;
|
||||
|
||||
virtual void SendFenceHandle(AsyncTransactionTracker* aTracker,
|
||||
PTextureParent* aTexture,
|
||||
const FenceHandle& aFence) MOZ_OVERRIDE;
|
||||
|
@ -1398,33 +1398,49 @@ CompositorOGL::SetFBAcquireFence(Layer* aLayer)
|
||||
return;
|
||||
}
|
||||
|
||||
android::sp<android::Fence> fence = new android::Fence(GetGonkDisplay()->GetPrevFBAcquireFd());
|
||||
if (fence.get() && fence->isValid()) {
|
||||
FenceHandle handle = FenceHandle(fence);
|
||||
mReleaseFenceHandle.Merge(handle);
|
||||
const nsIntRegion& visibleRegion = aLayer->GetEffectiveVisibleRegion();
|
||||
if (visibleRegion.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
FenceHandle
|
||||
CompositorOGL::GetReleaseFence()
|
||||
{
|
||||
if (!mReleaseFenceHandle.IsValid()) {
|
||||
return FenceHandle();
|
||||
// Set FBAcquireFence on ContainerLayer's childs
|
||||
ContainerLayer* container = aLayer->AsContainerLayer();
|
||||
if (container) {
|
||||
for (Layer* child = container->GetFirstChild(); child; child = child->GetNextSibling()) {
|
||||
SetFBAcquireFence(child);
|
||||
}
|
||||
return;
|
||||
}
|
||||
return FenceHandle(new android::Fence(mReleaseFenceHandle.mFence->dup()));
|
||||
}
|
||||
|
||||
// Set FBAcquireFence as tiles' ReleaseFence on TiledLayerComposer.
|
||||
TiledLayerComposer* composer = nullptr;
|
||||
LayerComposite* shadow = aLayer->AsLayerComposite();
|
||||
// Only ask for the composer if we have a compositable host. Timing
|
||||
// may make it so that we don't - see bug 1000634.
|
||||
if (shadow && shadow->GetCompositableHost()) {
|
||||
composer = shadow->GetTiledLayerComposer();
|
||||
if (composer) {
|
||||
composer->SetReleaseFence(new android::Fence(GetGonkDisplay()->GetPrevFBAcquireFd()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Set FBAcquireFence as layer buffer's ReleaseFence
|
||||
LayerRenderState state = aLayer->GetRenderState();
|
||||
if (!state.mTexture) {
|
||||
return;
|
||||
}
|
||||
TextureHostOGL* texture = state.mTexture->AsHostOGL();
|
||||
if (!texture) {
|
||||
return;
|
||||
}
|
||||
texture->SetReleaseFence(new android::Fence(GetGonkDisplay()->GetPrevFBAcquireFd()));
|
||||
}
|
||||
#else
|
||||
void
|
||||
CompositorOGL::SetFBAcquireFence(Layer* aLayer)
|
||||
{
|
||||
}
|
||||
|
||||
FenceHandle
|
||||
CompositorOGL::GetReleaseFence()
|
||||
{
|
||||
return FenceHandle();
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
|
@ -209,7 +209,6 @@ public:
|
||||
|
||||
virtual void EndFrame() MOZ_OVERRIDE;
|
||||
virtual void SetFBAcquireFence(Layer* aLayer) MOZ_OVERRIDE;
|
||||
virtual FenceHandle GetReleaseFence() MOZ_OVERRIDE;
|
||||
virtual void EndFrameForExternalComposition(const gfx::Matrix& aTransform) MOZ_OVERRIDE;
|
||||
virtual void AbortFrame() MOZ_OVERRIDE;
|
||||
|
||||
@ -394,8 +393,6 @@ private:
|
||||
* FlipY for the y-flipping calculation.
|
||||
*/
|
||||
GLint mHeight;
|
||||
|
||||
FenceHandle mReleaseFenceHandle;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user