Backed out changesets a6831c02d8cf, 5ab4f97a3220, 2784838dbc94, and 6364146ddb19 (bug 973892) for B2G bustage.

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2014-02-19 14:28:05 -05:00
parent 0428b78c2f
commit 0cdf10592f
15 changed files with 38 additions and 82 deletions

View File

@ -396,7 +396,7 @@ GrallocImage::GetTextureClient(CompositableClient* aClient)
flags |= TEXTURE_RB_SWAPPED;
}
GrallocBufferActor* actor = static_cast<GrallocBufferActor*>(desc.bufferChild());
mTextureClient = new GrallocTextureClientOGL(actor, mSize, gfx::BackendType::NONE, flags);
mTextureClient = new GrallocTextureClientOGL(actor, mSize, flags);
mTextureClient->SetGraphicBufferLocked(mGraphicBufferLocked);
}
return mTextureClient;

View File

@ -128,12 +128,13 @@ ImageDataSerializerBase::GetAsThebesSurface()
}
TemporaryRef<DrawTarget>
ImageDataSerializerBase::GetAsDrawTarget(gfx::BackendType aBackend)
ImageDataSerializerBase::GetAsDrawTarget()
{
MOZ_ASSERT(IsValid());
return gfx::Factory::CreateDrawTargetForData(aBackend,
GetData(), GetSize(),
GetStride(), GetFormat());
return gfxPlatform::GetPlatform()->CreateDrawTargetForData(GetData(),
GetSize(),
GetStride(),
GetFormat());
}
TemporaryRef<gfx::DataSourceSurface>

View File

@ -37,7 +37,7 @@ public:
gfx::SurfaceFormat GetFormat() const;
TemporaryRef<gfx::DataSourceSurface> GetAsSurface();
TemporaryRef<gfxImageSurface> GetAsThebesSurface();
TemporaryRef<gfx::DrawTarget> GetAsDrawTarget(gfx::BackendType aBackend);
TemporaryRef<gfx::DrawTarget> GetAsDrawTarget();
protected:

View File

@ -65,9 +65,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
: gfxContentType::COLOR_ALPHA;
gfxImageFormat format
= gfxPlatform::GetPlatform()->OptimalFormatForContent(contentType);
mBuffer = CreateBufferTextureClient(gfx::ImageFormatToSurfaceFormat(format),
TEXTURE_FLAGS_DEFAULT,
gfxPlatform::GetPlatform()->GetPreferredCanvasBackend());
mBuffer = CreateBufferTextureClient(gfx::ImageFormatToSurfaceFormat(format));
MOZ_ASSERT(mBuffer->AsTextureClientSurface());
mBuffer->AsTextureClientSurface()->AllocateForSurface(aSize);
@ -102,12 +100,10 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
}
TemporaryRef<BufferTextureClient>
CanvasClient2D::CreateBufferTextureClient(gfx::SurfaceFormat aFormat, TextureFlags aFlags,
gfx::BackendType aMoz2DBackend)
CanvasClient2D::CreateBufferTextureClient(gfx::SurfaceFormat aFormat, TextureFlags aFlags)
{
return CompositableClient::CreateBufferTextureClient(aFormat,
mTextureInfo.mTextureFlags | aFlags,
aMoz2DBackend);
mTextureInfo.mTextureFlags | aFlags);
}
CanvasClientSurfaceStream::CanvasClientSurfaceStream(CompositableForwarder* aLayerForwarder,

View File

@ -90,8 +90,7 @@ public:
virtual TemporaryRef<BufferTextureClient>
CreateBufferTextureClient(gfx::SurfaceFormat aFormat,
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT,
gfx::BackendType aMoz2DBackend = gfx::BackendType::NONE) MOZ_OVERRIDE;
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT) MOZ_OVERRIDE;
virtual void OnDetach() MOZ_OVERRIDE
{

View File

@ -179,8 +179,7 @@ CompositableClient::CreateDeprecatedTextureClient(DeprecatedTextureClientType aD
TemporaryRef<BufferTextureClient>
CompositableClient::CreateBufferTextureClient(SurfaceFormat aFormat,
TextureFlags aTextureFlags,
gfx::BackendType aMoz2DBackend)
TextureFlags aTextureFlags)
{
// XXX - Once bug 908196 is fixed, we can use gralloc textures here which will
// improve performances of videos using SharedPlanarYCbCrImage on b2g.
@ -193,14 +192,10 @@ CompositableClient::CreateBufferTextureClient(SurfaceFormat aFormat,
// }
//#endif
if (gfxPlatform::GetPlatform()->PreferMemoryOverShmem()) {
RefPtr<BufferTextureClient> result = new MemoryTextureClient(this, aFormat,
aMoz2DBackend,
aTextureFlags);
RefPtr<BufferTextureClient> result = new MemoryTextureClient(this, aFormat, aTextureFlags);
return result.forget();
}
RefPtr<BufferTextureClient> result = new ShmemTextureClient(this, aFormat,
aMoz2DBackend,
aTextureFlags);
RefPtr<BufferTextureClient> result = new ShmemTextureClient(this, aFormat, aTextureFlags);
return result.forget();
}
@ -239,26 +234,17 @@ DisableGralloc(SurfaceFormat aFormat)
TemporaryRef<TextureClient>
CompositableClient::CreateTextureClientForDrawing(SurfaceFormat aFormat,
TextureFlags aTextureFlags,
gfx::BackendType aMoz2DBackend)
TextureFlags aTextureFlags)
{
if (aMoz2DBackend == gfx::BackendType::NONE) {
aMoz2DBackend = gfxPlatform::GetPlatform()->GetContentBackend();
}
RefPtr<TextureClient> result;
#ifdef XP_WIN
LayersBackend parentBackend = GetForwarder()->GetCompositorBackendType();
if (parentBackend == LayersBackend::LAYERS_D3D11 &&
(aMoz2DBackend == gfx::BackendType::DIRECT2D ||
aMoz2DBackend == gfx::BackendType::DIRECT2D1_1) &&
gfxWindowsPlatform::GetPlatform()->GetD2DDevice() &&
if (parentBackend == LayersBackend::LAYERS_D3D11 && gfxWindowsPlatform::GetPlatform()->GetD2DDevice() &&
!(aTextureFlags & TEXTURE_ALLOC_FALLBACK)) {
result = new TextureClientD3D11(aFormat, aTextureFlags);
}
if (parentBackend == LayersBackend::LAYERS_D3D9 &&
aMoz2DBackend == gfx::BackendType::CAIRO &&
!GetForwarder()->ForwardsToDifferentProcess() &&
!(aTextureFlags & TEXTURE_ALLOC_FALLBACK)) {
if (!gfxWindowsPlatform::GetPlatform()->GetD3D9Device()) {
@ -275,7 +261,6 @@ CompositableClient::CreateTextureClientForDrawing(SurfaceFormat aFormat,
gfxPlatform::GetPlatform()->ScreenReferenceSurface()->GetType();
if (parentBackend == LayersBackend::LAYERS_BASIC &&
aMoz2DBackend == gfx::BackendType::CAIRO &&
type == gfxSurfaceType::Xlib &&
!(aTextureFlags & TEXTURE_ALLOC_FALLBACK))
{
@ -283,7 +268,6 @@ CompositableClient::CreateTextureClientForDrawing(SurfaceFormat aFormat,
}
#ifdef GL_PROVIDER_GLX
if (parentBackend == LayersBackend::LAYERS_OPENGL &&
aMoz2DBackend == gfx::BackendType::CAIRO &&
type == gfxSurfaceType::Xlib &&
!(aTextureFlags & TEXTURE_ALLOC_FALLBACK) &&
aFormat != SurfaceFormat::A8 &&
@ -296,14 +280,13 @@ CompositableClient::CreateTextureClientForDrawing(SurfaceFormat aFormat,
#ifdef MOZ_WIDGET_GONK
if (!DisableGralloc(aFormat)) {
result = new GrallocTextureClientOGL(this, aFormat, aMoz2DBackend,
aTextureFlags);
result = new GrallocTextureClientOGL(this, aFormat, aTextureFlags);
}
#endif
// Can't do any better than a buffer texture client.
if (!result) {
result = CreateBufferTextureClient(aFormat, aTextureFlags, aMoz2DBackend);
result = CreateBufferTextureClient(aFormat, aTextureFlags);
}
MOZ_ASSERT(!result || result->AsTextureClientDrawTarget(),

View File

@ -84,22 +84,15 @@ public:
CreateDeprecatedTextureClient(DeprecatedTextureClientType aDeprecatedTextureClientType,
gfxContentType aContentType = gfxContentType::SENTINEL);
// Creates a TextureClient that can be mapped in memory and access through a
// raw pointer.
// Generally it is best to use CreateTextureClientForDrawing and draw into
// the texture through Moz2D.
virtual TemporaryRef<BufferTextureClient>
CreateBufferTextureClient(gfx::SurfaceFormat aFormat,
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT,
gfx::BackendType aMoz2DBackend = gfx::BackendType::NONE);
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
// If we return a non-null TextureClient, then AsTextureClientDrawTarget will
// always be non-null.
// If aBackend is NONE, default to the content backend type.
TemporaryRef<TextureClient>
CreateTextureClientForDrawing(gfx::SurfaceFormat aFormat,
TextureFlags aTextureFlags,
gfx::BackendType aMoz2DBackend = gfx::BackendType::NONE);
TextureFlags aTextureFlags);
virtual void SetDescriptorFromReply(TextureIdentifier aTextureId,
const SurfaceDescriptor& aDescriptor)

View File

@ -311,11 +311,9 @@ ImageClientSingle::AddTextureClient(TextureClient* aTexture)
}
TemporaryRef<BufferTextureClient>
ImageClientSingle::CreateBufferTextureClient(gfx::SurfaceFormat aFormat, TextureFlags aFlags,
gfx::BackendType aMoz2DBackend)
ImageClientSingle::CreateBufferTextureClient(gfx::SurfaceFormat aFormat, TextureFlags aFlags)
{
return CompositableClient::CreateBufferTextureClient(aFormat, mTextureFlags | aFlags,
aMoz2DBackend);
return CompositableClient::CreateBufferTextureClient(aFormat, mTextureFlags | aFlags);
}
void

View File

@ -92,8 +92,7 @@ public:
virtual TemporaryRef<BufferTextureClient>
CreateBufferTextureClient(gfx::SurfaceFormat aFormat,
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT,
gfx::BackendType aMoz2DBackend = gfx::BackendType::NONE) MOZ_OVERRIDE;
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT) MOZ_OVERRIDE;
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE;

View File

@ -365,9 +365,8 @@ ShmemTextureClient::GetBufferSize() const
ShmemTextureClient::ShmemTextureClient(CompositableClient* aCompositable,
gfx::SurfaceFormat aFormat,
gfx::BackendType aBackend,
TextureFlags aFlags)
: BufferTextureClient(aCompositable, aFormat, aBackend, aFlags)
: BufferTextureClient(aCompositable, aFormat, aFlags)
, mAllocated(false)
{
MOZ_COUNT_CTOR(ShmemTextureClient);
@ -412,9 +411,8 @@ MemoryTextureClient::Allocate(uint32_t aSize)
MemoryTextureClient::MemoryTextureClient(CompositableClient* aCompositable,
gfx::SurfaceFormat aFormat,
gfx::BackendType aBackend,
TextureFlags aFlags)
: BufferTextureClient(aCompositable, aFormat, aBackend, aFlags)
: BufferTextureClient(aCompositable, aFormat, aFlags)
, mBuffer(nullptr)
, mBufSize(0)
{
@ -434,12 +432,10 @@ MemoryTextureClient::~MemoryTextureClient()
BufferTextureClient::BufferTextureClient(CompositableClient* aCompositable,
gfx::SurfaceFormat aFormat,
gfx::BackendType aBackend,
TextureFlags aFlags)
: TextureClient(aFlags)
, mCompositable(aCompositable)
, mFormat(aFormat)
, mBackend(aBackend)
, mUsingFallbackDrawTarget(false)
, mLocked(false)
{}
@ -542,15 +538,15 @@ BufferTextureClient::GetAsDrawTarget()
}
MOZ_ASSERT(mUsingFallbackDrawTarget == false);
mDrawTarget = serializer.GetAsDrawTarget(mBackend);
mDrawTarget = serializer.GetAsDrawTarget();
if (mDrawTarget) {
return mDrawTarget;
}
// fallback path, probably because the Moz2D backend can't create a
// DrawTarget around raw memory. This is going to be slow :(
mDrawTarget = gfx::Factory::CreateDrawTarget(mBackend, serializer.GetSize(),
serializer.GetFormat());
mDrawTarget = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(
serializer.GetSize(), serializer.GetFormat());
if (!mDrawTarget) {
return nullptr;
}

View File

@ -341,7 +341,7 @@ class BufferTextureClient : public TextureClient
{
public:
BufferTextureClient(CompositableClient* aCompositable, gfx::SurfaceFormat aFormat,
gfx::BackendType aBackend, TextureFlags aFlags);
TextureFlags aFlags);
virtual ~BufferTextureClient();
@ -401,7 +401,6 @@ protected:
CompositableClient* mCompositable;
gfx::SurfaceFormat mFormat;
gfx::IntSize mSize;
gfx::BackendType mBackend;
OpenMode mOpenMode;
bool mUsingFallbackDrawTarget;
bool mLocked;
@ -415,7 +414,7 @@ class ShmemTextureClient : public BufferTextureClient
{
public:
ShmemTextureClient(CompositableClient* aCompositable, gfx::SurfaceFormat aFormat,
gfx::BackendType aBackend, TextureFlags aFlags);
TextureFlags aFlags);
~ShmemTextureClient();
@ -450,7 +449,7 @@ class MemoryTextureClient : public BufferTextureClient
{
public:
MemoryTextureClient(CompositableClient* aCompositable, gfx::SurfaceFormat aFormat,
gfx::BackendType aBackend, TextureFlags aFlags);
TextureFlags aFlags);
~MemoryTextureClient();

View File

@ -93,9 +93,8 @@ GrallocTextureClientOGL::DropTextureData()
GrallocTextureClientOGL::GrallocTextureClientOGL(GrallocBufferActor* aActor,
gfx::IntSize aSize,
gfx::BackendType aMoz2DBackend,
TextureFlags aFlags)
: BufferTextureClient(nullptr, gfx::SurfaceFormat::UNKNOWN, aMoz2DBackend, aFlags)
: BufferTextureClient(nullptr, gfx::SurfaceFormat::UNKNOWN, aFlags)
, mAllocator(nullptr)
, mMappedBuffer(nullptr)
{
@ -105,9 +104,8 @@ GrallocTextureClientOGL::GrallocTextureClientOGL(GrallocBufferActor* aActor,
GrallocTextureClientOGL::GrallocTextureClientOGL(CompositableClient* aCompositable,
gfx::SurfaceFormat aFormat,
gfx::BackendType aMoz2DBackend,
TextureFlags aFlags)
: BufferTextureClient(aCompositable, aFormat, aMoz2DBackend, aFlags)
: BufferTextureClient(aCompositable, aFormat, aFlags)
, mAllocator(nullptr)
, mMappedBuffer(nullptr)
{
@ -116,9 +114,8 @@ GrallocTextureClientOGL::GrallocTextureClientOGL(CompositableClient* aCompositab
GrallocTextureClientOGL::GrallocTextureClientOGL(ISurfaceAllocator* aAllocator,
gfx::SurfaceFormat aFormat,
gfx::BackendType aMoz2DBackend,
TextureFlags aFlags)
: BufferTextureClient(nullptr, aFormat, aMoz2DBackend, aFlags)
: BufferTextureClient(nullptr, aFormat, aFlags)
, mAllocator(aAllocator)
, mMappedBuffer(nullptr)
{

View File

@ -35,15 +35,12 @@ class GrallocTextureClientOGL : public BufferTextureClient
public:
GrallocTextureClientOGL(GrallocBufferActor* aActor,
gfx::IntSize aSize,
gfx::BackendType aMoz2DMackend,
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
GrallocTextureClientOGL(CompositableClient* aCompositable,
gfx::SurfaceFormat aFormat,
gfx::BackendType aMoz2DMackend,
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
GrallocTextureClientOGL(ISurfaceAllocator* aAllocator,
gfx::SurfaceFormat aFormat,
gfx::BackendType aMoz2DMackend,
TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
~GrallocTextureClientOGL();

View File

@ -219,7 +219,6 @@ TEST(Layers, TextureSerialization) {
RefPtr<TextureClient> client
= new MemoryTextureClient(nullptr,
mozilla::gfx::ImageFormatToSurfaceFormat(surface->Format()),
gfx::BackendType::CAIRO,
TEXTURE_DEALLOCATE_CLIENT);
TestTextureClientSurface(client, surface);
@ -256,7 +255,6 @@ TEST(Layers, TextureYCbCrSerialization) {
RefPtr<TextureClient> client
= new MemoryTextureClient(nullptr,
mozilla::gfx::SurfaceFormat::YUV,
gfx::BackendType::CAIRO,
TEXTURE_DEALLOCATE_CLIENT);
TestTextureClientYCbCr(client, clientData);

View File

@ -293,10 +293,6 @@ public:
aObj.DefineProperty("AzureContentBackend", GetBackendName(mContentBackend));
}
mozilla::gfx::BackendType GetContentBackend() {
return mContentBackend;
}
mozilla::gfx::BackendType GetPreferredCanvasBackend() {
return mPreferredCanvasBackend;
}
@ -686,6 +682,10 @@ protected:
*/
static mozilla::gfx::BackendType BackendTypeForName(const nsCString& aName);
mozilla::gfx::BackendType GetContentBackend() {
return mContentBackend;
}
static mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
GetScaledFontForFontWithCairoSkia(mozilla::gfx::DrawTarget* aTarget, gfxFont* aFont);