Bug 1066280 - Fixes. - r=kamidphish,mattwoodrow

From 4e9f52ab105333e8b1120342e9583b2d833a4465 Mon Sep 17 00:00:00 2001
---
 dom/canvas/WebGLContext.cpp                | 10 +++++--
 gfx/gl/GLContext.cpp                       | 20 --------------
 gfx/gl/GLContext.h                         |  3 --
 gfx/gl/GLReadTexImageHelper.cpp            |  5 +++-
 gfx/gl/GLScreenBuffer.cpp                  | 13 +++++++--
 gfx/gl/GLUploadHelpers.cpp                 | 27 ++++++++++++++++++
 gfx/gl/SharedSurfaceGralloc.cpp            | 14 ++++------
 gfx/gl/SharedSurfaceGralloc.h              | 10 +++++--
 gfx/gl/SurfaceTypes.cpp                    |  2 ++
 gfx/gl/SurfaceTypes.h                      |  1 +
 gfx/layers/client/CanvasClient.cpp         | 44 ++++++++++++++++++------------
 gfx/layers/client/CanvasClient.h           |  8 +++---
 gfx/layers/client/ClientCanvasLayer.cpp    |  6 ++++
 gfx/layers/client/ClientCanvasLayer.h      |  2 +-
 gfx/layers/client/TextureClient.cpp        | 11 ++++----
 gfx/layers/client/TextureClient.h          |  6 ++--
 gfx/layers/composite/TextureHost.cpp       | 15 +++++-----
 gfx/layers/composite/TextureHost.h         | 10 +++----
 gfx/layers/d3d10/CanvasLayerD3D10.cpp      |  9 ++++--
 gfx/layers/d3d9/CanvasLayerD3D9.cpp        |  8 ++++--
 gfx/layers/ipc/LayersSurfaces.ipdlh        |  4 +--
 gfx/layers/moz.build                       |  4 ++-
 gfx/layers/opengl/GrallocTextureClient.cpp | 26 +++++++++++++++++-
 gfx/layers/opengl/GrallocTextureClient.h   |  3 ++
 24 files changed, 171 insertions(+), 90 deletions(-)
This commit is contained in:
jdashg 2014-10-07 21:11:54 -07:00
parent bd7ba17b6a
commit 97fbd15434
24 changed files with 171 additions and 90 deletions

View File

@ -661,6 +661,7 @@ CreateOffscreen(GLContext* gl,
baseCaps.alpha = options.alpha;
baseCaps.antialias = options.antialias;
baseCaps.depth = options.depth;
baseCaps.premultAlpha = options.premultipliedAlpha;
baseCaps.preserve = options.preserveDrawingBuffer;
baseCaps.stencil = options.stencil;
@ -1421,10 +1422,15 @@ WebGLContext::PresentScreenBuffer()
if (!mShouldPresent) {
return false;
}
MOZ_ASSERT(!mBackbufferNeedsClear);
gl->MakeCurrent();
MOZ_ASSERT(!mBackbufferNeedsClear);
if (!gl->PublishFrame()) {
auto screen = gl->Screen();
MOZ_ASSERT(screen);
auto size = screen->Size();
if (!screen->PublishFrame(size)) {
ForceLoseContext();
return false;
}

View File

@ -1992,26 +1992,6 @@ GLContext::AssembleOffscreenFBs(const GLuint colorMSRB,
}
bool
GLContext::PublishFrame()
{
MOZ_ASSERT(mScreen);
return mScreen->PublishFrame(OffscreenSize());
}
SharedSurface*
GLContext::RequestFrame()
{
MOZ_ASSERT(mScreen);
MOZ_CRASH("Not anymore!");
return nullptr;
}
void
GLContext::ClearSafely()
{

View File

@ -3529,9 +3529,6 @@ public:
return mScreen.get();
}
bool PublishFrame();
SharedSurface* RequestFrame();
/* Clear to transparent black, with 0 depth and stencil,
* while preserving current ClearColor etc. values.
* Useful for resizing offscreen buffers.

View File

@ -192,8 +192,11 @@ GetActualReadFormats(GLContext* gl,
break;
}
case LOCAL_GL_BGRA: {
if (destType == LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV)
if (destType == LOCAL_GL_UNSIGNED_BYTE ||
destType == LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV)
{
fallback = false;
}
break;
}
}

View File

@ -6,6 +6,7 @@
#include "GLScreenBuffer.h"
#include <cstring>
#include "CompositorTypes.h"
#include "GLContext.h"
#include "GLBlitHelper.h"
#include "GLReadTexImageHelper.h"
@ -43,11 +44,19 @@ GLScreenBuffer::Create(GLContext* gl,
#ifdef MOZ_WIDGET_GONK
/* On B2G, we want a Gralloc factory, and we want one right at the start */
auto allocator = caps.surfaceAllocator;
if (!factory &&
caps.surfaceAllocator &&
allocator &&
XRE_GetProcessType() != GeckoProcessType_Default)
{
factory = MakeUnique<SurfaceFactory_Gralloc>(gl, caps);
layers::TextureFlags flags = TextureFlags::DEALLOCATE_CLIENT |
TextureFlags::NEEDS_Y_FLIP;
if (!caps.premultAlpha) {
flags |= TextureFlags::NON_PREMULTIPLIED;
}
factory = MakeUnique<SurfaceFactory_Gralloc>(gl, caps, flags,
allocator);
}
#endif
#ifdef XP_MACOSX

View File

@ -430,6 +430,7 @@ UploadImageDataToTexture(GLContext* gl,
MOZ_ASSERT(gl->GetPreferredARGB32Format() == LOCAL_GL_BGRA ||
gl->GetPreferredARGB32Format() == LOCAL_GL_RGBA);
switch (aFormat) {
case SurfaceFormat::B8G8R8A8:
if (gl->GetPreferredARGB32Format() == LOCAL_GL_BGRA) {
@ -457,6 +458,32 @@ UploadImageDataToTexture(GLContext* gl,
}
internalFormat = LOCAL_GL_RGBA;
break;
case SurfaceFormat::R8G8B8A8:
if (gl->GetPreferredARGB32Format() == LOCAL_GL_BGRA) {
format = LOCAL_GL_BGRA;
type = LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV;
surfaceFormat = SurfaceFormat::B8G8R8A8;
} else {
format = LOCAL_GL_RGBA;
type = LOCAL_GL_UNSIGNED_BYTE;
surfaceFormat = SurfaceFormat::R8G8B8A8;
}
internalFormat = LOCAL_GL_RGBA;
break;
case SurfaceFormat::R8G8B8X8:
// Treat RGBX surfaces as RGBA except for the surface
// format used.
if (gl->GetPreferredARGB32Format() == LOCAL_GL_BGRA) {
format = LOCAL_GL_BGRA;
type = LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV;
surfaceFormat = SurfaceFormat::B8G8R8X8;
} else {
format = LOCAL_GL_RGBA;
type = LOCAL_GL_UNSIGNED_BYTE;
surfaceFormat = SurfaceFormat::R8G8B8X8;
}
internalFormat = LOCAL_GL_RGBA;
break;
case SurfaceFormat::R5G6B5:
internalFormat = format = LOCAL_GL_RGB;
type = LOCAL_GL_UNSIGNED_SHORT_5_6_5;

View File

@ -37,16 +37,13 @@ using namespace android;
SurfaceFactory_Gralloc::SurfaceFactory_Gralloc(GLContext* prodGL,
const SurfaceCaps& caps,
layers::TextureFlags flags,
layers::ISurfaceAllocator* allocator)
: SurfaceFactory(prodGL, SharedSurfaceType::Gralloc, caps)
, mFlags(flags)
, mAllocator(allocator)
{
if (caps.surfaceAllocator) {
allocator = caps.surfaceAllocator;
}
MOZ_ASSERT(allocator);
mAllocator = allocator;
MOZ_ASSERT(mAllocator);
}
/*static*/ UniquePtr<SharedSurface_Gralloc>
@ -54,6 +51,7 @@ SharedSurface_Gralloc::Create(GLContext* prodGL,
const GLFormats& formats,
const gfx::IntSize& size,
bool hasAlpha,
layers::TextureFlags flags,
ISurfaceAllocator* allocator)
{
GLLibraryEGL* egl = &sEGLLibrary;
@ -77,7 +75,7 @@ SharedSurface_Gralloc::Create(GLContext* prodGL,
allocator,
gfx::ImageFormatToSurfaceFormat(format),
gfx::BackendType::NONE, // we don't need to use it with a DrawTarget
layers::TextureFlags::DEFAULT);
flags);
if (!grallocTC->AllocateForGLRendering(size)) {
return Move(ret);

View File

@ -6,6 +6,7 @@
#ifndef SHARED_SURFACE_GRALLOC_H_
#define SHARED_SURFACE_GRALLOC_H_
#include "mozilla/layers/CompositorTypes.h"
#include "mozilla/layers/LayersSurfaces.h"
#include "SharedSurface.h"
@ -27,6 +28,7 @@ public:
const GLFormats& formats,
const gfx::IntSize& size,
bool hasAlpha,
layers::TextureFlags flags,
layers::ISurfaceAllocator* allocator);
static SharedSurface_Gralloc* Cast(SharedSurface* surf) {
@ -77,20 +79,22 @@ class SurfaceFactory_Gralloc
: public SurfaceFactory
{
protected:
const layers::TextureFlags mFlags;
RefPtr<layers::ISurfaceAllocator> mAllocator;
public:
SurfaceFactory_Gralloc(GLContext* prodGL,
const SurfaceCaps& caps,
layers::ISurfaceAllocator* allocator = nullptr);
layers::TextureFlags flags,
layers::ISurfaceAllocator* allocator);
virtual UniquePtr<SharedSurface> CreateShared(const gfx::IntSize& size) MOZ_OVERRIDE {
bool hasAlpha = mReadCaps.alpha;
UniquePtr<SharedSurface> ret;
if (mAllocator) {
ret = SharedSurface_Gralloc::Create(mGL, mFormats, size,
hasAlpha, mAllocator);
ret = SharedSurface_Gralloc::Create(mGL, mFormats, size, hasAlpha,
mFlags, mAllocator);
}
return Move(ret);
}

View File

@ -30,6 +30,7 @@ SurfaceCaps::operator=(const SurfaceCaps& other)
depth = other.depth;
stencil = other.stencil;
antialias = other.antialias;
premultAlpha = other.premultAlpha;
preserve = other.preserve;
surfaceAllocator = other.surfaceAllocator;
@ -46,6 +47,7 @@ SurfaceCaps::Clear()
depth = false;
stencil = false;
antialias = false;
premultAlpha = false;
preserve = false;
surfaceAllocator = nullptr;
}

View File

@ -25,6 +25,7 @@ struct SurfaceCaps MOZ_FINAL
bool bpp16;
bool depth, stencil;
bool antialias;
bool premultAlpha;
bool preserve;
// The surface allocator that we want to create this

View File

@ -48,7 +48,7 @@ CanvasClient::CreateCanvasClient(CanvasClientType aType,
switch (aType) {
case CanvasClientTypeShSurf:
return new CanvasClientShSurf(aForwarder, aFlags);
return new CanvasClientSharedSurface(aForwarder, aFlags);
case CanvasClientGLContext:
aFlags |= TextureFlags::DEALLOCATE_CLIENT;
@ -240,8 +240,8 @@ CanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
////////////////////////////////////////////////////////////////////////
CanvasClientShSurf::CanvasClientShSurf(CompositableForwarder* aLayerForwarder,
TextureFlags aFlags)
CanvasClientSharedSurface::CanvasClientSharedSurface(CompositableForwarder* aLayerForwarder,
TextureFlags aFlags)
: CanvasClient(aLayerForwarder, aFlags)
{
}
@ -250,10 +250,8 @@ CanvasClientShSurf::CanvasClientShSurf(CompositableForwarder* aLayerForwarder,
// Accelerated backends
static TemporaryRef<TextureClient>
TexClientFromShSurf(SharedSurface* surf, TextureFlags baseFlags)
TexClientFromShSurf(SharedSurface* surf, TextureFlags flags)
{
TextureFlags flags = baseFlags | TextureFlags::DEALLOCATE_CLIENT;
switch (surf->mType) {
case SharedSurfaceType::Basic:
return nullptr;
@ -264,7 +262,7 @@ TexClientFromShSurf(SharedSurface* surf, TextureFlags baseFlags)
#endif
default:
return new ShSurfTexClient(flags, surf);
return new SharedSurfaceTextureClient(flags, surf);
}
}
@ -284,16 +282,18 @@ class TexClientFactory
const gfx::IntSize mSize;
const gfx::BackendType mBackendType;
const TextureFlags mBaseTexFlags;
const LayersBackend mLayersBackend;
public:
TexClientFactory(ISurfaceAllocator* allocator, bool hasAlpha,
const gfx::IntSize& size, gfx::BackendType backendType,
TextureFlags baseTexFlags)
TextureFlags baseTexFlags, LayersBackend layersBackend)
: mAllocator(allocator)
, mHasAlpha(hasAlpha)
, mSize(size)
, mBackendType(backendType)
, mBaseTexFlags(baseTexFlags)
, mLayersBackend(layersBackend)
{
}
@ -312,11 +312,20 @@ public:
}
TemporaryRef<BufferTextureClient> CreateR8G8B8AX8() {
// For now, assume that all RGBA formats are broken.
RefPtr<BufferTextureClient> ret = CreateB8G8R8AX8();
RefPtr<BufferTextureClient> ret;
if (ret) {
ret->AddFlags(TextureFlags::RB_SWAPPED);
bool areRGBAFormatsBroken = mLayersBackend == LayersBackend::LAYERS_BASIC;
if (!areRGBAFormatsBroken) {
gfx::SurfaceFormat format = mHasAlpha ? gfx::SurfaceFormat::R8G8B8A8
: gfx::SurfaceFormat::R8G8B8X8;
ret = Create(format);
}
if (!ret) {
ret = CreateB8G8R8AX8();
if (ret) {
ret->AddFlags(TextureFlags::RB_SWAPPED);
}
}
return ret.forget();
@ -329,7 +338,7 @@ TexClientFromReadback(SharedSurface* src, ISurfaceAllocator* allocator,
{
auto backendType = gfx::BackendType::CAIRO;
TexClientFactory factory(allocator, src->mHasAlpha, src->mSize, backendType,
baseFlags);
baseFlags, layersBackend);
RefPtr<BufferTextureClient> texClient;
@ -389,8 +398,10 @@ TexClientFromReadback(SharedSurface* src, ISurfaceAllocator* allocator,
// RB_SWAPPED doesn't work with D3D11. (bug 1051010)
// RB_SWAPPED doesn't work with Basic. (bug ???????)
bool layersNeedsManualSwap = layersBackend == LayersBackend::LAYERS_D3D11 ||
layersBackend == LayersBackend::LAYERS_BASIC;
// RB_SWAPPED doesn't work with D3D9. (bug ???????)
bool layersNeedsManualSwap = layersBackend == LayersBackend::LAYERS_BASIC ||
layersBackend == LayersBackend::LAYERS_D3D9 ||
layersBackend == LayersBackend::LAYERS_D3D11;
if (texClient->HasFlags(TextureFlags::RB_SWAPPED) &&
layersNeedsManualSwap)
{
@ -413,7 +424,7 @@ TexClientFromReadback(SharedSurface* src, ISurfaceAllocator* allocator,
////////////////////////////////////////
void
CanvasClientShSurf::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
CanvasClientSharedSurface::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
{
aLayer->mGLContext->MakeCurrent();
GLScreenBuffer* screen = aLayer->mGLContext->Screen();
@ -424,7 +435,6 @@ CanvasClientShSurf::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
}
mFront = screen->Front();
if (!mFront)
return;

View File

@ -142,7 +142,7 @@ private:
// Used for GL canvases where we don't need to do any readback, i.e., with a
// GL backend.
class CanvasClientShSurf : public CanvasClient
class CanvasClientSharedSurface : public CanvasClient
{
private:
RefPtr<gl::ShSurfHandle> mFront;
@ -151,8 +151,8 @@ private:
RefPtr<TextureClient> mFrontTex;
public:
CanvasClientShSurf(CompositableForwarder* aLayerForwarder,
TextureFlags aFlags);
CanvasClientSharedSurface(CompositableForwarder* aLayerForwarder,
TextureFlags aFlags);
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE {
return TextureInfo(CompositableType::IMAGE);
@ -168,7 +168,7 @@ public:
ClientCanvasLayer* aLayer) MOZ_OVERRIDE;
virtual void OnDetach() MOZ_OVERRIDE {
CanvasClientShSurf::Clear();
CanvasClientSharedSurface::Clear();
}
};

View File

@ -77,8 +77,14 @@ ClientCanvasLayer::Initialize(const Data& aData)
case mozilla::layers::LayersBackend::LAYERS_OPENGL: {
if (mGLContext->GetContextType() == GLContextType::EGL) {
#ifdef MOZ_WIDGET_GONK
TextureFlags flags = TextureFlags::DEALLOCATE_CLIENT |
TextureFlags::NEEDS_Y_FLIP;
if (!aData.mIsGLAlphaPremult) {
flags |= TextureFlags::NON_PREMULTIPLIED;
}
factory = MakeUnique<SurfaceFactory_Gralloc>(mGLContext,
caps,
flags,
ClientManager()->AsShadowForwarder());
#else
bool isCrossProcess = !(XRE_GetProcessType() == GeckoProcessType_Default);

View File

@ -102,7 +102,7 @@ protected:
friend class CanvasClient2D;
friend class DeprecatedCanvasClientSurfaceStream;
friend class CanvasClientSurfaceStream;
friend class CanvasClientShSurf;
friend class CanvasClientSharedSurface;
};
}
}

View File

@ -861,9 +861,10 @@ StreamTextureClient::IsAllocated() const
}
////////////////////////////////////////////////////////////////////////
// ShSurfTexClient
// SharedSurfaceTextureClient
ShSurfTexClient::ShSurfTexClient(TextureFlags aFlags, gl::SharedSurface* surf)
SharedSurfaceTextureClient::SharedSurfaceTextureClient(TextureFlags aFlags,
gl::SharedSurface* surf)
: TextureClient(aFlags)
, mIsLocked(false)
, mSurf(surf)
@ -872,15 +873,15 @@ ShSurfTexClient::ShSurfTexClient(TextureFlags aFlags, gl::SharedSurface* surf)
mSurf->Fence();
}
ShSurfTexClient::~ShSurfTexClient()
SharedSurfaceTextureClient::~SharedSurfaceTextureClient()
{
// the data is owned externally.
}
bool
ShSurfTexClient::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
SharedSurfaceTextureClient::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
{
aOutDescriptor = ShSurfDescriptor((uintptr_t)mSurf);
aOutDescriptor = SharedSurfaceDescriptor((uintptr_t)mSurf);
return true;
}

View File

@ -682,13 +682,13 @@ protected:
/**
* A TextureClient implementation to share SharedSurfaces.
*/
class ShSurfTexClient : public TextureClient
class SharedSurfaceTextureClient : public TextureClient
{
public:
explicit ShSurfTexClient(TextureFlags aFlags, gl::SharedSurface* surf);
SharedSurfaceTextureClient(TextureFlags aFlags, gl::SharedSurface* surf);
protected:
~ShSurfTexClient();
~SharedSurfaceTextureClient();
public:
// Boilerplate start

View File

@ -203,8 +203,8 @@ TextureHost::Create(const SurfaceDescriptor& aDesc,
case SurfaceDescriptor::TSurfaceStreamDescriptor:
return new StreamTextureHost(aFlags, aDesc.get_SurfaceStreamDescriptor());
case SurfaceDescriptor::TShSurfDescriptor:
return new ShSurfTexHost(aFlags, aDesc.get_ShSurfDescriptor());
case SurfaceDescriptor::TSharedSurfaceDescriptor:
return new SharedSurfaceTextureHost(aFlags, aDesc.get_SharedSurfaceDescriptor());
case SurfaceDescriptor::TSurfaceDescriptorMacIOSurface:
if (Compositor::GetBackend() == LayersBackend::LAYERS_OPENGL) {
@ -1089,9 +1089,10 @@ ShSurfToTexSource(gl::SharedSurface* abstractSurf, Compositor* compositor)
}
////////////////////////////////////////////////////////////////////////////////
// ShSurfTexHost
// SharedSurfaceTextureHost
ShSurfTexHost::ShSurfTexHost(TextureFlags aFlags, const ShSurfDescriptor& aDesc)
SharedSurfaceTextureHost::SharedSurfaceTextureHost(TextureFlags aFlags,
const SharedSurfaceDescriptor& aDesc)
: TextureHost(aFlags)
, mIsLocked(false)
, mSurf((gl::SharedSurface*)aDesc.surf())
@ -1101,21 +1102,21 @@ ShSurfTexHost::ShSurfTexHost(TextureFlags aFlags, const ShSurfDescriptor& aDesc)
}
gfx::SurfaceFormat
ShSurfTexHost::GetFormat() const
SharedSurfaceTextureHost::GetFormat() const
{
MOZ_ASSERT(mTexSource);
return mTexSource->GetFormat();
}
gfx::IntSize
ShSurfTexHost::GetSize() const
SharedSurfaceTextureHost::GetSize() const
{
MOZ_ASSERT(mTexSource);
return mTexSource->GetSize();
}
void
ShSurfTexHost::EnsureTexSource()
SharedSurfaceTextureHost::EnsureTexSource()
{
MOZ_ASSERT(mIsLocked);

View File

@ -50,7 +50,7 @@ class CompositableBackendSpecificData;
class CompositableParentManager;
class SurfaceDescriptor;
class SurfaceStreamDescriptor;
class ShSurfDescriptor;
class SharedSurfaceDescriptor;
class ISurfaceAllocator;
class TextureHostOGL;
class TextureSourceOGL;
@ -620,12 +620,12 @@ protected:
/**
* A TextureHost for SharedSurfaces
*/
class ShSurfTexHost : public TextureHost
class SharedSurfaceTextureHost : public TextureHost
{
public:
ShSurfTexHost(TextureFlags aFlags, const ShSurfDescriptor& aDesc);
SharedSurfaceTextureHost(TextureFlags aFlags, const ShSurfDescriptor& aDesc);
virtual ~ShSurfTexHost() {};
virtual ~SharedSurfaceTextureHost() {};
virtual void DeallocateDeviceData() MOZ_OVERRIDE {};
@ -667,7 +667,7 @@ public:
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
#ifdef MOZ_LAYERS_HAVE_LOG
virtual const char* Name() { return "ShSurfTexHost"; }
virtual const char* Name() { return "SharedSurfaceTextureHost"; }
#endif
protected:

View File

@ -118,10 +118,13 @@ CanvasLayerD3D10::UpdateSurface()
}
if (mGLContext) {
SharedSurface* surf = mGLContext->RequestFrame();
if (!surf) {
auto screen = mGLContext->Screen();
MOZ_ASSERT(screen);
SharedSurface* surf = screen->Front()->Surf();
if (!surf)
return;
}
surf->WaitSync();
switch (surf->mType) {
case SharedSurfaceType::EGLSurfaceANGLE: {

View File

@ -80,9 +80,13 @@ CanvasLayerD3D9::UpdateSurface()
RefPtr<SourceSurface> surface;
if (mGLContext) {
SharedSurface* surf = mGLContext->RequestFrame();
auto screen = mGLContext->Screen();
MOZ_ASSERT(screen);
SharedSurface* surf = screen->Front()->Surf();
if (!surf)
return;
return;
surf->WaitSync();
SharedSurface_Basic* shareSurf = SharedSurface_Basic::Cast(surf);
surface = shareSurf->GetData();

View File

@ -81,7 +81,7 @@ struct SurfaceStreamDescriptor {
bool yflip;
};
struct ShSurfDescriptor {
struct SharedSurfaceDescriptor {
uintptr_t surf;
};
@ -113,7 +113,7 @@ union SurfaceDescriptor {
SurfaceStreamDescriptor;
SurfaceDescriptorMacIOSurface;
NewSurfaceDescriptorGralloc;
ShSurfDescriptor;
SharedSurfaceDescriptor;
null_t;
};

View File

@ -17,6 +17,7 @@ EXPORTS += [
'client/ClientTiledPaintedLayer.h',
'composite/CompositableHost.h',
'composite/ImageHost.h',
'CompositorTypes.h',
'CopyableCanvasLayer.h',
'D3D9SurfaceImage.h',
'FrameMetrics.h',
@ -33,6 +34,7 @@ EXPORTS += [
'LayerScope.h',
'LayersLogging.h',
'LayerSorter.h',
'LayersTypes.h',
'LayerTreeInvalidation.h',
'opengl/Composer2D.h',
'opengl/OGLShaderProgram.h',
@ -98,7 +100,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
SOURCES += [
'd3d11/CompositorD3D11.cpp',
'd3d11/ReadbackManagerD3D11.cpp',
]
]
if CONFIG['MOZ_ENABLE_DIRECT2D1_1']:
DEFINES['USE_D2D1_1'] = True

View File

@ -12,6 +12,7 @@
#include "mozilla/layers/ISurfaceAllocator.h"
#include "mozilla/layers/ShadowLayerUtilsGralloc.h"
#include "gfx2DGlue.h"
#include "SharedSurfaceGralloc.h"
namespace mozilla {
namespace layers {
@ -112,7 +113,7 @@ GrallocTextureClientOGL::WaitForBufferOwnership()
#if ANDROID_VERSION == 17
fence->waitForever(1000, "GrallocTextureClientOGL::Lock");
// 1000 is what Android uses. It is warning timeout ms.
// This timeous is removed since ANDROID_VERSION 18.
// This timeous is removed since ANDROID_VERSION 18.
#else
fence->waitForever("GrallocTextureClientOGL::Lock");
#endif
@ -346,6 +347,29 @@ GrallocTextureClientOGL::GetBufferSize() const
return 0;
}
/*static*/ TemporaryRef<TextureClient>
GrallocTextureClientOGL::FromShSurf(gl::SharedSurface* abstractSurf,
TextureFlags flags)
{
auto surf = gl::SharedSurface_Gralloc::Cast(abstractSurf);
RefPtr<TextureClient> ret = surf->GetTextureClient();
TextureFlags mask = TextureFlags::NEEDS_Y_FLIP |
TextureFlags::RB_SWAPPED |
TextureFlags::NON_PREMULTIPLIED;
TextureFlags required = flags & mask;
TextureFlags present = ret->GetFlags() & mask;
if (present != required) {
printf_stderr("Present flags: 0x%x. Required: 0x%x.\n",
(uint32_t)present,
(uint32_t)required);
MOZ_CRASH("Flag requirement mismatch.");
}
return ret.forget();
}
} // namesapace layers
} // namesapace mozilla

View File

@ -118,6 +118,9 @@ public:
CreateSimilar(TextureFlags aFlags = TextureFlags::DEFAULT,
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const MOZ_OVERRIDE;
static TemporaryRef<TextureClient> FromShSurf(gl::SharedSurface* surf,
TextureFlags flags);
protected:
/**
* Unfortunately, until bug 879681 is fixed we need to use a GrallocBufferActor.