Bug 1215050 - Make layerscope support TiledPaintedLayer when using HWC. r=mattwoodrow, r=cjku

--HG--
extra : rebase_source : 3a606457d9c7cd630b6c9ab38941e2619b03943e
This commit is contained in:
JerryShih 2015-10-15 06:03:00 -04:00
parent 6a3c5ff854
commit 66c7ddec13
3 changed files with 35 additions and 2 deletions

View File

@ -979,7 +979,9 @@ SenderHelper::SendLayer(LayerComposite* aLayer,
case Layer::TYPE_COLOR: {
EffectChain effect;
aLayer->GenEffectChain(effect);
SenderHelper::SendEffectChain(nullptr, effect, aWidth, aHeight);
LayerScope::DrawBegin();
LayerScope::DrawEnd(nullptr, effect, aWidth, aHeight);
break;
}
case Layer::TYPE_IMAGE:
@ -995,7 +997,9 @@ SenderHelper::SendLayer(LayerComposite* aLayer,
// Generate primary effect (lock and gen)
AutoLockCompositableHost lock(compHost);
aLayer->GenEffectChain(effect);
SenderHelper::SendEffectChain(compOGL->gl(), effect);
LayerScope::DrawBegin();
LayerScope::DrawEnd(compOGL->gl(), effect, aWidth, aHeight);
}
break;
}
@ -1172,6 +1176,12 @@ SenderHelper::SendEffectChain(GLContext* aGLContext,
if (!sLayersBufferSendable) return;
const Effect* primaryEffect = aEffectChain.mPrimaryEffect;
MOZ_ASSERT(primaryEffect);
if (!primaryEffect) {
return;
}
switch (primaryEffect->mType) {
case EffectTypes::RGB: {
const TexturedEffect* texturedEffect =

View File

@ -69,6 +69,27 @@ TiledContentHost::~TiledContentHost()
MOZ_COUNT_DTOR(TiledContentHost);
}
already_AddRefed<TexturedEffect>
TiledContentHost::GenEffect(const gfx::Filter& aFilter)
{
// If we can use hwc for this TiledContentHost, it implies that we have exactly
// one high precision tile. Please check TiledContentHost::GetRenderState() for
// all condition.
MOZ_ASSERT(mTiledBuffer.GetTileCount() == 1 && mLowPrecisionTiledBuffer.GetTileCount() == 0);
MOZ_ASSERT(mTiledBuffer.GetTile(0).mTextureHost);
TileHost& tile = mTiledBuffer.GetTile(0);
if (!tile.mTextureHost->BindTextureSource(tile.mTextureSource)) {
return nullptr;
}
return CreateTexturedEffect(tile.mTextureSource,
nullptr,
aFilter,
true,
tile.mTextureHost->GetRenderState());
}
void
TiledContentHost::Attach(Layer* aLayer,
Compositor* aCompositor,

View File

@ -211,6 +211,8 @@ public:
return LayerRenderState();
}
// Generate effect for layerscope when using hwc.
virtual already_AddRefed<TexturedEffect> GenEffect(const gfx::Filter& aFilter) override;
virtual bool UpdateThebes(const ThebesBufferData& aData,
const nsIntRegion& aUpdated,