Bug 739679 - Part 2.5: Add TiledBuffer IPC code. r=cjones

This commit is contained in:
Benoit Girard 2012-04-13 11:17:39 -04:00
Родитель 192b1f243d
Коммит 3e67e3b195
4 изменённых файлов: 50 добавлений и 0 удалений

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

@ -162,6 +162,13 @@ struct OpPaintThebesBuffer {
nsIntRegion updatedRegion;
};
struct OpPaintTiledLayerBuffer {
PLayer layer;
// Bug 747811
// FIXME: We need to support sharing tile across process.
uintptr_t tiledLayerBuffer;
};
struct OpPaintCanvas {
PLayer layer;
CanvasSurface newFrontBuffer;
@ -190,6 +197,7 @@ union Edit {
OpRemoveChild;
OpPaintThebesBuffer;
OpPaintTiledLayerBuffer;
OpPaintCanvas;
OpPaintImage;
};

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

@ -52,6 +52,7 @@
#include "gfxipc/ShadowLayerUtils.h"
#include "RenderTrace.h"
#include "sampler.h"
#include "nsXULAppAPI.h"
using namespace mozilla::ipc;
@ -239,6 +240,17 @@ ShadowLayerForwarder::PaintedThebesBuffer(ShadowableLayer* aThebes,
aBufferRotation),
aUpdatedRegion));
}
void
ShadowLayerForwarder::PaintedTiledLayerBuffer(ShadowableLayer* aLayer,
BasicTiledLayerBuffer* aTiledLayerBuffer)
{
if (XRE_GetProcessType() != GeckoProcessType_Default)
NS_RUNTIMEABORT("PaintedTiledLayerBuffer must be made IPC safe (not share pointers)");
mTxn->AddPaint(OpPaintTiledLayerBuffer(NULL, Shadow(aLayer),
uintptr_t(aTiledLayerBuffer)));
}
void
ShadowLayerForwarder::PaintedImage(ShadowableLayer* aImage,
const SharedImage& aNewFrontImage)

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

@ -65,9 +65,11 @@ class ShadowColorLayer;
class ShadowCanvasLayer;
class SurfaceDescriptor;
class ThebesBuffer;
class TiledLayerComposer;
class Transaction;
class SharedImage;
class CanvasSurface;
class BasicTiledLayerBuffer;
/**
* We want to share layer trees across thread contexts and address
@ -187,6 +189,17 @@ public:
const nsIntRect& aBufferRect,
const nsIntPoint& aBufferRotation,
const SurfaceDescriptor& aNewFrontBuffer);
/**
* Notify the compositor that a tiled layer buffer has changed
* that needs to be synced to the shadow retained copy. The tiled
* layer buffer will operate directly on the shadow retained buffer
* and is free to choose it's own internal representation (double buffering,
* copy on write, tiling).
*/
void PaintedTiledLayerBuffer(ShadowableLayer* aThebes,
BasicTiledLayerBuffer* aTiledLayerBuffer);
/**
* NB: this initial implementation only forwards RGBA data for
* ImageLayers. This is slow, and will be optimized.
@ -468,6 +481,8 @@ public:
const nsIntRegion& GetShadowVisibleRegion() { return mShadowVisibleRegion; }
const gfx3DMatrix& GetShadowTransform() { return mShadowTransform; }
virtual TiledLayerComposer* AsTiledLayerComposer() { return NULL; }
protected:
ShadowLayer()
: mAllocator(nsnull)

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

@ -52,6 +52,7 @@
#include "gfxSharedImageSurface.h"
#include "TiledLayerBuffer.h"
#include "ImageLayers.h"
typedef std::vector<mozilla::layers::EditReply> EditReplyVector;
@ -314,6 +315,20 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
break;
}
case Edit::TOpPaintTiledLayerBuffer: {
MOZ_LAYERS_LOG(("[ParentSide] Paint TiledLayerBuffer"));
const OpPaintTiledLayerBuffer& op = edit.get_OpPaintTiledLayerBuffer();
ShadowLayerParent* shadow = AsShadowLayer(op);
ShadowThebesLayer* shadowLayer = static_cast<ShadowThebesLayer*>(shadow->AsLayer());
TiledLayerComposer* tileComposer = shadowLayer->AsTiledLayerComposer();
NS_ASSERTION(tileComposer, "shadowLayer is not a tile composer");
BasicTiledLayerBuffer* p = (BasicTiledLayerBuffer*)op.tiledLayerBuffer();
tileComposer->PaintedTiledLayerBuffer(p);
break;
}
case Edit::TOpPaintThebesBuffer: {
MOZ_LAYERS_LOG(("[ParentSide] Paint ThebesLayer"));