зеркало из https://github.com/mozilla/gecko-dev.git
Remove the backend flag to TextureClient::CreateForDrawing. (bug 1183910 part 9, r=mattwoodrow)
This commit is contained in:
Родитель
a2d36e844e
Коммит
ff609fc994
|
@ -633,7 +633,7 @@ CairoImage::GetTextureClient(CompositableClient *aClient)
|
|||
// gfx::BackendType::NONE means default to content backend
|
||||
textureClient = aClient->CreateTextureClientForDrawing(surface->GetFormat(),
|
||||
surface->GetSize(),
|
||||
gfx::BackendType::NONE,
|
||||
BackendSelector::Content,
|
||||
TextureFlags::DEFAULT);
|
||||
}
|
||||
if (!textureClient) {
|
||||
|
|
|
@ -126,14 +126,13 @@ CanvasClient2D::CreateTextureClientForCanvas(gfx::SurfaceFormat aFormat,
|
|||
mTextureFlags | aFlags);
|
||||
}
|
||||
|
||||
gfx::BackendType backend = gfxPlatform::GetPlatform()->GetPreferredCanvasBackend();
|
||||
#ifdef XP_WIN
|
||||
return CreateTextureClientForDrawing(aFormat, aSize, backend, aFlags);
|
||||
return CreateTextureClientForDrawing(aFormat, aSize, BackendSelector::Canvas, aFlags);
|
||||
#else
|
||||
// XXX - We should use CreateTextureClientForDrawing, but we first need
|
||||
// to use double buffering.
|
||||
return TextureClient::CreateForRawBufferAccess(GetForwarder(),
|
||||
aFormat, aSize, backend,
|
||||
aFormat, aSize, gfx::BackendType::NONE,
|
||||
mTextureFlags | aFlags);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -207,12 +207,12 @@ CompositableClient::CreateBufferTextureClient(gfx::SurfaceFormat aFormat,
|
|||
already_AddRefed<TextureClient>
|
||||
CompositableClient::CreateTextureClientForDrawing(gfx::SurfaceFormat aFormat,
|
||||
gfx::IntSize aSize,
|
||||
gfx::BackendType aMoz2DBackend,
|
||||
BackendSelector aSelector,
|
||||
TextureFlags aTextureFlags,
|
||||
TextureAllocationFlags aAllocFlags)
|
||||
{
|
||||
return TextureClient::CreateForDrawing(GetForwarder(),
|
||||
aFormat, aSize, aMoz2DBackend,
|
||||
aFormat, aSize, aSelector,
|
||||
aTextureFlags | mTextureFlags,
|
||||
aAllocFlags);
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ public:
|
|||
already_AddRefed<TextureClient>
|
||||
CreateTextureClientForDrawing(gfx::SurfaceFormat aFormat,
|
||||
gfx::IntSize aSize,
|
||||
gfx::BackendType aMoz2DBackend,
|
||||
BackendSelector aSelector,
|
||||
TextureFlags aTextureFlags,
|
||||
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT);
|
||||
|
||||
|
|
|
@ -293,7 +293,7 @@ ContentClientRemoteBuffer::CreateBackBuffer(const IntRect& aBufferRect)
|
|||
{
|
||||
// gfx::BackendType::NONE means fallback to the content backend
|
||||
mTextureClient = CreateTextureClientForDrawing(
|
||||
mSurfaceFormat, mSize, gfx::BackendType::NONE,
|
||||
mSurfaceFormat, mSize, BackendSelector::Content,
|
||||
mTextureFlags | ExtraTextureFlags(),
|
||||
TextureAllocationFlags::ALLOC_CLEAR_BUFFER
|
||||
);
|
||||
|
|
|
@ -216,7 +216,7 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer, uint32_t aContentFlag
|
|||
RefPtr<gfx::SourceSurface> surface = image->GetAsSourceSurface();
|
||||
MOZ_ASSERT(surface);
|
||||
texture = CreateTextureClientForDrawing(surface->GetFormat(), image->GetSize(),
|
||||
gfx::BackendType::NONE, mTextureFlags);
|
||||
BackendSelector::Content, mTextureFlags);
|
||||
if (!texture) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ already_AddRefed<TextureClient>
|
|||
ClientSingleTiledLayerBuffer::GetTextureClient()
|
||||
{
|
||||
return mCompositableClient->CreateTextureClientForDrawing(
|
||||
gfx::ImageFormatToSurfaceFormat(mFormat), mSize, gfx::BackendType::NONE,
|
||||
gfx::ImageFormatToSurfaceFormat(mFormat), mSize, BackendSelector::Content,
|
||||
TextureFlags::IMMEDIATE_UPLOAD);
|
||||
}
|
||||
|
||||
|
|
|
@ -320,18 +320,30 @@ CreateBufferTextureClient(ISurfaceAllocator* aAllocator,
|
|||
return result.forget();
|
||||
}
|
||||
|
||||
static inline gfx::BackendType
|
||||
BackendTypeForBackendSelector(BackendSelector aSelector)
|
||||
{
|
||||
switch (aSelector) {
|
||||
case BackendSelector::Canvas:
|
||||
return gfxPlatform::GetPlatform()->GetPreferredCanvasBackend();
|
||||
case BackendSelector::Content:
|
||||
return gfxPlatform::GetPlatform()->GetContentBackend();
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unknown backend selector");
|
||||
return gfx::BackendType::NONE;
|
||||
}
|
||||
};
|
||||
|
||||
// static
|
||||
already_AddRefed<TextureClient>
|
||||
TextureClient::CreateForDrawing(ISurfaceAllocator* aAllocator,
|
||||
gfx::SurfaceFormat aFormat,
|
||||
gfx::IntSize aSize,
|
||||
gfx::BackendType aMoz2DBackend,
|
||||
BackendSelector aSelector,
|
||||
TextureFlags aTextureFlags,
|
||||
TextureAllocationFlags aAllocFlags)
|
||||
{
|
||||
if (aMoz2DBackend == gfx::BackendType::NONE) {
|
||||
aMoz2DBackend = gfxPlatform::GetPlatform()->GetContentBackend();
|
||||
}
|
||||
gfx::BackendType moz2DBackend = BackendTypeForBackendSelector(aSelector);
|
||||
|
||||
RefPtr<TextureClient> texture;
|
||||
|
||||
|
@ -342,15 +354,15 @@ TextureClient::CreateForDrawing(ISurfaceAllocator* aAllocator,
|
|||
#ifdef XP_WIN
|
||||
LayersBackend parentBackend = aAllocator->GetCompositorBackendType();
|
||||
if (parentBackend == LayersBackend::LAYERS_D3D11 &&
|
||||
((aMoz2DBackend == gfx::BackendType::DIRECT2D && Factory::GetDirect3D10Device()) ||
|
||||
(aMoz2DBackend == gfx::BackendType::DIRECT2D1_1 && Factory::GetDirect3D11Device())) &&
|
||||
(moz2DBackend == gfx::BackendType::DIRECT2D ||
|
||||
moz2DBackend == gfx::BackendType::DIRECT2D1_1) &&
|
||||
aSize.width <= maxTextureSize &&
|
||||
aSize.height <= maxTextureSize)
|
||||
{
|
||||
texture = new TextureClientD3D11(aAllocator, aFormat, aTextureFlags);
|
||||
}
|
||||
if (parentBackend == LayersBackend::LAYERS_D3D9 &&
|
||||
aMoz2DBackend == gfx::BackendType::CAIRO &&
|
||||
moz2DBackend == gfx::BackendType::CAIRO &&
|
||||
aAllocator->IsSameProcess() &&
|
||||
aSize.width <= maxTextureSize &&
|
||||
aSize.height <= maxTextureSize &&
|
||||
|
@ -362,7 +374,7 @@ TextureClient::CreateForDrawing(ISurfaceAllocator* aAllocator,
|
|||
|
||||
if (!texture && aFormat == SurfaceFormat::B8G8R8X8 &&
|
||||
aAllocator->IsSameProcess() &&
|
||||
aMoz2DBackend == gfx::BackendType::CAIRO &&
|
||||
moz2DBackend == gfx::BackendType::CAIRO &&
|
||||
NS_IsMainThread()) {
|
||||
if (aAllocator->IsSameProcess()) {
|
||||
texture = new TextureClientMemoryDIB(aAllocator, aFormat, aTextureFlags);
|
||||
|
@ -378,7 +390,7 @@ TextureClient::CreateForDrawing(ISurfaceAllocator* aAllocator,
|
|||
gfxPlatform::GetPlatform()->ScreenReferenceSurface()->GetType();
|
||||
|
||||
if (parentBackend == LayersBackend::LAYERS_BASIC &&
|
||||
aMoz2DBackend == gfx::BackendType::CAIRO &&
|
||||
moz2DBackend == gfx::BackendType::CAIRO &&
|
||||
type == gfxSurfaceType::Xlib)
|
||||
{
|
||||
texture = new TextureClientX11(aAllocator, aFormat, aTextureFlags);
|
||||
|
@ -399,7 +411,7 @@ TextureClient::CreateForDrawing(ISurfaceAllocator* aAllocator,
|
|||
// Don't allow Gralloc texture clients to exceed the maximum texture size.
|
||||
// BufferTextureClients have code to handle tiling the surface client-side.
|
||||
if (aSize.width <= maxTextureSize && aSize.height <= maxTextureSize) {
|
||||
texture = new GrallocTextureClientOGL(aAllocator, aFormat, aMoz2DBackend,
|
||||
texture = new GrallocTextureClientOGL(aAllocator, aFormat, moz2DBackend,
|
||||
aTextureFlags);
|
||||
}
|
||||
}
|
||||
|
@ -420,7 +432,7 @@ TextureClient::CreateForDrawing(ISurfaceAllocator* aAllocator,
|
|||
}
|
||||
|
||||
// Can't do any better than a buffer texture client.
|
||||
texture = CreateBufferTextureClient(aAllocator, aFormat, aTextureFlags, aMoz2DBackend);
|
||||
texture = CreateBufferTextureClient(aAllocator, aFormat, aTextureFlags, moz2DBackend);
|
||||
|
||||
if (!texture->AllocateForSurface(aSize, aAllocFlags)) {
|
||||
return nullptr;
|
||||
|
|
|
@ -138,6 +138,12 @@ protected:
|
|||
virtual ~TextureReadbackSink() {}
|
||||
};
|
||||
|
||||
enum class BackendSelector
|
||||
{
|
||||
Content,
|
||||
Canvas
|
||||
};
|
||||
|
||||
/**
|
||||
* TextureClient is a thin abstraction over texture data that need to be shared
|
||||
* between the content process and the compositor process. It is the
|
||||
|
@ -174,7 +180,7 @@ public:
|
|||
CreateForDrawing(ISurfaceAllocator* aAllocator,
|
||||
gfx::SurfaceFormat aFormat,
|
||||
gfx::IntSize aSize,
|
||||
gfx::BackendType aMoz2dBackend,
|
||||
BackendSelector aSelector,
|
||||
TextureFlags aTextureFlags,
|
||||
TextureAllocationFlags flags = ALLOC_DEFAULT);
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ TextureClientPool::GetTextureClient()
|
|||
TextureFlags::IMMEDIATE_UPLOAD, ALLOC_DEFAULT);
|
||||
} else {
|
||||
textureClient = TextureClient::CreateForDrawing(mSurfaceAllocator,
|
||||
mFormat, mSize, gfx::BackendType::NONE, TextureFlags::IMMEDIATE_UPLOAD);
|
||||
mFormat, mSize, BackendSelector::Content, TextureFlags::IMMEDIATE_UPLOAD);
|
||||
}
|
||||
|
||||
mOutstandingClients++;
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
already_AddRefed<TextureClient>
|
||||
CreateOrRecycleForDrawing(gfx::SurfaceFormat aFormat,
|
||||
gfx::IntSize aSize,
|
||||
gfx::BackendType aMoz2dBackend,
|
||||
BackendSelector aSelector,
|
||||
TextureFlags aTextureFlags,
|
||||
TextureAllocationFlags flags);
|
||||
|
||||
|
@ -141,7 +141,7 @@ already_AddRefed<TextureClient>
|
|||
TextureClientRecycleAllocatorImp::CreateOrRecycleForDrawing(
|
||||
gfx::SurfaceFormat aFormat,
|
||||
gfx::IntSize aSize,
|
||||
gfx::BackendType aMoz2DBackend,
|
||||
BackendSelector aSelector,
|
||||
TextureFlags aTextureFlags,
|
||||
TextureAllocationFlags aAllocFlags)
|
||||
{
|
||||
|
@ -154,10 +154,6 @@ TextureClientRecycleAllocatorImp::CreateOrRecycleForDrawing(
|
|||
|
||||
RefPtr<TextureClientHolder> textureHolder;
|
||||
|
||||
if (aMoz2DBackend == gfx::BackendType::NONE) {
|
||||
aMoz2DBackend = gfxPlatform::GetPlatform()->GetContentBackend();
|
||||
}
|
||||
|
||||
{
|
||||
MutexAutoLock lock(mLock);
|
||||
if (mDestroyed) {
|
||||
|
@ -183,7 +179,7 @@ TextureClientRecycleAllocatorImp::CreateOrRecycleForDrawing(
|
|||
if (!textureHolder) {
|
||||
// Allocate new TextureClient
|
||||
RefPtr<TextureClient> texture;
|
||||
texture = TextureClient::CreateForDrawing(this, aFormat, aSize, aMoz2DBackend,
|
||||
texture = TextureClient::CreateForDrawing(this, aFormat, aSize, aSelector,
|
||||
aTextureFlags, aAllocFlags);
|
||||
if (!texture) {
|
||||
return nullptr;
|
||||
|
@ -261,13 +257,13 @@ already_AddRefed<TextureClient>
|
|||
TextureClientRecycleAllocator::CreateOrRecycleForDrawing(
|
||||
gfx::SurfaceFormat aFormat,
|
||||
gfx::IntSize aSize,
|
||||
gfx::BackendType aMoz2DBackend,
|
||||
BackendSelector aSelector,
|
||||
TextureFlags aTextureFlags,
|
||||
TextureAllocationFlags aAllocFlags)
|
||||
{
|
||||
return mAllocator->CreateOrRecycleForDrawing(aFormat,
|
||||
aSize,
|
||||
aMoz2DBackend,
|
||||
aSelector,
|
||||
aTextureFlags,
|
||||
aAllocFlags);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
already_AddRefed<TextureClient>
|
||||
CreateOrRecycleForDrawing(gfx::SurfaceFormat aFormat,
|
||||
gfx::IntSize aSize,
|
||||
gfx::BackendType aMoz2dBackend,
|
||||
BackendSelector aSelector,
|
||||
TextureFlags aTextureFlags,
|
||||
TextureAllocationFlags flags = ALLOC_DEFAULT);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче