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
Родитель 44205cbc17
Коммит 432975c8c7
4 изменённых файлов: 50 добавлений и 0 удалений

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

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

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

@ -52,6 +52,7 @@
#include "gfxipc/ShadowLayerUtils.h" #include "gfxipc/ShadowLayerUtils.h"
#include "RenderTrace.h" #include "RenderTrace.h"
#include "sampler.h" #include "sampler.h"
#include "nsXULAppAPI.h"
using namespace mozilla::ipc; using namespace mozilla::ipc;
@ -239,6 +240,17 @@ ShadowLayerForwarder::PaintedThebesBuffer(ShadowableLayer* aThebes,
aBufferRotation), aBufferRotation),
aUpdatedRegion)); 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 void
ShadowLayerForwarder::PaintedImage(ShadowableLayer* aImage, ShadowLayerForwarder::PaintedImage(ShadowableLayer* aImage,
const SharedImage& aNewFrontImage) const SharedImage& aNewFrontImage)

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

@ -65,9 +65,11 @@ class ShadowColorLayer;
class ShadowCanvasLayer; class ShadowCanvasLayer;
class SurfaceDescriptor; class SurfaceDescriptor;
class ThebesBuffer; class ThebesBuffer;
class TiledLayerComposer;
class Transaction; class Transaction;
class SharedImage; class SharedImage;
class CanvasSurface; class CanvasSurface;
class BasicTiledLayerBuffer;
/** /**
* We want to share layer trees across thread contexts and address * We want to share layer trees across thread contexts and address
@ -187,6 +189,17 @@ public:
const nsIntRect& aBufferRect, const nsIntRect& aBufferRect,
const nsIntPoint& aBufferRotation, const nsIntPoint& aBufferRotation,
const SurfaceDescriptor& aNewFrontBuffer); 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 * NB: this initial implementation only forwards RGBA data for
* ImageLayers. This is slow, and will be optimized. * ImageLayers. This is slow, and will be optimized.
@ -468,6 +481,8 @@ public:
const nsIntRegion& GetShadowVisibleRegion() { return mShadowVisibleRegion; } const nsIntRegion& GetShadowVisibleRegion() { return mShadowVisibleRegion; }
const gfx3DMatrix& GetShadowTransform() { return mShadowTransform; } const gfx3DMatrix& GetShadowTransform() { return mShadowTransform; }
virtual TiledLayerComposer* AsTiledLayerComposer() { return NULL; }
protected: protected:
ShadowLayer() ShadowLayer()
: mAllocator(nsnull) : mAllocator(nsnull)

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

@ -52,6 +52,7 @@
#include "gfxSharedImageSurface.h" #include "gfxSharedImageSurface.h"
#include "TiledLayerBuffer.h"
#include "ImageLayers.h" #include "ImageLayers.h"
typedef std::vector<mozilla::layers::EditReply> EditReplyVector; typedef std::vector<mozilla::layers::EditReply> EditReplyVector;
@ -314,6 +315,20 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
break; 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: { case Edit::TOpPaintThebesBuffer: {
MOZ_LAYERS_LOG(("[ParentSide] Paint ThebesLayer")); MOZ_LAYERS_LOG(("[ParentSide] Paint ThebesLayer"));