Backed out changeset 7268c16cad16 (bug 829747) for causing B2G test timeouts; CLOSED TREE

This commit is contained in:
Ed Morley 2013-03-18 18:58:58 +00:00
Родитель 93dc121b06
Коммит 8a6532e534
12 изменённых файлов: 40 добавлений и 137 удалений

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

@ -2879,7 +2879,7 @@ GLContext::CreateScreenBufferImpl(const gfxIntSize& size, const SurfaceCaps& cap
if (!newScreen) if (!newScreen)
return false; return false;
if (!newScreen->Resize(size)) { if (!newScreen->PublishFrame(size)) {
delete newScreen; delete newScreen;
return false; return false;
} }
@ -2901,7 +2901,7 @@ GLContext::ResizeScreenBuffer(const gfxIntSize& size)
if (!IsOffscreenSizeAllowed(size)) if (!IsOffscreenSizeAllowed(size))
return false; return false;
return mScreen->Resize(size); return mScreen->PublishFrame(size);
} }

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

@ -325,12 +325,27 @@ GLScreenBuffer::Morph(SurfaceFactory_GL* newFactory, SurfaceStreamType streamTyp
mStream = newStream; mStream = newStream;
} }
void bool
GLScreenBuffer::Attach(SharedSurface* surface, const gfxIntSize& size) GLScreenBuffer::Swap(const gfxIntSize& size)
{ {
ScopedBindFramebuffer autoFB(mGL); ScopedBindFramebuffer autoFB(mGL);
SharedSurface_GL* surf = SharedSurface_GL::Cast(surface); SharedSurface* nextSurf = mStream->SwapProducer(mFactory, size);
if (!nextSurf) {
SurfaceFactory_GL* basicFactory =
new SurfaceFactory_Basic(mGL, mFactory->Caps());
nextSurf = mStream->SwapProducer(basicFactory, size);
if (!nextSurf) {
delete basicFactory;
return false;
}
// Swap out the apparently defective old factory.
delete mFactory;
mFactory = basicFactory;
}
SharedSurface_GL* surf = SharedSurface_GL::Cast(nextSurf);
if (mRead && SharedSurf()) if (mRead && SharedSurf())
SharedSurf()->UnlockProd(); SharedSurf()->UnlockProd();
@ -361,27 +376,6 @@ GLScreenBuffer::Attach(SharedSurface* surface, const gfxIntSize& size)
if (!PreserveBuffer()) { if (!PreserveBuffer()) {
// DiscardFramebuffer here could help perf on some mobile platforms. // DiscardFramebuffer here could help perf on some mobile platforms.
} }
}
bool
GLScreenBuffer::Swap(const gfxIntSize& size)
{
SharedSurface* nextSurf = mStream->SwapProducer(mFactory, size);
if (!nextSurf) {
SurfaceFactory_GL* basicFactory =
new SurfaceFactory_Basic(mGL, mFactory->Caps());
nextSurf = mStream->SwapProducer(basicFactory, size);
if (!nextSurf) {
delete basicFactory;
return false;
}
// Swap out the apparently defective old factory.
delete mFactory;
mFactory = basicFactory;
}
Attach(nextSurf, size);
return true; return true;
} }
@ -395,16 +389,6 @@ GLScreenBuffer::PublishFrame(const gfxIntSize& size)
return good; return good;
} }
bool
GLScreenBuffer::Resize(const gfxIntSize& size)
{
SharedSurface* surface = mStream->Resize(mFactory, size);
if (!surface)
return false;
Attach(surface, size);
return true;
}
DrawBuffer* DrawBuffer*
GLScreenBuffer::CreateDraw(const gfxIntSize& size) GLScreenBuffer::CreateDraw(const gfxIntSize& size)

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

@ -265,13 +265,9 @@ protected:
public: public:
bool PublishFrame(const gfxIntSize& size); bool PublishFrame(const gfxIntSize& size);
bool Resize(const gfxIntSize& size);
void Readback(SharedSurface_GL* src, gfxImageSurface* dest); void Readback(SharedSurface_GL* src, gfxImageSurface* dest);
protected: protected:
void Attach(SharedSurface* surface, const gfxIntSize& size);
DrawBuffer* CreateDraw(const gfxIntSize& size); DrawBuffer* CreateDraw(const gfxIntSize& size);
ReadBuffer* CreateRead(SharedSurface_GL* surf); ReadBuffer* CreateRead(SharedSurface_GL* surf);

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

@ -8,7 +8,6 @@
#include "gfxPoint.h" #include "gfxPoint.h"
#include "SharedSurface.h" #include "SharedSurface.h"
#include "SurfaceFactory.h" #include "SurfaceFactory.h"
#include "sampler.h"
namespace mozilla { namespace mozilla {
namespace gfx { namespace gfx {
@ -21,7 +20,7 @@ SurfaceStream::ChooseGLStreamType(SurfaceStream::OMTC omtc,
if (preserveBuffer) if (preserveBuffer)
return SurfaceStreamType::TripleBuffer_Copy; return SurfaceStreamType::TripleBuffer_Copy;
else else
return SurfaceStreamType::TripleBuffer_Async; return SurfaceStreamType::TripleBuffer;
} else { } else {
if (preserveBuffer) if (preserveBuffer)
return SurfaceStreamType::SingleBuffer; return SurfaceStreamType::SingleBuffer;
@ -38,8 +37,6 @@ SurfaceStream::CreateForType(SurfaceStreamType type, SurfaceStream* prevStream)
return new SurfaceStream_SingleBuffer(prevStream); return new SurfaceStream_SingleBuffer(prevStream);
case SurfaceStreamType::TripleBuffer_Copy: case SurfaceStreamType::TripleBuffer_Copy:
return new SurfaceStream_TripleBuffer_Copy(prevStream); return new SurfaceStream_TripleBuffer_Copy(prevStream);
case SurfaceStreamType::TripleBuffer_Async:
return new SurfaceStream_TripleBuffer_Async(prevStream);
case SurfaceStreamType::TripleBuffer: case SurfaceStreamType::TripleBuffer:
return new SurfaceStream_TripleBuffer(prevStream); return new SurfaceStream_TripleBuffer(prevStream);
default: default:
@ -161,18 +158,7 @@ SurfaceStream::SwapConsumer()
return ret; return ret;
} }
SharedSurface*
SurfaceStream::Resize(SurfaceFactory* factory, const gfxIntSize& size)
{
MonitorAutoLock lock(mMonitor);
if (mProducer) {
Scrap(mProducer);
}
New(factory, size, mProducer);
return mProducer;
}
SurfaceStream_SingleBuffer::SurfaceStream_SingleBuffer(SurfaceStream* prevStream) SurfaceStream_SingleBuffer::SurfaceStream_SingleBuffer(SurfaceStream* prevStream)
: SurfaceStream(SurfaceStreamType::SingleBuffer, prevStream) : SurfaceStream(SurfaceStreamType::SingleBuffer, prevStream)
@ -214,7 +200,7 @@ SharedSurface*
SurfaceStream_SingleBuffer::SwapProducer(SurfaceFactory* factory, SurfaceStream_SingleBuffer::SwapProducer(SurfaceFactory* factory,
const gfxIntSize& size) const gfxIntSize& size)
{ {
MonitorAutoLock lock(mMonitor); MutexAutoLock lock(mMutex);
if (mConsumer) { if (mConsumer) {
Recycle(factory, mConsumer); Recycle(factory, mConsumer);
} }
@ -252,7 +238,7 @@ SurfaceStream_SingleBuffer::SwapProducer(SurfaceFactory* factory,
SharedSurface* SharedSurface*
SurfaceStream_SingleBuffer::SwapConsumer_NoWait() SurfaceStream_SingleBuffer::SwapConsumer_NoWait()
{ {
MonitorAutoLock lock(mMonitor); MutexAutoLock lock(mMutex);
// Use Cons, if present. // Use Cons, if present.
// Otherwise, just use Prod directly. // Otherwise, just use Prod directly.
@ -307,7 +293,7 @@ SharedSurface*
SurfaceStream_TripleBuffer_Copy::SwapProducer(SurfaceFactory* factory, SurfaceStream_TripleBuffer_Copy::SwapProducer(SurfaceFactory* factory,
const gfxIntSize& size) const gfxIntSize& size)
{ {
MonitorAutoLock lock(mMonitor); MutexAutoLock lock(mMutex);
RecycleScraps(factory); RecycleScraps(factory);
if (mProducer) { if (mProducer) {
@ -337,11 +323,10 @@ SurfaceStream_TripleBuffer_Copy::SwapProducer(SurfaceFactory* factory,
return mProducer; return mProducer;
} }
SharedSurface* SharedSurface*
SurfaceStream_TripleBuffer_Copy::SwapConsumer_NoWait() SurfaceStream_TripleBuffer_Copy::SwapConsumer_NoWait()
{ {
MonitorAutoLock lock(mMonitor); MutexAutoLock lock(mMutex);
if (mStaging) { if (mStaging) {
Scrap(mConsumer); Scrap(mConsumer);
@ -395,18 +380,13 @@ SharedSurface*
SurfaceStream_TripleBuffer::SwapProducer(SurfaceFactory* factory, SurfaceStream_TripleBuffer::SwapProducer(SurfaceFactory* factory,
const gfxIntSize& size) const gfxIntSize& size)
{ {
SAMPLE_LABEL("SurfaceStream_TripleBuffer", "SwapProducer"); MutexAutoLock lock(mMutex);
MonitorAutoLock lock(mMonitor);
if (mProducer) { if (mProducer) {
RecycleScraps(factory); RecycleScraps(factory);
// If WaitForCompositor succeeds, mStaging has moved to mConsumer. if (mStaging)
// If it failed, we might have to scrap it. Recycle(factory, mStaging);
if (mStaging && !WaitForCompositor())
Scrap(mStaging);
MOZ_ASSERT(!mStaging);
Move(mProducer, mStaging); Move(mProducer, mStaging);
mStaging->Fence(); mStaging->Fence();
} }
@ -420,36 +400,14 @@ SurfaceStream_TripleBuffer::SwapProducer(SurfaceFactory* factory,
SharedSurface* SharedSurface*
SurfaceStream_TripleBuffer::SwapConsumer_NoWait() SurfaceStream_TripleBuffer::SwapConsumer_NoWait()
{ {
MonitorAutoLock lock(mMonitor); MutexAutoLock lock(mMutex);
if (mStaging) { if (mStaging) {
Scrap(mConsumer); Scrap(mConsumer);
Move(mStaging, mConsumer); Move(mStaging, mConsumer);
mMonitor.NotifyAll();
} }
return mConsumer; return mConsumer;
} }
SurfaceStream_TripleBuffer_Async::SurfaceStream_TripleBuffer_Async(SurfaceStream* prevStream)
: SurfaceStream_TripleBuffer(prevStream)
{
}
SurfaceStream_TripleBuffer_Async::~SurfaceStream_TripleBuffer_Async()
{
}
bool
SurfaceStream_TripleBuffer_Async::WaitForCompositor()
{
SAMPLE_LABEL("SurfaceStream_TripleBuffer_Async", "WaitForCompositor");
// We are assumed to be locked
while (mStaging)
mMonitor.Wait();
return true;
}
} /* namespace gfx */ } /* namespace gfx */
} /* namespace mozilla */ } /* namespace mozilla */

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

@ -8,7 +8,7 @@
#include <stack> #include <stack>
#include <set> #include <set>
#include "mozilla/Monitor.h" #include "mozilla/Mutex.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "gfxPoint.h" #include "gfxPoint.h"
#include "SurfaceTypes.h" #include "SurfaceTypes.h"
@ -48,7 +48,7 @@ protected:
SharedSurface* mProducer; SharedSurface* mProducer;
std::set<SharedSurface*> mSurfaces; std::set<SharedSurface*> mSurfaces;
std::stack<SharedSurface*> mScraps; std::stack<SharedSurface*> mScraps;
mutable Monitor mMonitor; mutable Mutex mMutex;
bool mIsAlive; bool mIsAlive;
// |previous| can be null, indicating this is the first one. // |previous| can be null, indicating this is the first one.
@ -56,7 +56,7 @@ protected:
SurfaceStream(SurfaceStreamType type, SurfaceStream* prevStream) SurfaceStream(SurfaceStreamType type, SurfaceStream* prevStream)
: mType(type) : mType(type)
, mProducer(nullptr) , mProducer(nullptr)
, mMonitor("SurfaceStream monitor") , mMutex("SurfaceStream mutex")
, mIsAlive(true) , mIsAlive(true)
{ {
MOZ_ASSERT(!prevStream || mType != prevStream->mType, MOZ_ASSERT(!prevStream || mType != prevStream->mType,
@ -107,8 +107,6 @@ public:
virtual SharedSurface* SwapProducer(SurfaceFactory* factory, virtual SharedSurface* SwapProducer(SurfaceFactory* factory,
const gfxIntSize& size) = 0; const gfxIntSize& size) = 0;
virtual SharedSurface* Resize(SurfaceFactory* factory, const gfxIntSize& size);
protected: protected:
// SwapCons will return the same surface more than once, // SwapCons will return the same surface more than once,
// if nothing new has been published. // if nothing new has been published.
@ -171,9 +169,6 @@ protected:
SharedSurface* mStaging; SharedSurface* mStaging;
SharedSurface* mConsumer; SharedSurface* mConsumer;
// Returns true if we were able to wait, false if not
virtual bool WaitForCompositor() { return false; }
public: public:
SurfaceStream_TripleBuffer(SurfaceStream* prevStream); SurfaceStream_TripleBuffer(SurfaceStream* prevStream);
virtual ~SurfaceStream_TripleBuffer(); virtual ~SurfaceStream_TripleBuffer();
@ -187,17 +182,6 @@ public:
virtual void SurrenderSurfaces(SharedSurface*& producer, SharedSurface*& consumer); virtual void SurrenderSurfaces(SharedSurface*& producer, SharedSurface*& consumer);
}; };
class SurfaceStream_TripleBuffer_Async
: public SurfaceStream_TripleBuffer
{
protected:
virtual bool WaitForCompositor();
public:
SurfaceStream_TripleBuffer_Async(SurfaceStream* prevStream);
virtual ~SurfaceStream_TripleBuffer_Async();
};
} /* namespace gfx */ } /* namespace gfx */
} /* namespace mozilla */ } /* namespace mozilla */

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

@ -78,7 +78,6 @@ MOZ_END_ENUM_CLASS(SharedSurfaceType)
MOZ_BEGIN_ENUM_CLASS(SurfaceStreamType, uint8_t) MOZ_BEGIN_ENUM_CLASS(SurfaceStreamType, uint8_t)
SingleBuffer, SingleBuffer,
TripleBuffer_Copy, TripleBuffer_Copy,
TripleBuffer_Async,
TripleBuffer, TripleBuffer,
Max Max
MOZ_END_ENUM_CLASS(SurfaceStreamType) MOZ_END_ENUM_CLASS(SurfaceStreamType)

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

@ -12,7 +12,6 @@
#include "SurfaceStream.h" #include "SurfaceStream.h"
#include "SharedSurfaceGL.h" #include "SharedSurfaceGL.h"
#include "SharedSurfaceEGL.h" #include "SharedSurfaceEGL.h"
#include "sampler.h"
#include "BasicLayersImpl.h" #include "BasicLayersImpl.h"
#include "nsXULAppAPI.h" #include "nsXULAppAPI.h"
@ -412,7 +411,6 @@ BasicShadowableCanvasLayer::Initialize(const Data& aData)
void void
BasicShadowableCanvasLayer::Paint(gfxContext* aContext, Layer* aMaskLayer) BasicShadowableCanvasLayer::Paint(gfxContext* aContext, Layer* aMaskLayer)
{ {
SAMPLE_LABEL("BasicShadowableCanvasLayer", "Paint");
if (!HasShadow()) { if (!HasShadow()) {
BasicCanvasLayer::Paint(aContext, aMaskLayer); BasicCanvasLayer::Paint(aContext, aMaskLayer);
return; return;
@ -438,9 +436,9 @@ BasicShadowableCanvasLayer::Paint(gfxContext* aContext, Layer* aMaskLayer)
// Call Painted() to reset our dirty 'bit'. // Call Painted() to reset our dirty 'bit'.
Painted(); Painted();
FireDidTransactionCallback(); FireDidTransactionCallback();
BasicManager()->PaintedCanvasNoSwap(BasicManager()->Hold(this), BasicManager()->PaintedCanvas(BasicManager()->Hold(this),
mNeedsYFlip, mNeedsYFlip,
mBackBuffer); mBackBuffer);
// Move SharedTextureHandle ownership to ShadowLayer // Move SharedTextureHandle ownership to ShadowLayer
mBackBuffer = SurfaceDescriptor(); mBackBuffer = SurfaceDescriptor();
return; return;

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

@ -523,7 +523,7 @@ BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback,
void* aCallbackData, void* aCallbackData,
EndTransactionFlags aFlags) EndTransactionFlags aFlags)
{ {
SAMPLE_LABEL("BasicLayerManager", "EndTransactionInternal"); SAMPLE_LABEL("BasicLayerManager", "EndTranscationInternal");
#ifdef MOZ_LAYERS_HAVE_LOG #ifdef MOZ_LAYERS_HAVE_LOG
MOZ_LAYERS_LOG((" ----- (beginning paint)")); MOZ_LAYERS_LOG((" ----- (beginning paint)"));
Log(); Log();
@ -871,7 +871,6 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget,
void* aCallbackData, void* aCallbackData,
ReadbackProcessor* aReadback) ReadbackProcessor* aReadback)
{ {
SAMPLE_LABEL("BasicLayerManager", "PaintLayer");
PaintContext paintContext(aTarget, aLayer, aCallback, aCallbackData, aReadback); PaintContext paintContext(aTarget, aLayer, aCallback, aCallbackData, aReadback);
// Don't attempt to paint layers with a singular transform, cairo will // Don't attempt to paint layers with a singular transform, cairo will

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

@ -297,16 +297,6 @@ ShadowLayerForwarder::PaintedCanvas(ShadowableLayer* aCanvas,
aNeedYFlip)); aNeedYFlip));
} }
void
ShadowLayerForwarder::PaintedCanvasNoSwap(ShadowableLayer* aCanvas,
bool aNeedYFlip,
const SurfaceDescriptor& aNewFrontSurface)
{
mTxn->AddNoSwapPaint(OpPaintCanvas(NULL, Shadow(aCanvas),
aNewFrontSurface,
aNeedYFlip));
}
bool bool
ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies) ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies)
{ {

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

@ -219,9 +219,6 @@ public:
void PaintedCanvas(ShadowableLayer* aCanvas, void PaintedCanvas(ShadowableLayer* aCanvas,
bool aNeedYFlip, bool aNeedYFlip,
const SurfaceDescriptor& aNewFrontSurface); const SurfaceDescriptor& aNewFrontSurface);
void PaintedCanvasNoSwap(ShadowableLayer* aCanvas,
bool aNeedYFlip,
const SurfaceDescriptor& aNewFrontSurface);
/** /**
* End the current transaction and forward it to ShadowLayerManager. * End the current transaction and forward it to ShadowLayerManager.

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

@ -422,14 +422,11 @@ ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
RenderTraceInvalidateStart(canvas, "FF00FF", canvas->GetVisibleRegion().GetBounds()); RenderTraceInvalidateStart(canvas, "FF00FF", canvas->GetVisibleRegion().GetBounds());
canvas->SetAllocator(this); canvas->SetAllocator(this);
CanvasSurface newBack = CanvasSurface(null_t()); CanvasSurface newBack;
canvas->Swap(op.newFrontBuffer(), op.needYFlip(), &newBack); canvas->Swap(op.newFrontBuffer(), op.needYFlip(), &newBack);
canvas->Updated(); canvas->Updated();
replyv.push_back(OpBufferSwap(shadow, NULL,
if (newBack.type() != CanvasSurface::Tnull_t) { newBack));
replyv.push_back(OpBufferSwap(shadow, NULL,
newBack));
}
RenderTraceInvalidateEnd(canvas, "FF00FF"); RenderTraceInvalidateEnd(canvas, "FF00FF");
break; break;

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

@ -444,6 +444,7 @@ ShadowCanvasLayerOGL::Swap(const CanvasSurface& aNewFront,
SurfaceStreamHandle handle = (SurfaceStreamHandle)nullptr; SurfaceStreamHandle handle = (SurfaceStreamHandle)nullptr;
mFrontBufferDescriptor = SurfaceStreamDescriptor(handle, false); mFrontBufferDescriptor = SurfaceStreamDescriptor(handle, false);
} }
*aNewBack = mFrontBufferDescriptor;
mFrontBufferDescriptor = aNewFront; mFrontBufferDescriptor = aNewFront;
mNeedsYFlip = needYFlip; mNeedsYFlip = needYFlip;
} else { } else {