Commit 50122dc1 authored by Sotaro Ikeda's avatar Sotaro Ikeda
Browse files

Bug 1253489 - Update SendFenceHandleIfPresent() r=nical

parent dd85c735
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -565,6 +565,10 @@ public:

  virtual void WaitAcquireFenceHandleSyncComplete() {};

  virtual bool NeedsFenceHandle() { return false; }

  virtual FenceHandle GetCompositorReleaseFence() { return FenceHandle(); }

protected:
  FenceHandle mReleaseFenceHandle;

+3 −4
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
      MOZ_ASSERT(tex.get());
      compositable->RemoveTextureHost(tex);
      // send FenceHandle if present.
      SendFenceHandleIfPresent(op.textureParent(), compositable);
      SendFenceHandleIfPresent(op.textureParent());
      break;
    }
    case CompositableOperation::TOpRemoveTextureAsync: {
@@ -150,8 +150,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.
@@ -161,7 +160,7 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
                                                  op.transactionId()));
      } else {
        // send FenceHandle if present.
        SendFenceHandleIfPresent(op.textureParent(), compositable);
        SendFenceHandleIfPresent(op.textureParent());

        ReplyRemoveTexture(OpReplyRemoveTexture(op.holderId(),
                                                op.transactionId()));
+1 −2
Original line number Diff line number Diff line
@@ -28,8 +28,7 @@ typedef std::vector<mozilla::layers::EditReply> EditReplyVector;
class CompositableParentManager : public ISurfaceAllocator
{
public:
  virtual void SendFenceHandleIfPresent(PTextureParent* aTexture,
                                        CompositableHost* aCompositableHost) = 0;
  virtual void SendFenceHandleIfPresent(PTextureParent* aTexture) = 0;

  virtual void SendAsyncMessage(const InfallibleTArray<AsyncParentMessageData>& aMessage) = 0;

+19 −27
Original line number Diff line number Diff line
@@ -451,25 +451,22 @@ ImageBridgeParent::ReplyRemoveTexture(base::ProcessId aChildProcessId,
}

void
ImageBridgeParent::SendFenceHandleIfPresent(PTextureParent* aTexture,
                                            CompositableHost* aCompositableHost)
ImageBridgeParent::SendFenceHandleIfPresent(PTextureParent* aTexture)
{
  RefPtr<TextureHost> texture = TextureHost::AsTextureHost(aTexture);
  if (!texture) {
  if (!texture || !texture->NeedsFenceHandle()) {
    return;
  }

  // Send a ReleaseFence of CompositorOGL.
  if (aCompositableHost && aCompositableHost->GetCompositor()) {
    FenceHandle fence = aCompositableHost->GetCompositor()->GetReleaseFence();
  FenceHandle fence = texture->GetCompositorReleaseFence();
  if (fence.IsValid()) {
    mPendingAsyncMessage.push_back(OpDeliverFence(aTexture, nullptr,
                                                  fence));
  }
  }

  // Send a ReleaseFence that is set by HwcComposer2D.
  FenceHandle fence = texture->GetAndResetReleaseFenceHandle();
  // Send a ReleaseFence that is set to TextureHost by HwcComposer2D.
  fence = texture->GetAndResetReleaseFenceHandle();
  if (fence.IsValid()) {
    mPendingAsyncMessage.push_back(OpDeliverFence(aTexture, nullptr,
                                                  fence));
@@ -479,26 +476,23 @@ ImageBridgeParent::SendFenceHandleIfPresent(PTextureParent* aTexture,
void
ImageBridgeParent::AppendDeliverFenceMessage(uint64_t aDestHolderId,
                                             uint64_t aTransactionId,
                                             PTextureParent* aTexture,
                                             CompositableHost* aCompositableHost)
                                             PTextureParent* aTexture)
{
  RefPtr<TextureHost> texture = TextureHost::AsTextureHost(aTexture);
  if (!texture) {
  if (!texture || !texture->NeedsFenceHandle()) {
    return;
  }

  // Send a ReleaseFence of CompositorOGL.
  if (aCompositableHost && aCompositableHost->GetCompositor()) {
    FenceHandle fence = aCompositableHost->GetCompositor()->GetReleaseFence();
  FenceHandle fence = texture->GetCompositorReleaseFence();
  if (fence.IsValid()) {
    mPendingAsyncMessage.push_back(OpDeliverFenceToTracker(aDestHolderId,
                                                           aTransactionId,
                                                           fence));
  }
  }

  // Send a ReleaseFence that is set by HwcComposer2D.
  FenceHandle fence = texture->GetAndResetReleaseFenceHandle();
  // Send a ReleaseFence that is set to TextureHost by HwcComposer2D.
  fence = texture->GetAndResetReleaseFenceHandle();
  if (fence.IsValid()) {
    mPendingAsyncMessage.push_back(OpDeliverFenceToTracker(aDestHolderId,
                                                           aTransactionId,
@@ -510,8 +504,7 @@ ImageBridgeParent::AppendDeliverFenceMessage(uint64_t aDestHolderId,
ImageBridgeParent::AppendDeliverFenceMessage(base::ProcessId aChildProcessId,
                                             uint64_t aDestHolderId,
                                             uint64_t aTransactionId,
                                             PTextureParent* aTexture,
                                             CompositableHost* aCompositableHost)
                                             PTextureParent* aTexture)
{
  ImageBridgeParent* imageBridge = ImageBridgeParent::GetInstance(aChildProcessId);
  if (!imageBridge) {
@@ -519,8 +512,7 @@ ImageBridgeParent::AppendDeliverFenceMessage(base::ProcessId aChildProcessId,
  }
  imageBridge->AppendDeliverFenceMessage(aDestHolderId,
                                         aTransactionId,
                                         aTexture,
                                         aCompositableHost);
                                         aTexture);
}

/*static*/ void
+3 −6
Original line number Diff line number Diff line
@@ -56,8 +56,7 @@ public:
  Create(Transport* aTransport, ProcessId aChildProcessId);

  // CompositableParentManager
  virtual void SendFenceHandleIfPresent(PTextureParent* aTexture,
                                        CompositableHost* aCompositableHost) override;
  virtual void SendFenceHandleIfPresent(PTextureParent* aTexture) override;

  virtual void SendAsyncMessage(const InfallibleTArray<AsyncParentMessageData>& aMessage) override;

@@ -121,14 +120,12 @@ public:

  void AppendDeliverFenceMessage(uint64_t aDestHolderId,
                                 uint64_t aTransactionId,
                                 PTextureParent* aTexture,
                                 CompositableHost* aCompositableHost);
                                 PTextureParent* aTexture);

  static void AppendDeliverFenceMessage(base::ProcessId aChildProcessId,
                                        uint64_t aDestHolderId,
                                        uint64_t aTransactionId,
                                        PTextureParent* aTexture,
                                        CompositableHost* aCompositableHost);
                                        PTextureParent* aTexture);

  using CompositableParentManager::SendPendingAsyncMessages;
  static void SendPendingAsyncMessages(base::ProcessId aChildProcessId);
Loading