Skip to content

Commit

Permalink
CompositorParentStuff
Browse files Browse the repository at this point in the history
  • Loading branch information
rainemak committed Dec 19, 2016
1 parent e59245e commit 313efd0
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 19 deletions.
Expand Up @@ -163,15 +163,15 @@ EmbedLiteCompositorProcessParent::AllocPLayerTransactionParent(const nsTArray<La
// XXX: should be false, but that causes us to fail some tests on Mac w/ OMTC.
// Bug 900745. change *aSuccess to false to see test failures.
*aSuccess = true;
LayerTransactionParent* p = new LayerTransactionParent(nullptr, this, aId, mChildProcessId);
LayerTransactionParent* p = new LayerTransactionParent(nullptr, this, aId);
p->AddIPDLReference();
return p;
}

mCompositionManager = new AsyncCompositionManager(mLayerManager);
*aSuccess = true;
*aTextureFactoryIdentifier = mCompositor->GetTextureFactoryIdentifier();
LayerTransactionParent* p = new LayerTransactionParent(mLayerManager, this, aId, mChildProcessId);
LayerTransactionParent* p = new LayerTransactionParent(mLayerManager, this, aId);
p->AddIPDLReference();
return p;
}
Expand Down Expand Up @@ -200,11 +200,22 @@ EmbedLiteCompositorProcessParent::ShadowLayersUpdated(
bool aIsFirstPaint,
bool aScheduleComposite,
uint32_t aPaintSequenceNumber,
bool aIsRepeatTransaction)
bool aIsRepeatTransaction,
int32_t aPaintSyncId)
{
LOGT("Implement me");
Unused << aTransactionId;
Unused << aTargetConfig;
Unused << aPlugins;
Unused << aIsFirstPaint;
Unused << aScheduleComposite;
Unused << aPaintSequenceNumber;
Unused << aIsRepeatTransaction;
Unused << aPaintSyncId;

uint64_t id = aLayerTree->GetId();
MOZ_ASSERT(id != 0);
Unused << id;
}

void
Expand All @@ -219,6 +230,7 @@ EmbedLiteCompositorProcessParent::ForceComposite(LayerTransactionParent* aLayerT
LOGT("Implement me");
uint64_t id = aLayerTree->GetId();
MOZ_ASSERT(id != 0);
Unused << id;
}

bool
Expand All @@ -227,7 +239,7 @@ EmbedLiteCompositorProcessParent::SetTestSampleTime(LayerTransactionParent* aLay
LOGT("Implement me");
uint64_t id = aLayerTree->GetId();
MOZ_ASSERT(id != 0);

Unused << id;
return false;
}

Expand All @@ -237,6 +249,25 @@ EmbedLiteCompositorProcessParent::LeaveTestMode(LayerTransactionParent* aLayerTr
LOGT("Implement me");
uint64_t id = aLayerTree->GetId();
MOZ_ASSERT(id != 0);
Unused << id;
}

void
EmbedLiteCompositorProcessParent::ApplyAsyncProperties(LayerTransactionParent *aLayerTree)
{
LOGT("Implement me");
uint64_t id = aLayerTree->GetId();
MOZ_ASSERT(id != 0);
Unused << id;
}

void
EmbedLiteCompositorProcessParent::FlushApzRepaints(const LayerTransactionParent *aLayerTree)
{
LOGT("Implement me");
uint64_t id = aLayerTree->GetId();
MOZ_ASSERT(id != 0);
Unused << id;
}

void
Expand All @@ -246,15 +277,25 @@ EmbedLiteCompositorProcessParent::GetAPZTestData(const LayerTransactionParent* a
LOGT("Implement me");
uint64_t id = aLayerTree->GetId();
MOZ_ASSERT(id != 0);
Unused << id;
}

void
EmbedLiteCompositorProcessParent::SetConfirmedTargetAPZC(const LayerTransactionParent *aLayerTree, const uint64_t &aInputBlockId, const nsTArray<ScrollableLayerGuid> &aTargets)
{
LOGT("Implement me");
uint64_t id = aLayerTree->GetId();
MOZ_ASSERT(id != 0);
Unused << id;
}

AsyncCompositionManager*
EmbedLiteCompositorProcessParent::GetCompositionManager(LayerTransactionParent* aLayerTree)
{
LOGT("Implement me");
uint64_t id = aLayerTree->GetId();
MOZ_ASSERT(id != 0);
Unused << id;
return nullptr;
}

Expand Down
Expand Up @@ -33,22 +33,26 @@ class EmbedLiteCompositorProcessParent final : public PCompositorParent,

virtual void ActorDestroy(ActorDestroyReason aWhy) override;

virtual bool RecvGetFrameUniformity(FrameUniformityData* aOutData) override { return true; }
// FIXME/bug 774388: work out what shutdown protocol we need.
virtual bool RecvRequestOverfill() override { return true; }
virtual bool RecvWillStop() override { return true; }
virtual bool RecvStop() override { return true; }
virtual bool RecvPause() override { return true; }
virtual bool RecvResume() override { return true; }
virtual bool RecvNotifyHidden(const uint64_t& id) override { return true; }
virtual bool RecvNotifyVisible(const uint64_t& id) override { return true; }
virtual bool RecvNotifyChildCreated(const uint64_t& child) override;
virtual bool RecvAdoptChild(const uint64_t& child) override { return false; }
virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
const nsIntRect& aRect)
{ return true; }
const nsIntRect& aRect) { return true; }
virtual bool RecvMakeWidgetSnapshot(const SurfaceDescriptor& aInSnapshot) override { return true; }
virtual bool RecvFlushRendering() override { return true; }
virtual bool RecvGetTileSize(int32_t* aWidth, int32_t* aHeight) override;

virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) { return true; }
virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) override { return true; }
virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) override { return true; }
virtual bool RecvGetTileSize(int32_t* aWidth, int32_t* aHeight) override;

/**
* Tells this CompositorParent to send a message when the compositor has received the transaction.
Expand All @@ -70,16 +74,24 @@ class EmbedLiteCompositorProcessParent final : public PCompositorParent,
bool aIsFirstPaint,
bool aScheduleComposite,
uint32_t aPaintSequenceNumber,
bool aIsRepeatTransaction) override;
bool aIsRepeatTransaction,
int32_t aPaintSyncId) override;
virtual void ForceComposite(LayerTransactionParent* aLayerTree) override;
virtual bool SetTestSampleTime(LayerTransactionParent* aLayerTree,
const TimeStamp& aTime) override;
virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) override;
virtual void ApplyAsyncProperties(LayerTransactionParent* aLayerTree) override;
virtual void FlushApzRepaints(const LayerTransactionParent* aLayerTree) override;
virtual void GetAPZTestData(const LayerTransactionParent* aLayerTree,
APZTestData* aOutData) override;
virtual void SetConfirmedTargetAPZC(const LayerTransactionParent* aLayerTree,
const uint64_t& aInputBlockId,
const nsTArray<ScrollableLayerGuid>& aTargets) override;

virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aParent) override;

virtual bool RecvRemotePluginsReady() override { return false; }

void DidComposite(uint64_t aId);

/**
Expand Down
21 changes: 10 additions & 11 deletions embedding/embedlite/embedthread/EmbedLiteCompositorParent.cpp
Expand Up @@ -14,6 +14,7 @@
#include "mozilla/layers/AsyncCompositionManager.h"
#include "mozilla/layers/LayerTransactionParent.h"
#include "mozilla/layers/CompositorOGL.h"
#include "mozilla/layers/TextureClientSharedSurface.h" // for SharedSurfaceTextureClient
#include "mozilla/Preferences.h"
#include "gfxUtils.h"
#include "nsRefreshDriver.h"
Expand All @@ -25,7 +26,6 @@
#include "SharedSurfaceEGL.h" // for SurfaceFactory_EGLImage
#include "SharedSurfaceGL.h" // for SurfaceFactory_GLTexture, etc
#include "SurfaceTypes.h" // for SurfaceStreamType
#include "TextureClientSharedSurface.h" // for SharedSurfaceTextureClient
#include "ClientLayerManager.h" // for ClientLayerManager, etc

using namespace mozilla::layers;
Expand Down Expand Up @@ -98,23 +98,22 @@ EmbedLiteCompositorParent::PrepareOffscreen()
GLScreenBuffer* screen = context->Screen();
if (screen) {
UniquePtr<SurfaceFactory> factory;
if (context->GetContextType() == GLContextType::EGL) {
// [Basic/OGL Layers, OMTC] WebGL layer init.
auto forwarder = state->mLayerManager->AsShadowForwarder();

layers::TextureFlags flags = layers::TextureFlags::ORIGIN_BOTTOM_LEFT;

printf("=============== caps.premultAlpha: %d ptr: %p\n", screen->mCaps.premultAlpha, forwarder);
layers::TextureFlags flags = layers::TextureFlags::ORIGIN_BOTTOM_LEFT;
if (!screen->mCaps.premultAlpha) {
flags |= layers::TextureFlags::NON_PREMULTIPLIED;
}

if (!caps.premultAlpha) {
flags |= layers::TextureFlags::NON_PREMULTIPLIED;
}
auto forwarder = state->mLayerManager->AsShadowForwarder();
printf("=============== caps.premultAlpha: %d ptr: %p\n", screen->mCaps.premultAlpha, forwarder);
if (context->GetContextType() == GLContextType::EGL) {
// [Basic/OGL Layers, OMTC] WebGL layer init.
factory = SurfaceFactory_EGLImage::Create(context, screen->mCaps, forwarder, flags);
} else {
// [Basic Layers, OMTC] WebGL layer init.
// Well, this *should* work...
GLContext* nullConsGL = nullptr; // Bug 1050044.
factory = MakeUnique<SurfaceFactory_GLTexture>(context, nullConsGL, screen->mCaps);
factory = MakeUnique<SurfaceFactory_GLTexture>(context, screen->mCaps, forwarder, flags);
}
if (factory) {
screen->Morph(Move(factory));
Expand Down

0 comments on commit 313efd0

Please sign in to comment.