Bug 1321141 - make PWebRenderBridge manage PCompositable. r=sotaro?

Update PWebRenderBridge.ipdl to manage PCompositable.
Let WebRenderBridgeChild/Parent to implement CompositableForwarder and CompositableParentManager for compositable-op message.

MozReview-Commit-ID: 4m5jmDSL8xo
This commit is contained in:
JerryShih 2016-11-30 18:57:26 +08:00
Родитель f8cd0915ea
Коммит 44cd1a91cb
7 изменённых файлов: 188 добавлений и 7 удалений

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

@ -8,13 +8,14 @@
include protocol PLayerTransaction;
include protocol PImageBridge;
include protocol PCompositorBridge;
include protocol PWebRenderBridge;
namespace mozilla {
namespace layers {
async protocol PCompositable
{
manager PImageBridge or PLayerTransaction;
manager PImageBridge or PLayerTransaction or PWebRenderBridge;
child:
async __delete__();
parent:

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

@ -9,9 +9,11 @@ include LayersSurfaces;
include "mozilla/GfxMessageUtils.h";
include WebRenderMessages;
include protocol PCompositable;
include protocol PCompositorBridge;
include protocol PTexture;
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
using WRImageFormat from "mozilla/gfx/webrender.h";
using mozilla::gfx::ByteBuffer from "mozilla/layers/WebRenderTypes.h";
@ -21,8 +23,11 @@ namespace layers {
sync protocol PWebRenderBridge
{
manager PCompositorBridge;
manages PCompositable;
parent:
async PCompositable(TextureInfo aTextureInfo);
sync Create(uint32_t aWidth, uint32_t aHeight);
sync AddImage(uint32_t aWidth, uint32_t aHeight, uint32_t aStride,
WRImageFormat aFormat, ByteBuffer aBytes)

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

@ -5,6 +5,13 @@
* 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 LayersSurfaces;
include LayersMessages;
include protocol PCompositable;
include protocol PImageContainer;
include protocol PLayer;
include protocol PTexture;
using WRImageKey from "mozilla/gfx/webrender.h";
using WRRect from "mozilla/gfx/webrender.h";
using MaybeImageMask from "mozilla/layers/WebRenderTypes.h";

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

@ -9,7 +9,6 @@
#include "gfxPlatform.h"
#include "mozilla/layers/CompositorBridgeChild.h"
#include "mozilla/layers/ImageDataSerializer.h"
#include "mozilla/layers/WebRenderBridgeParent.h"
namespace mozilla {
namespace layers {
@ -122,5 +121,97 @@ WebRenderBridgeChild::GetLayersIPCActor()
return static_cast<LayersIPCActor*>(GetCompositorBridgeChild());
}
PCompositableChild*
WebRenderBridgeChild::AllocPCompositableChild(const TextureInfo& aInfo)
{
return nullptr;
}
bool
WebRenderBridgeChild::DeallocPCompositableChild(PCompositableChild* aActor)
{
return true;
}
void
WebRenderBridgeChild::Connect(CompositableClient* aCompositable,
ImageContainer* aImageContainer)
{
}
void
WebRenderBridgeChild::UseTiledLayerBuffer(CompositableClient* aCompositable,
const SurfaceDescriptorTiles& aTiledDescriptor)
{
}
void
WebRenderBridgeChild::UpdateTextureRegion(CompositableClient* aCompositable,
const ThebesBufferData& aThebesBufferData,
const nsIntRegion& aUpdatedRegion)
{
}
void
WebRenderBridgeChild::Destroy(CompositableChild* aCompositable)
{
}
bool
WebRenderBridgeChild::DestroyInTransaction(PTextureChild* aTexture, bool synchronously)
{
return true;
}
bool
WebRenderBridgeChild::DestroyInTransaction(PCompositableChild* aCompositable, bool synchronously)
{
return true;
}
void
WebRenderBridgeChild::RemoveTextureFromCompositable(CompositableClient* aCompositable,
TextureClient* aTexture)
{
}
void
WebRenderBridgeChild::UseTextures(CompositableClient* aCompositable,
const nsTArray<TimedTextureClient>& aTextures)
{
}
void
WebRenderBridgeChild::UseComponentAlphaTextures(CompositableClient* aCompositable,
TextureClient* aClientOnBlack,
TextureClient* aClientOnWhite)
{
}
void
WebRenderBridgeChild::UpdateFwdTransactionId()
{
}
uint64_t
WebRenderBridgeChild::GetFwdTransactionId()
{
return 0;
}
bool
WebRenderBridgeChild::InForwarderThread()
{
return NS_IsMainThread();
}
} // namespace layers
} // namespace mozilla

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

@ -7,7 +7,7 @@
#ifndef mozilla_layers_WebRenderBridgeChild_h
#define mozilla_layers_WebRenderBridgeChild_h
#include "mozilla/layers/KnowsCompositor.h"
#include "mozilla/layers/CompositableForwarder.h"
#include "mozilla/layers/PWebRenderBridgeChild.h"
namespace mozilla {
@ -22,7 +22,7 @@ class CompositorBridgeChild;
class TextureForwarder;
class WebRenderBridgeChild final : public PWebRenderBridgeChild
, public KnowsCompositor
, public CompositableForwarder
{
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebRenderBridgeChild, override)
@ -35,6 +35,7 @@ public:
void DPEnd(bool aIsSync = false);
CompositorBridgeChild* GetCompositorBridgeChild();
// KnowsCompositor
TextureForwarder* GetTextureForwarder() override;
LayersIPCActor* GetLayersIPCActor() override;
@ -49,12 +50,39 @@ public:
void Destroy();
bool IPCOpen() const { return mIPCOpen && !mDestroyed; }
bool IsDestroyed() const { return mDestroyed; }
protected:
private:
friend class CompositorBridgeChild;
~WebRenderBridgeChild() {}
virtual void ActorDestroy(ActorDestroyReason why) override;
// manage PCompositable
PCompositableChild* AllocPCompositableChild(const TextureInfo& aInfo) override;
bool DeallocPCompositableChild(PCompositableChild* aActor) override;
// CompositableForwarder
void Connect(CompositableClient* aCompositable,
ImageContainer* aImageContainer = nullptr) override;
void UseTiledLayerBuffer(CompositableClient* aCompositable,
const SurfaceDescriptorTiles& aTiledDescriptor) override;
void UpdateTextureRegion(CompositableClient* aCompositable,
const ThebesBufferData& aThebesBufferData,
const nsIntRegion& aUpdatedRegion) override;
void Destroy(CompositableChild* aCompositable);
bool DestroyInTransaction(PTextureChild* aTexture, bool synchronously) override;
bool DestroyInTransaction(PCompositableChild* aCompositable, bool synchronously) override;
void RemoveTextureFromCompositable(CompositableClient* aCompositable,
TextureClient* aTexture) override;
void UseTextures(CompositableClient* aCompositable,
const nsTArray<TimedTextureClient>& aTextures) override;
void UseComponentAlphaTextures(CompositableClient* aCompositable,
TextureClient* aClientOnBlack,
TextureClient* aClientOnWhite) override;
void UpdateFwdTransactionId() override;
uint64_t GetFwdTransactionId() override;
bool InForwarderThread() override;
void ActorDestroy(ActorDestroyReason why) override;
void AddIPDLReference() {
MOZ_ASSERT(mIPCOpen == false);

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

@ -428,5 +428,41 @@ WebRenderBridgeParent::ShouldParentObserveEpoch()
return true;
}
void
WebRenderBridgeParent::SendAsyncMessage(const InfallibleTArray<AsyncParentMessageData>& aMessage)
{
MOZ_ASSERT_UNREACHABLE("unexpected to be called");
}
void
WebRenderBridgeParent::NotifyNotUsed(PTextureParent* aTexture, uint64_t aTransactionId)
{
MOZ_ASSERT_UNREACHABLE("unexpected to be called");
}
base::ProcessId
WebRenderBridgeParent::GetChildProcessId()
{
return OtherPid();
}
bool
WebRenderBridgeParent::IsSameProcess() const
{
return OtherPid() == base::GetCurrentProcId();
}
PCompositableParent*
WebRenderBridgeParent::AllocPCompositableParent(const TextureInfo& aInfo)
{
return nullptr;
}
bool
WebRenderBridgeParent::DeallocPCompositableParent(PCompositableParent* aActor)
{
return true;
}
} // namespace layers
} // namespace mozilla

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

@ -8,9 +8,11 @@
#define mozilla_layers_WebRenderBridgeParent_h
#include "GLContextProvider.h"
#include "mozilla/layers/CompositableTransactionParent.h"
#include "mozilla/layers/CompositorVsyncSchedulerOwner.h"
#include "mozilla/layers/PWebRenderBridgeParent.h"
#include "mozilla/layers/WebRenderTypes.h"
#include "nsTArrayForwardDeclare.h"
namespace mozilla {
@ -30,6 +32,7 @@ class CompositorVsyncScheduler;
class WebRenderBridgeParent final : public PWebRenderBridgeParent
, public CompositorVsyncSchedulerOwner
, public CompositableParentManager
{
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebRenderBridgeParent)
@ -85,8 +88,18 @@ public:
void FinishPendingComposite() override { }
void CompositeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect = nullptr) override;
protected:
private:
virtual ~WebRenderBridgeParent();
virtual PCompositableParent* AllocPCompositableParent(const TextureInfo& aInfo) override;
bool DeallocPCompositableParent(PCompositableParent* aActor) override;
// CompositableParentManager
bool IsSameProcess() const override;
base::ProcessId GetChildProcessId() override;
void NotifyNotUsed(PTextureParent* aTexture, uint64_t aTransactionId) override;
void SendAsyncMessage(const InfallibleTArray<AsyncParentMessageData>& aMessage) override;
void DeleteOldImages();
void ProcessWebrenderCommands(InfallibleTArray<WebRenderCommand>& commands);
void ScheduleComposition();