2013-02-14 03:26:24 +04:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "SurfaceStream.h"
|
|
|
|
|
|
|
|
#include "gfxPoint.h"
|
|
|
|
#include "SharedSurface.h"
|
2014-03-06 01:49:37 +04:00
|
|
|
#include "SharedSurfaceGL.h"
|
2013-02-14 03:26:24 +04:00
|
|
|
#include "SurfaceFactory.h"
|
2013-03-16 04:48:56 +04:00
|
|
|
#include "GeckoProfiler.h"
|
2013-02-14 03:26:24 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
|
|
|
|
SurfaceStreamType
|
|
|
|
SurfaceStream::ChooseGLStreamType(SurfaceStream::OMTC omtc,
|
|
|
|
bool preserveBuffer)
|
|
|
|
{
|
2013-02-21 11:52:17 +04:00
|
|
|
if (omtc == SurfaceStream::OffMainThread) {
|
2013-02-14 03:26:24 +04:00
|
|
|
if (preserveBuffer)
|
|
|
|
return SurfaceStreamType::TripleBuffer_Copy;
|
|
|
|
else
|
2014-04-15 02:37:06 +04:00
|
|
|
return SurfaceStreamType::TripleBuffer_Async;
|
2013-02-14 03:26:24 +04:00
|
|
|
} else {
|
|
|
|
if (preserveBuffer)
|
|
|
|
return SurfaceStreamType::SingleBuffer;
|
|
|
|
else
|
|
|
|
return SurfaceStreamType::TripleBuffer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SurfaceStream*
|
2013-07-17 21:03:18 +04:00
|
|
|
SurfaceStream::CreateForType(SurfaceStreamType type, mozilla::gl::GLContext* glContext, SurfaceStream* prevStream)
|
2013-02-14 03:26:24 +04:00
|
|
|
{
|
2013-07-17 21:03:18 +04:00
|
|
|
SurfaceStream* result = nullptr;
|
|
|
|
|
2013-02-14 03:26:24 +04:00
|
|
|
switch (type) {
|
|
|
|
case SurfaceStreamType::SingleBuffer:
|
2013-07-17 21:03:18 +04:00
|
|
|
result = new SurfaceStream_SingleBuffer(prevStream);
|
|
|
|
break;
|
2013-02-14 03:26:24 +04:00
|
|
|
case SurfaceStreamType::TripleBuffer_Copy:
|
2013-07-17 21:03:18 +04:00
|
|
|
result = new SurfaceStream_TripleBuffer_Copy(prevStream);
|
|
|
|
break;
|
2014-06-07 08:02:28 +04:00
|
|
|
case SurfaceStreamType::TripleBuffer_Async:
|
|
|
|
result = new SurfaceStream_TripleBuffer_Async(prevStream);
|
2014-04-15 02:37:06 +04:00
|
|
|
break;
|
2014-06-07 08:02:28 +04:00
|
|
|
case SurfaceStreamType::TripleBuffer:
|
|
|
|
result = new SurfaceStream_TripleBuffer(prevStream);
|
2013-07-17 21:03:18 +04:00
|
|
|
break;
|
2013-02-14 03:26:24 +04:00
|
|
|
default:
|
2013-06-29 05:38:30 +04:00
|
|
|
MOZ_CRASH("Invalid Type.");
|
2013-02-14 03:26:24 +04:00
|
|
|
}
|
2013-07-17 21:03:18 +04:00
|
|
|
|
|
|
|
result->mGLContext = glContext;
|
|
|
|
return result;
|
2013-02-14 03:26:24 +04:00
|
|
|
}
|
|
|
|
|
2014-03-06 01:49:37 +04:00
|
|
|
bool
|
|
|
|
SurfaceStream_TripleBuffer::CopySurfaceToProducer(SharedSurface* src, SurfaceFactory* factory)
|
|
|
|
{
|
|
|
|
if (!mProducer) {
|
|
|
|
New(factory, src->Size(), mProducer);
|
|
|
|
if (!mProducer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MOZ_ASSERT(src->Size() == mProducer->Size(), "Size mismatch");
|
|
|
|
|
|
|
|
SharedSurface::Copy(src, mProducer, factory);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-02-14 03:26:24 +04:00
|
|
|
void
|
2013-12-10 20:12:18 +04:00
|
|
|
SurfaceStream::New(SurfaceFactory* factory, const gfx::IntSize& size,
|
2013-02-14 03:26:24 +04:00
|
|
|
SharedSurface*& surf)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(!surf);
|
|
|
|
surf = factory->NewSharedSurface(size);
|
|
|
|
|
2014-05-15 02:40:15 +04:00
|
|
|
if (surf) {
|
|
|
|
// Before next use, wait until SharedSurface's buffer
|
|
|
|
// is no longer being used.
|
|
|
|
surf->WaitForBufferOwnership();
|
2013-02-14 03:26:24 +04:00
|
|
|
mSurfaces.insert(surf);
|
2014-05-15 02:40:15 +04:00
|
|
|
}
|
2013-02-14 03:26:24 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SurfaceStream::Recycle(SurfaceFactory* factory, SharedSurface*& surf)
|
|
|
|
{
|
|
|
|
if (surf) {
|
|
|
|
mSurfaces.erase(surf);
|
|
|
|
factory->Recycle(surf);
|
|
|
|
}
|
|
|
|
MOZ_ASSERT(!surf);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SurfaceStream::Delete(SharedSurface*& surf)
|
|
|
|
{
|
|
|
|
if (surf) {
|
|
|
|
mSurfaces.erase(surf);
|
|
|
|
delete surf;
|
|
|
|
surf = nullptr;
|
|
|
|
}
|
|
|
|
MOZ_ASSERT(!surf);
|
|
|
|
}
|
|
|
|
|
|
|
|
SharedSurface*
|
|
|
|
SurfaceStream::Surrender(SharedSurface*& surf)
|
|
|
|
{
|
|
|
|
SharedSurface* ret = surf;
|
|
|
|
|
|
|
|
if (surf) {
|
|
|
|
mSurfaces.erase(surf);
|
|
|
|
surf = nullptr;
|
|
|
|
}
|
|
|
|
MOZ_ASSERT(!surf);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
SharedSurface*
|
|
|
|
SurfaceStream::Absorb(SharedSurface*& surf)
|
|
|
|
{
|
|
|
|
SharedSurface* ret = surf;
|
|
|
|
|
|
|
|
if (surf) {
|
|
|
|
mSurfaces.insert(surf);
|
|
|
|
surf = nullptr;
|
|
|
|
}
|
|
|
|
MOZ_ASSERT(!surf);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SurfaceStream::Scrap(SharedSurface*& scrap)
|
|
|
|
{
|
|
|
|
if (scrap) {
|
|
|
|
mScraps.push(scrap);
|
|
|
|
scrap = nullptr;
|
|
|
|
}
|
|
|
|
MOZ_ASSERT(!scrap);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SurfaceStream::RecycleScraps(SurfaceFactory* factory)
|
|
|
|
{
|
|
|
|
while (!mScraps.empty()) {
|
|
|
|
SharedSurface* cur = mScraps.top();
|
|
|
|
mScraps.pop();
|
|
|
|
|
|
|
|
Recycle(factory, cur);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SurfaceStream::~SurfaceStream()
|
|
|
|
{
|
|
|
|
Delete(mProducer);
|
|
|
|
|
|
|
|
while (!mScraps.empty()) {
|
|
|
|
SharedSurface* cur = mScraps.top();
|
|
|
|
mScraps.pop();
|
|
|
|
|
|
|
|
Delete(cur);
|
|
|
|
}
|
|
|
|
|
|
|
|
MOZ_ASSERT(mSurfaces.empty());
|
|
|
|
}
|
|
|
|
|
|
|
|
SharedSurface*
|
|
|
|
SurfaceStream::SwapConsumer()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mIsAlive);
|
|
|
|
|
|
|
|
SharedSurface* ret = SwapConsumer_NoWait();
|
|
|
|
if (!ret)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
if (!ret->WaitSync()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-03-22 23:22:20 +04:00
|
|
|
SharedSurface*
|
2013-12-10 20:12:18 +04:00
|
|
|
SurfaceStream::Resize(SurfaceFactory* factory, const gfx::IntSize& size)
|
2013-03-22 23:22:20 +04:00
|
|
|
{
|
|
|
|
MonitorAutoLock lock(mMonitor);
|
|
|
|
|
|
|
|
if (mProducer) {
|
|
|
|
Scrap(mProducer);
|
|
|
|
}
|
2013-02-14 03:26:24 +04:00
|
|
|
|
2013-03-22 23:22:20 +04:00
|
|
|
New(factory, size, mProducer);
|
|
|
|
return mProducer;
|
|
|
|
}
|
2013-02-14 03:26:24 +04:00
|
|
|
|
|
|
|
SurfaceStream_SingleBuffer::SurfaceStream_SingleBuffer(SurfaceStream* prevStream)
|
|
|
|
: SurfaceStream(SurfaceStreamType::SingleBuffer, prevStream)
|
|
|
|
, mConsumer(nullptr)
|
|
|
|
{
|
|
|
|
if (!prevStream)
|
|
|
|
return;
|
|
|
|
|
|
|
|
SharedSurface* prevProducer = nullptr;
|
|
|
|
SharedSurface* prevConsumer = nullptr;
|
|
|
|
prevStream->SurrenderSurfaces(prevProducer, prevConsumer);
|
|
|
|
|
|
|
|
if (prevConsumer == prevProducer)
|
|
|
|
prevConsumer = nullptr;
|
|
|
|
|
|
|
|
mProducer = Absorb(prevProducer);
|
|
|
|
mConsumer = Absorb(prevConsumer);
|
|
|
|
}
|
|
|
|
|
|
|
|
SurfaceStream_SingleBuffer::~SurfaceStream_SingleBuffer()
|
|
|
|
{
|
|
|
|
Delete(mConsumer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SurfaceStream_SingleBuffer::SurrenderSurfaces(SharedSurface*& producer,
|
|
|
|
SharedSurface*& consumer)
|
|
|
|
{
|
|
|
|
mIsAlive = false;
|
|
|
|
|
|
|
|
producer = Surrender(mProducer);
|
|
|
|
consumer = Surrender(mConsumer);
|
|
|
|
|
|
|
|
if (!consumer)
|
|
|
|
consumer = producer;
|
|
|
|
}
|
|
|
|
|
|
|
|
SharedSurface*
|
|
|
|
SurfaceStream_SingleBuffer::SwapProducer(SurfaceFactory* factory,
|
2013-12-10 20:12:18 +04:00
|
|
|
const gfx::IntSize& size)
|
2013-02-14 03:26:24 +04:00
|
|
|
{
|
2013-03-22 23:22:20 +04:00
|
|
|
MonitorAutoLock lock(mMonitor);
|
2013-02-14 03:26:24 +04:00
|
|
|
if (mConsumer) {
|
|
|
|
Recycle(factory, mConsumer);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mProducer) {
|
|
|
|
// Fence now, before we start (maybe) juggling Prod around.
|
|
|
|
mProducer->Fence();
|
|
|
|
|
|
|
|
// Size mismatch means we need to squirrel the current Prod
|
|
|
|
// into Cons, and leave Prod empty, so it gets a new surface below.
|
|
|
|
bool needsNewBuffer = mProducer->Size() != size;
|
|
|
|
|
|
|
|
// Even if we're the right size, if the type has changed, and we don't
|
|
|
|
// need to preserve, we should switch out for (presumedly) better perf.
|
|
|
|
if (mProducer->Type() != factory->Type() &&
|
|
|
|
!factory->Caps().preserve)
|
|
|
|
{
|
|
|
|
needsNewBuffer = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (needsNewBuffer) {
|
|
|
|
Move(mProducer, mConsumer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// The old Prod (if there every was one) was invalid,
|
|
|
|
// so we need a new one.
|
|
|
|
if (!mProducer) {
|
|
|
|
New(factory, size, mProducer);
|
|
|
|
}
|
|
|
|
|
|
|
|
return mProducer;
|
|
|
|
}
|
|
|
|
|
|
|
|
SharedSurface*
|
|
|
|
SurfaceStream_SingleBuffer::SwapConsumer_NoWait()
|
|
|
|
{
|
2013-03-22 23:22:20 +04:00
|
|
|
MonitorAutoLock lock(mMonitor);
|
2013-02-14 03:26:24 +04:00
|
|
|
|
|
|
|
// Use Cons, if present.
|
|
|
|
// Otherwise, just use Prod directly.
|
|
|
|
SharedSurface* toConsume = mConsumer;
|
|
|
|
if (!toConsume)
|
|
|
|
toConsume = mProducer;
|
|
|
|
|
|
|
|
return toConsume;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SurfaceStream_TripleBuffer_Copy::SurfaceStream_TripleBuffer_Copy(SurfaceStream* prevStream)
|
|
|
|
: SurfaceStream(SurfaceStreamType::TripleBuffer_Copy, prevStream)
|
|
|
|
, mStaging(nullptr)
|
|
|
|
, mConsumer(nullptr)
|
|
|
|
{
|
|
|
|
if (!prevStream)
|
|
|
|
return;
|
|
|
|
|
|
|
|
SharedSurface* prevProducer = nullptr;
|
|
|
|
SharedSurface* prevConsumer = nullptr;
|
|
|
|
prevStream->SurrenderSurfaces(prevProducer, prevConsumer);
|
|
|
|
|
|
|
|
if (prevConsumer == prevProducer)
|
|
|
|
prevConsumer = nullptr;
|
|
|
|
|
|
|
|
mProducer = Absorb(prevProducer);
|
|
|
|
mConsumer = Absorb(prevConsumer);
|
|
|
|
}
|
|
|
|
|
|
|
|
SurfaceStream_TripleBuffer_Copy::~SurfaceStream_TripleBuffer_Copy()
|
|
|
|
{
|
|
|
|
Delete(mStaging);
|
|
|
|
Delete(mConsumer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SurfaceStream_TripleBuffer_Copy::SurrenderSurfaces(SharedSurface*& producer,
|
|
|
|
SharedSurface*& consumer)
|
|
|
|
{
|
|
|
|
mIsAlive = false;
|
|
|
|
|
|
|
|
producer = Surrender(mProducer);
|
|
|
|
consumer = Surrender(mConsumer);
|
|
|
|
|
|
|
|
if (!consumer)
|
|
|
|
consumer = Surrender(mStaging);
|
|
|
|
}
|
|
|
|
|
|
|
|
SharedSurface*
|
|
|
|
SurfaceStream_TripleBuffer_Copy::SwapProducer(SurfaceFactory* factory,
|
2013-12-10 20:12:18 +04:00
|
|
|
const gfx::IntSize& size)
|
2013-02-14 03:26:24 +04:00
|
|
|
{
|
2013-03-22 23:22:20 +04:00
|
|
|
MonitorAutoLock lock(mMonitor);
|
2013-02-14 03:26:24 +04:00
|
|
|
|
|
|
|
RecycleScraps(factory);
|
|
|
|
if (mProducer) {
|
2013-04-26 00:27:43 +04:00
|
|
|
if (mStaging) {
|
|
|
|
// We'll re-use this for a new mProducer later on if
|
|
|
|
// the size remains the same
|
2013-02-14 03:26:24 +04:00
|
|
|
Recycle(factory, mStaging);
|
2013-04-26 00:27:43 +04:00
|
|
|
}
|
2013-02-14 03:26:24 +04:00
|
|
|
|
2013-04-26 00:27:43 +04:00
|
|
|
Move(mProducer, mStaging);
|
2013-02-14 03:26:24 +04:00
|
|
|
mStaging->Fence();
|
|
|
|
|
2013-04-26 00:27:43 +04:00
|
|
|
New(factory, size, mProducer);
|
|
|
|
|
|
|
|
if (mProducer && mStaging->Size() == mProducer->Size())
|
|
|
|
SharedSurface::Copy(mStaging, mProducer, factory);
|
|
|
|
} else {
|
2013-02-14 03:26:24 +04:00
|
|
|
New(factory, size, mProducer);
|
|
|
|
}
|
|
|
|
|
|
|
|
return mProducer;
|
|
|
|
}
|
|
|
|
|
2013-03-22 23:22:20 +04:00
|
|
|
|
2013-02-14 03:26:24 +04:00
|
|
|
SharedSurface*
|
|
|
|
SurfaceStream_TripleBuffer_Copy::SwapConsumer_NoWait()
|
|
|
|
{
|
2013-03-22 23:22:20 +04:00
|
|
|
MonitorAutoLock lock(mMonitor);
|
2013-02-14 03:26:24 +04:00
|
|
|
|
|
|
|
if (mStaging) {
|
|
|
|
Scrap(mConsumer);
|
|
|
|
Move(mStaging, mConsumer);
|
|
|
|
}
|
|
|
|
|
|
|
|
return mConsumer;
|
|
|
|
}
|
|
|
|
|
2013-04-07 17:35:21 +04:00
|
|
|
void SurfaceStream_TripleBuffer::Init(SurfaceStream* prevStream)
|
2013-02-14 03:26:24 +04:00
|
|
|
{
|
|
|
|
if (!prevStream)
|
|
|
|
return;
|
|
|
|
|
|
|
|
SharedSurface* prevProducer = nullptr;
|
|
|
|
SharedSurface* prevConsumer = nullptr;
|
|
|
|
prevStream->SurrenderSurfaces(prevProducer, prevConsumer);
|
|
|
|
|
|
|
|
if (prevConsumer == prevProducer)
|
|
|
|
prevConsumer = nullptr;
|
|
|
|
|
|
|
|
mProducer = Absorb(prevProducer);
|
|
|
|
mConsumer = Absorb(prevConsumer);
|
|
|
|
}
|
|
|
|
|
2013-04-07 17:35:21 +04:00
|
|
|
|
2014-06-07 08:02:28 +04:00
|
|
|
SurfaceStream_TripleBuffer::SurfaceStream_TripleBuffer(SurfaceStreamType type, SurfaceStream* prevStream)
|
2013-04-07 17:35:21 +04:00
|
|
|
: SurfaceStream(type, prevStream)
|
|
|
|
, mStaging(nullptr)
|
|
|
|
, mConsumer(nullptr)
|
|
|
|
{
|
|
|
|
SurfaceStream_TripleBuffer::Init(prevStream);
|
|
|
|
}
|
|
|
|
|
2014-06-07 08:02:28 +04:00
|
|
|
SurfaceStream_TripleBuffer::SurfaceStream_TripleBuffer(SurfaceStream* prevStream)
|
2013-04-07 17:35:21 +04:00
|
|
|
: SurfaceStream(SurfaceStreamType::TripleBuffer, prevStream)
|
|
|
|
, mStaging(nullptr)
|
|
|
|
, mConsumer(nullptr)
|
|
|
|
{
|
|
|
|
SurfaceStream_TripleBuffer::Init(prevStream);
|
|
|
|
}
|
|
|
|
|
2013-02-14 03:26:24 +04:00
|
|
|
SurfaceStream_TripleBuffer::~SurfaceStream_TripleBuffer()
|
|
|
|
{
|
|
|
|
Delete(mStaging);
|
|
|
|
Delete(mConsumer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SurfaceStream_TripleBuffer::SurrenderSurfaces(SharedSurface*& producer,
|
|
|
|
SharedSurface*& consumer)
|
|
|
|
{
|
|
|
|
mIsAlive = false;
|
|
|
|
|
|
|
|
producer = Surrender(mProducer);
|
|
|
|
consumer = Surrender(mConsumer);
|
|
|
|
|
|
|
|
if (!consumer)
|
|
|
|
consumer = Surrender(mStaging);
|
|
|
|
}
|
|
|
|
|
|
|
|
SharedSurface*
|
|
|
|
SurfaceStream_TripleBuffer::SwapProducer(SurfaceFactory* factory,
|
2013-12-10 20:12:18 +04:00
|
|
|
const gfx::IntSize& size)
|
2013-02-14 03:26:24 +04:00
|
|
|
{
|
2014-05-24 01:12:29 +04:00
|
|
|
PROFILER_LABEL("SurfaceStream_TripleBuffer", "SwapProducer",
|
|
|
|
js::ProfileEntry::Category::GRAPHICS);
|
2013-03-22 23:22:20 +04:00
|
|
|
|
|
|
|
MonitorAutoLock lock(mMonitor);
|
2013-02-14 03:26:24 +04:00
|
|
|
if (mProducer) {
|
|
|
|
RecycleScraps(factory);
|
|
|
|
|
2014-04-15 02:37:06 +04:00
|
|
|
// If WaitForCompositor succeeds, mStaging has moved to mConsumer.
|
|
|
|
// If it failed, we might have to scrap it.
|
2014-05-14 08:10:00 +04:00
|
|
|
if (mStaging) {
|
|
|
|
WaitForCompositor();
|
|
|
|
}
|
|
|
|
if (mStaging) {
|
2013-03-22 23:22:20 +04:00
|
|
|
Scrap(mStaging);
|
2014-05-14 08:10:00 +04:00
|
|
|
}
|
2013-02-14 03:26:24 +04:00
|
|
|
|
|
|
|
Move(mProducer, mStaging);
|
|
|
|
mStaging->Fence();
|
|
|
|
}
|
|
|
|
|
|
|
|
MOZ_ASSERT(!mProducer);
|
|
|
|
New(factory, size, mProducer);
|
|
|
|
|
|
|
|
return mProducer;
|
|
|
|
}
|
|
|
|
|
|
|
|
SharedSurface*
|
|
|
|
SurfaceStream_TripleBuffer::SwapConsumer_NoWait()
|
|
|
|
{
|
2013-03-22 23:22:20 +04:00
|
|
|
MonitorAutoLock lock(mMonitor);
|
2014-06-07 08:02:28 +04:00
|
|
|
if (mStaging) {
|
2013-02-14 03:26:24 +04:00
|
|
|
Scrap(mConsumer);
|
2014-06-07 08:02:28 +04:00
|
|
|
Move(mStaging, mConsumer);
|
2013-03-22 23:22:20 +04:00
|
|
|
mMonitor.NotifyAll();
|
2013-02-14 03:26:24 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return mConsumer;
|
|
|
|
}
|
|
|
|
|
2014-06-07 08:02:28 +04:00
|
|
|
SurfaceStream_TripleBuffer_Async::SurfaceStream_TripleBuffer_Async(SurfaceStream* prevStream)
|
|
|
|
: SurfaceStream_TripleBuffer(SurfaceStreamType::TripleBuffer_Async, prevStream)
|
2014-04-15 02:37:06 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SurfaceStream_TripleBuffer_Async::~SurfaceStream_TripleBuffer_Async()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-05-14 08:10:00 +04:00
|
|
|
void
|
2014-04-15 02:37:06 +04:00
|
|
|
SurfaceStream_TripleBuffer_Async::WaitForCompositor()
|
|
|
|
{
|
2014-05-24 01:12:29 +04:00
|
|
|
PROFILER_LABEL("SurfaceStream_TripleBuffer_Async", "WaitForCompositor",
|
|
|
|
js::ProfileEntry::Category::GRAPHICS);
|
2014-04-15 02:37:06 +04:00
|
|
|
|
2014-05-14 08:10:00 +04:00
|
|
|
// If we haven't be notified within 100ms, then
|
|
|
|
// something must have happened and it will never arrive.
|
|
|
|
// Bail out to avoid deadlocking.
|
|
|
|
mMonitor.Wait(PR_MillisecondsToInterval(100));
|
2014-04-15 02:37:06 +04:00
|
|
|
}
|
|
|
|
|
2013-02-14 03:26:24 +04:00
|
|
|
} /* namespace gfx */
|
|
|
|
} /* namespace mozilla */
|