Bug 912766. Use the DIB texture client/host. r=mattwoodrow
This commit is contained in:
@@ -121,10 +121,15 @@ DeprecatedCanvasClient2D::DeprecatedCanvasClient2D(CompositableForwarder* aFwd,
|
|||||||
void
|
void
|
||||||
DeprecatedCanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
|
DeprecatedCanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
|
||||||
{
|
{
|
||||||
|
bool isOpaque = (aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE);
|
||||||
|
gfxASurface::gfxContentType contentType = isOpaque
|
||||||
|
? gfxASurface::CONTENT_COLOR
|
||||||
|
: gfxASurface::CONTENT_COLOR_ALPHA;
|
||||||
|
|
||||||
if (!mDeprecatedTextureClient) {
|
if (!mDeprecatedTextureClient) {
|
||||||
mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_CONTENT);
|
mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_CONTENT, contentType);
|
||||||
if (!mDeprecatedTextureClient) {
|
if (!mDeprecatedTextureClient) {
|
||||||
mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_FALLBACK);
|
mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_FALLBACK, contentType);
|
||||||
if (!mDeprecatedTextureClient) {
|
if (!mDeprecatedTextureClient) {
|
||||||
NS_WARNING("Could not create texture client");
|
NS_WARNING("Could not create texture client");
|
||||||
return;
|
return;
|
||||||
@@ -132,17 +137,12 @@ DeprecatedCanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isOpaque = (aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE);
|
|
||||||
gfxASurface::gfxContentType contentType = isOpaque
|
|
||||||
? gfxASurface::CONTENT_COLOR
|
|
||||||
: gfxASurface::CONTENT_COLOR_ALPHA;
|
|
||||||
|
|
||||||
if (!mDeprecatedTextureClient->EnsureAllocated(aSize, contentType)) {
|
if (!mDeprecatedTextureClient->EnsureAllocated(aSize, contentType)) {
|
||||||
// We might already be on the fallback texture client if we couldn't create a
|
// We might already be on the fallback texture client if we couldn't create a
|
||||||
// better one above. In which case this call to create is wasted. But I don't
|
// better one above. In which case this call to create is wasted. But I don't
|
||||||
// think this will happen often enough to be worth complicating the code with
|
// think this will happen often enough to be worth complicating the code with
|
||||||
// further checks.
|
// further checks.
|
||||||
mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_FALLBACK);
|
mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_FALLBACK, contentType);
|
||||||
MOZ_ASSERT(mDeprecatedTextureClient, "Failed to create texture client");
|
MOZ_ASSERT(mDeprecatedTextureClient, "Failed to create texture client");
|
||||||
if (!mDeprecatedTextureClient->EnsureAllocated(aSize, contentType)) {
|
if (!mDeprecatedTextureClient->EnsureAllocated(aSize, contentType)) {
|
||||||
NS_WARNING("Could not allocate texture client");
|
NS_WARNING("Could not allocate texture client");
|
||||||
@@ -173,7 +173,10 @@ void
|
|||||||
DeprecatedCanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
|
DeprecatedCanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
|
||||||
{
|
{
|
||||||
if (!mDeprecatedTextureClient) {
|
if (!mDeprecatedTextureClient) {
|
||||||
mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_STREAM_GL);
|
mDeprecatedTextureClient = CreateDeprecatedTextureClient(TEXTURE_STREAM_GL,
|
||||||
|
aLayer->GetSurfaceMode() == Layer::SURFACE_OPAQUE
|
||||||
|
? gfxASurface::CONTENT_COLOR
|
||||||
|
: gfxASurface::CONTENT_COLOR_ALPHA);
|
||||||
MOZ_ASSERT(mDeprecatedTextureClient, "Failed to create texture client");
|
MOZ_ASSERT(mDeprecatedTextureClient, "Failed to create texture client");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "mozilla/layers/TextureClient.h" // for DeprecatedTextureClient, etc
|
#include "mozilla/layers/TextureClient.h" // for DeprecatedTextureClient, etc
|
||||||
#include "mozilla/layers/TextureClientOGL.h"
|
#include "mozilla/layers/TextureClientOGL.h"
|
||||||
#include "mozilla/mozalloc.h" // for operator delete, etc
|
#include "mozilla/mozalloc.h" // for operator delete, etc
|
||||||
|
#include "gfxASurface.h" // for gfxContentType
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
#include "mozilla/layers/TextureD3D9.h"
|
#include "mozilla/layers/TextureD3D9.h"
|
||||||
#include "mozilla/layers/TextureD3D11.h"
|
#include "mozilla/layers/TextureD3D11.h"
|
||||||
@@ -107,7 +108,8 @@ CompositableChild::Destroy()
|
|||||||
}
|
}
|
||||||
|
|
||||||
TemporaryRef<DeprecatedTextureClient>
|
TemporaryRef<DeprecatedTextureClient>
|
||||||
CompositableClient::CreateDeprecatedTextureClient(DeprecatedTextureClientType aDeprecatedTextureClientType)
|
CompositableClient::CreateDeprecatedTextureClient(DeprecatedTextureClientType aDeprecatedTextureClientType,
|
||||||
|
gfxASurface::gfxContentType aContentType)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(GetForwarder(), "Can't create a texture client if the compositable is not connected to the compositor.");
|
MOZ_ASSERT(GetForwarder(), "Can't create a texture client if the compositable is not connected to the compositor.");
|
||||||
LayersBackend parentBackend = GetForwarder()->GetCompositorBackendType();
|
LayersBackend parentBackend = GetForwarder()->GetCompositorBackendType();
|
||||||
@@ -145,7 +147,11 @@ CompositableClient::CreateDeprecatedTextureClient(DeprecatedTextureClientType aD
|
|||||||
}
|
}
|
||||||
if (parentBackend == LAYERS_D3D9 &&
|
if (parentBackend == LAYERS_D3D9 &&
|
||||||
!GetForwarder()->ForwardsToDifferentProcess()) {
|
!GetForwarder()->ForwardsToDifferentProcess()) {
|
||||||
result = new DeprecatedTextureClientD3D9(GetForwarder(), GetTextureInfo());
|
if (aContentType == gfxASurface::CONTENT_COLOR_ALPHA) {
|
||||||
|
result = new DeprecatedTextureClientDIB(GetForwarder(), GetTextureInfo());
|
||||||
|
} else {
|
||||||
|
result = new DeprecatedTextureClientD3D9(GetForwarder(), GetTextureInfo());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "mozilla/layers/LayersTypes.h" // for LayersBackend
|
#include "mozilla/layers/LayersTypes.h" // for LayersBackend
|
||||||
#include "mozilla/layers/PCompositableChild.h" // for PCompositableChild
|
#include "mozilla/layers/PCompositableChild.h" // for PCompositableChild
|
||||||
#include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc
|
#include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc
|
||||||
|
#include "gfxASurface.h" // for gfxContentType
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace layers {
|
namespace layers {
|
||||||
@@ -80,7 +81,8 @@ public:
|
|||||||
LayersBackend GetCompositorBackendType() const;
|
LayersBackend GetCompositorBackendType() const;
|
||||||
|
|
||||||
TemporaryRef<DeprecatedTextureClient>
|
TemporaryRef<DeprecatedTextureClient>
|
||||||
CreateDeprecatedTextureClient(DeprecatedTextureClientType aDeprecatedTextureClientType);
|
CreateDeprecatedTextureClient(DeprecatedTextureClientType aDeprecatedTextureClientType,
|
||||||
|
gfxASurface::gfxContentType aContentType = gfxASurface::CONTENT_SENTINEL);
|
||||||
|
|
||||||
virtual TemporaryRef<BufferTextureClient>
|
virtual TemporaryRef<BufferTextureClient>
|
||||||
CreateBufferTextureClient(gfx::SurfaceFormat aFormat, TextureFlags aFlags);
|
CreateBufferTextureClient(gfx::SurfaceFormat aFormat, TextureFlags aFlags);
|
||||||
|
|||||||
@@ -163,11 +163,11 @@ ContentClientRemoteBuffer::EndPaint()
|
|||||||
bool
|
bool
|
||||||
ContentClientRemoteBuffer::CreateAndAllocateDeprecatedTextureClient(RefPtr<DeprecatedTextureClient>& aClient)
|
ContentClientRemoteBuffer::CreateAndAllocateDeprecatedTextureClient(RefPtr<DeprecatedTextureClient>& aClient)
|
||||||
{
|
{
|
||||||
aClient = CreateDeprecatedTextureClient(TEXTURE_CONTENT);
|
aClient = CreateDeprecatedTextureClient(TEXTURE_CONTENT, mContentType);
|
||||||
MOZ_ASSERT(aClient, "Failed to create texture client");
|
MOZ_ASSERT(aClient, "Failed to create texture client");
|
||||||
|
|
||||||
if (!aClient->EnsureAllocated(mSize, mContentType)) {
|
if (!aClient->EnsureAllocated(mSize, mContentType)) {
|
||||||
aClient = CreateDeprecatedTextureClient(TEXTURE_FALLBACK);
|
aClient = CreateDeprecatedTextureClient(TEXTURE_FALLBACK, mContentType);
|
||||||
MOZ_ASSERT(aClient, "Failed to create texture client");
|
MOZ_ASSERT(aClient, "Failed to create texture client");
|
||||||
if (!aClient->EnsureAllocated(mSize, mContentType)) {
|
if (!aClient->EnsureAllocated(mSize, mContentType)) {
|
||||||
NS_WARNING("Could not allocate texture client");
|
NS_WARNING("Could not allocate texture client");
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ CreateDeprecatedTextureHostD3D9(SurfaceDescriptorType aDescriptorType,
|
|||||||
result = new DeprecatedTextureHostYCbCrD3D9();
|
result = new DeprecatedTextureHostYCbCrD3D9();
|
||||||
} else if (aDescriptorType == SurfaceDescriptor::TSurfaceDescriptorD3D9) {
|
} else if (aDescriptorType == SurfaceDescriptor::TSurfaceDescriptorD3D9) {
|
||||||
result = new DeprecatedTextureHostSystemMemD3D9();
|
result = new DeprecatedTextureHostSystemMemD3D9();
|
||||||
|
} else if (aDescriptorType == SurfaceDescriptor::TSurfaceDescriptorDIB) {
|
||||||
|
result = new DeprecatedTextureHostDIB();
|
||||||
} else {
|
} else {
|
||||||
result = new DeprecatedTextureHostShmemD3D9();
|
result = new DeprecatedTextureHostShmemD3D9();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user