Bug 900133 - Don't mark textures as being sent to the compositor until after we've drawn to them. r=nical

This commit is contained in:
Matt Woodrow 2013-08-20 11:39:55 +12:00
Родитель edd0212608
Коммит 3b6adb72b1
4 изменённых файлов: 23 добавлений и 3 удалений

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

@ -45,6 +45,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
mBuffer = nullptr;
}
bool bufferCreated = false;
if (!mBuffer) {
bool isOpaque = (aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE);
gfxASurface::gfxContentType contentType = isOpaque
@ -56,7 +57,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
MOZ_ASSERT(mBuffer->AsTextureClientSurface());
mBuffer->AsTextureClientSurface()->AllocateForSurface(aSize);
AddTextureClient(mBuffer);
bufferCreated = true;
}
if (!mBuffer->Lock(OPEN_READ_WRITE)) {
@ -70,6 +71,10 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
mBuffer->Unlock();
if (bufferCreated) {
AddTextureClient(mBuffer);
}
if (surface) {
GetForwarder()->UpdatedTexture(this, mBuffer, nullptr);
GetForwarder()->UseTexture(this, mBuffer);

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

@ -115,6 +115,7 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
mFrontBuffer = nullptr;
}
bool bufferCreated = false;
if (!mFrontBuffer) {
mFrontBuffer = CreateBufferTextureClient(gfx::FORMAT_YUV);
gfx::IntSize ySize(data->mYSize.width, data->mYSize.height);
@ -123,7 +124,7 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
mFrontBuffer = nullptr;
return false;
}
AddTextureClient(mFrontBuffer);
bufferCreated = true;
}
if (!mFrontBuffer->Lock(OPEN_READ_WRITE)) {
@ -132,6 +133,10 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
bool status = mFrontBuffer->AsTextureClientYCbCr()->UpdateYCbCr(*data);
mFrontBuffer->Unlock();
if (bufferCreated) {
AddTextureClient(mFrontBuffer);
}
if (status) {
GetForwarder()->UpdatedTexture(this, mFrontBuffer, nullptr);
GetForwarder()->UseTexture(this, mFrontBuffer);
@ -152,6 +157,7 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
mFrontBuffer = nullptr;
}
bool bufferCreated = false;
if (!mFrontBuffer) {
gfxASurface::gfxImageFormat format
= gfxPlatform::GetPlatform()->OptimalFormatForContent(surface->GetContentType());
@ -159,7 +165,7 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
MOZ_ASSERT(mFrontBuffer->AsTextureClientSurface());
mFrontBuffer->AsTextureClientSurface()->AllocateForSurface(size);
AddTextureClient(mFrontBuffer);
bufferCreated = true;
}
if (!mFrontBuffer->Lock(OPEN_READ_WRITE)) {
@ -167,6 +173,11 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
}
bool status = mFrontBuffer->AsTextureClientSurface()->UpdateSurface(surface);
mFrontBuffer->Unlock();
if (bufferCreated) {
AddTextureClient(mFrontBuffer);
}
if (status) {
GetForwarder()->UpdatedTexture(this, mFrontBuffer, nullptr);
GetForwarder()->UseTexture(this, mFrontBuffer);

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

@ -164,6 +164,7 @@ bool
BufferTextureClient::UpdateSurface(gfxASurface* aSurface)
{
MOZ_ASSERT(aSurface);
MOZ_ASSERT(!IsImmutable());
ImageDataSerializer serializer(GetBuffer());
if (!serializer.IsValid()) {

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

@ -380,6 +380,9 @@ BufferTextureHost::Upload(nsIntRegion *aRegion)
}
RefPtr<gfx::DataSourceSurface> surf = deserializer.GetAsSurface();
if (!surf) {
return false;
}
if (!mFirstSource->Update(surf.get(), mFlags, aRegion)) {
NS_WARNING("failed to update the DataTextureSource");