mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Backed out changeset 097dc302f5a0 (bug 1279657)
This commit is contained in:
parent
dd6f87a7f3
commit
c0c2282bfb
@ -587,7 +587,7 @@ CreateGLWithEGL(const gl::SurfaceCaps& caps, gl::CreateContextFlags flags,
|
|||||||
{
|
{
|
||||||
const gfx::IntSize dummySize(16, 16);
|
const gfx::IntSize dummySize(16, 16);
|
||||||
RefPtr<GLContext> gl = gl::GLContextProviderEGL::CreateOffscreen(dummySize, caps,
|
RefPtr<GLContext> gl = gl::GLContextProviderEGL::CreateOffscreen(dummySize, caps,
|
||||||
flags, out_failureId);
|
flags, *out_failureId);
|
||||||
if (gl && gl->IsANGLE()) {
|
if (gl && gl->IsANGLE()) {
|
||||||
gl = nullptr;
|
gl = nullptr;
|
||||||
}
|
}
|
||||||
@ -613,7 +613,7 @@ CreateGLWithANGLE(const gl::SurfaceCaps& caps, gl::CreateContextFlags flags,
|
|||||||
{
|
{
|
||||||
const gfx::IntSize dummySize(16, 16);
|
const gfx::IntSize dummySize(16, 16);
|
||||||
RefPtr<GLContext> gl = gl::GLContextProviderEGL::CreateOffscreen(dummySize, caps,
|
RefPtr<GLContext> gl = gl::GLContextProviderEGL::CreateOffscreen(dummySize, caps,
|
||||||
flags, out_failureId);
|
flags, *out_failureId);
|
||||||
if (gl && !gl->IsANGLE()) {
|
if (gl && !gl->IsANGLE()) {
|
||||||
gl = nullptr;
|
gl = nullptr;
|
||||||
}
|
}
|
||||||
@ -652,7 +652,7 @@ CreateGLWithDefault(const gl::SurfaceCaps& caps, gl::CreateContextFlags flags,
|
|||||||
|
|
||||||
const gfx::IntSize dummySize(16, 16);
|
const gfx::IntSize dummySize(16, 16);
|
||||||
RefPtr<GLContext> gl = gl::GLContextProvider::CreateOffscreen(dummySize, caps,
|
RefPtr<GLContext> gl = gl::GLContextProvider::CreateOffscreen(dummySize, caps,
|
||||||
flags, out_failureId);
|
flags, *out_failureId);
|
||||||
|
|
||||||
if (gl && gl->IsANGLE()) {
|
if (gl && gl->IsANGLE()) {
|
||||||
gl = nullptr;
|
gl = nullptr;
|
||||||
|
@ -24,7 +24,7 @@ class GLContextEGL : public GLContext
|
|||||||
bool isOffscreen,
|
bool isOffscreen,
|
||||||
EGLConfig config,
|
EGLConfig config,
|
||||||
EGLSurface surface,
|
EGLSurface surface,
|
||||||
nsACString* const out_failureId);
|
nsACString& aFailureId);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextEGL, override)
|
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextEGL, override)
|
||||||
@ -108,7 +108,7 @@ public:
|
|||||||
CreateEGLPBufferOffscreenContext(CreateContextFlags flags,
|
CreateEGLPBufferOffscreenContext(CreateContextFlags flags,
|
||||||
const gfx::IntSize& size,
|
const gfx::IntSize& size,
|
||||||
const SurfaceCaps& minCaps,
|
const SurfaceCaps& minCaps,
|
||||||
nsACString* const out_FailureId);
|
nsACString& aFailureId);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class GLContextProviderEGL;
|
friend class GLContextProviderEGL;
|
||||||
|
@ -321,18 +321,17 @@ CreateOffscreenFBOContext(CreateContextFlags flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<GLContext>
|
already_AddRefed<GLContext>
|
||||||
GLContextProviderCGL::CreateHeadless(CreateContextFlags flags,
|
GLContextProviderCGL::CreateHeadless(CreateContextFlags flags, nsACString& aFailureId)
|
||||||
nsACString* const out_failureId)
|
|
||||||
{
|
{
|
||||||
RefPtr<GLContextCGL> gl;
|
RefPtr<GLContextCGL> gl;
|
||||||
gl = CreateOffscreenFBOContext(flags);
|
gl = CreateOffscreenFBOContext(flags);
|
||||||
if (!gl) {
|
if (!gl) {
|
||||||
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_CGL_FBO");
|
aFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_CGL_FBO");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gl->Init()) {
|
if (!gl->Init()) {
|
||||||
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_CGL_INIT");
|
aFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_CGL_INIT");
|
||||||
NS_WARNING("Failed during Init.");
|
NS_WARNING("Failed during Init.");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -344,15 +343,15 @@ already_AddRefed<GLContext>
|
|||||||
GLContextProviderCGL::CreateOffscreen(const IntSize& size,
|
GLContextProviderCGL::CreateOffscreen(const IntSize& size,
|
||||||
const SurfaceCaps& minCaps,
|
const SurfaceCaps& minCaps,
|
||||||
CreateContextFlags flags,
|
CreateContextFlags flags,
|
||||||
nsACString* const out_failureId)
|
nsACString& aFailureId)
|
||||||
{
|
{
|
||||||
RefPtr<GLContext> gl = CreateHeadless(flags, out_failureId);
|
RefPtr<GLContext> gl = CreateHeadless(flags, aFailureId);
|
||||||
if (!gl) {
|
if (!gl) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gl->InitOffscreen(size, minCaps)) {
|
if (!gl->InitOffscreen(size, minCaps)) {
|
||||||
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_CGL_INIT");
|
aFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_CGL_INIT");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,7 +460,7 @@ GLContextEGL::HoldSurface(gfxASurface* aSurf) {
|
|||||||
GLContextEGL::CreateSurfaceForWindow(nsIWidget* aWidget)
|
GLContextEGL::CreateSurfaceForWindow(nsIWidget* aWidget)
|
||||||
{
|
{
|
||||||
nsCString discardFailureId;
|
nsCString discardFailureId;
|
||||||
if (!sEGLLibrary.EnsureInitialized(false, &discardFailureId)) {
|
if (!sEGLLibrary.EnsureInitialized(false, discardFailureId)) {
|
||||||
MOZ_CRASH("GFX: Failed to load EGL library!\n");
|
MOZ_CRASH("GFX: Failed to load EGL library!\n");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -494,10 +494,10 @@ GLContextEGL::CreateGLContext(CreateContextFlags flags,
|
|||||||
bool isOffscreen,
|
bool isOffscreen,
|
||||||
EGLConfig config,
|
EGLConfig config,
|
||||||
EGLSurface surface,
|
EGLSurface surface,
|
||||||
nsACString* const out_failureId)
|
nsACString& aFailureId)
|
||||||
{
|
{
|
||||||
if (sEGLLibrary.fBindAPI(LOCAL_EGL_OPENGL_ES_API) == LOCAL_EGL_FALSE) {
|
if (sEGLLibrary.fBindAPI(LOCAL_EGL_OPENGL_ES_API) == LOCAL_EGL_FALSE) {
|
||||||
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_ES");
|
aFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_ES");
|
||||||
NS_WARNING("Failed to bind API to GLES!");
|
NS_WARNING("Failed to bind API to GLES!");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -534,7 +534,7 @@ GLContextEGL::CreateGLContext(CreateContextFlags flags,
|
|||||||
contextAttribs.Elements());
|
contextAttribs.Elements());
|
||||||
}
|
}
|
||||||
if (!context) {
|
if (!context) {
|
||||||
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_CREATE");
|
aFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_CREATE");
|
||||||
NS_WARNING("Failed to create EGLContext!");
|
NS_WARNING("Failed to create EGLContext!");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -547,7 +547,7 @@ GLContextEGL::CreateGLContext(CreateContextFlags flags,
|
|||||||
context);
|
context);
|
||||||
|
|
||||||
if (!glContext->Init()) {
|
if (!glContext->Init()) {
|
||||||
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_INIT");
|
aFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_INIT");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -749,7 +749,7 @@ already_AddRefed<GLContext>
|
|||||||
GLContextProviderEGL::CreateWrappingExisting(void* aContext, void* aSurface)
|
GLContextProviderEGL::CreateWrappingExisting(void* aContext, void* aSurface)
|
||||||
{
|
{
|
||||||
nsCString discardFailureId;
|
nsCString discardFailureId;
|
||||||
if (!sEGLLibrary.EnsureInitialized(false, &discardFailureId)) {
|
if (!sEGLLibrary.EnsureInitialized(false, discardFailureId)) {
|
||||||
MOZ_CRASH("GFX: Failed to load EGL library 2!\n");
|
MOZ_CRASH("GFX: Failed to load EGL library 2!\n");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -775,7 +775,7 @@ already_AddRefed<GLContext>
|
|||||||
GLContextProviderEGL::CreateForWindow(nsIWidget* aWidget, bool aForceAccelerated)
|
GLContextProviderEGL::CreateForWindow(nsIWidget* aWidget, bool aForceAccelerated)
|
||||||
{
|
{
|
||||||
nsCString discardFailureId;
|
nsCString discardFailureId;
|
||||||
if (!sEGLLibrary.EnsureInitialized(false, &discardFailureId)) {
|
if (!sEGLLibrary.EnsureInitialized(false, discardFailureId)) {
|
||||||
MOZ_CRASH("GFX: Failed to load EGL library 3!\n");
|
MOZ_CRASH("GFX: Failed to load EGL library 3!\n");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -798,7 +798,7 @@ GLContextProviderEGL::CreateForWindow(nsIWidget* aWidget, bool aForceAccelerated
|
|||||||
RefPtr<GLContextEGL> glContext =
|
RefPtr<GLContextEGL> glContext =
|
||||||
GLContextEGL::CreateGLContext(CreateContextFlags::NONE, caps,
|
GLContextEGL::CreateGLContext(CreateContextFlags::NONE, caps,
|
||||||
nullptr, false,
|
nullptr, false,
|
||||||
config, surface, &discardFailureId);
|
config, surface, discardFailureId);
|
||||||
|
|
||||||
if (!glContext) {
|
if (!glContext) {
|
||||||
MOZ_CRASH("GFX: Failed to create EGLContext!\n");
|
MOZ_CRASH("GFX: Failed to create EGLContext!\n");
|
||||||
@ -841,7 +841,7 @@ void
|
|||||||
GLContextProviderEGL::DestroyEGLSurface(EGLSurface surface)
|
GLContextProviderEGL::DestroyEGLSurface(EGLSurface surface)
|
||||||
{
|
{
|
||||||
nsCString discardFailureId;
|
nsCString discardFailureId;
|
||||||
if (!sEGLLibrary.EnsureInitialized(false, &discardFailureId)) {
|
if (!sEGLLibrary.EnsureInitialized(false, discardFailureId)) {
|
||||||
MOZ_CRASH("GFX: Failed to load EGL library 5!\n");
|
MOZ_CRASH("GFX: Failed to load EGL library 5!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -953,17 +953,17 @@ ChooseConfig(GLLibraryEGL* egl, CreateContextFlags flags, const SurfaceCaps& min
|
|||||||
GLContextEGL::CreateEGLPBufferOffscreenContext(CreateContextFlags flags,
|
GLContextEGL::CreateEGLPBufferOffscreenContext(CreateContextFlags flags,
|
||||||
const mozilla::gfx::IntSize& size,
|
const mozilla::gfx::IntSize& size,
|
||||||
const SurfaceCaps& minCaps,
|
const SurfaceCaps& minCaps,
|
||||||
nsACString* const out_failureId)
|
nsACString& aFailureId)
|
||||||
{
|
{
|
||||||
bool forceEnableHardware = bool(flags & CreateContextFlags::FORCE_ENABLE_HARDWARE);
|
bool forceEnableHardware = bool(flags & CreateContextFlags::FORCE_ENABLE_HARDWARE);
|
||||||
if (!sEGLLibrary.EnsureInitialized(forceEnableHardware, out_failureId)) {
|
if (!sEGLLibrary.EnsureInitialized(forceEnableHardware, aFailureId)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SurfaceCaps configCaps;
|
SurfaceCaps configCaps;
|
||||||
EGLConfig config = ChooseConfig(&sEGLLibrary, flags, minCaps, &configCaps);
|
EGLConfig config = ChooseConfig(&sEGLLibrary, flags, minCaps, &configCaps);
|
||||||
if (config == EGL_NO_CONFIG) {
|
if (config == EGL_NO_CONFIG) {
|
||||||
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_NO_CONFIG");
|
aFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_NO_CONFIG");
|
||||||
NS_WARNING("Failed to find a compatible config.");
|
NS_WARNING("Failed to find a compatible config.");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -977,13 +977,13 @@ GLContextEGL::CreateEGLPBufferOffscreenContext(CreateContextFlags flags,
|
|||||||
LOCAL_EGL_NONE,
|
LOCAL_EGL_NONE,
|
||||||
pbSize);
|
pbSize);
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_POT");
|
aFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_POT");
|
||||||
NS_WARNING("Failed to create PBuffer for context!");
|
NS_WARNING("Failed to create PBuffer for context!");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<GLContextEGL> gl = GLContextEGL::CreateGLContext(flags, configCaps, nullptr, true,
|
RefPtr<GLContextEGL> gl = GLContextEGL::CreateGLContext(flags, configCaps, nullptr, true,
|
||||||
config, surface, out_failureId);
|
config, surface, aFailureId);
|
||||||
if (!gl) {
|
if (!gl) {
|
||||||
NS_WARNING("Failed to create GLContext from PBuffer");
|
NS_WARNING("Failed to create GLContext from PBuffer");
|
||||||
sEGLLibrary.fDestroySurface(sEGLLibrary.Display(), surface);
|
sEGLLibrary.fDestroySurface(sEGLLibrary.Display(), surface);
|
||||||
@ -994,13 +994,12 @@ GLContextEGL::CreateEGLPBufferOffscreenContext(CreateContextFlags flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*static*/ already_AddRefed<GLContext>
|
/*static*/ already_AddRefed<GLContext>
|
||||||
GLContextProviderEGL::CreateHeadless(CreateContextFlags flags,
|
GLContextProviderEGL::CreateHeadless(CreateContextFlags flags, nsACString& aFailureId)
|
||||||
nsACString* const out_failureId)
|
|
||||||
{
|
{
|
||||||
mozilla::gfx::IntSize dummySize = mozilla::gfx::IntSize(16, 16);
|
mozilla::gfx::IntSize dummySize = mozilla::gfx::IntSize(16, 16);
|
||||||
SurfaceCaps dummyCaps = SurfaceCaps::Any();
|
SurfaceCaps dummyCaps = SurfaceCaps::Any();
|
||||||
return GLContextEGL::CreateEGLPBufferOffscreenContext(flags, dummySize, dummyCaps,
|
return GLContextEGL::CreateEGLPBufferOffscreenContext(flags, dummySize, dummyCaps,
|
||||||
out_failureId);
|
aFailureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under EGL, on Android, pbuffers are supported fine, though
|
// Under EGL, on Android, pbuffers are supported fine, though
|
||||||
@ -1009,11 +1008,11 @@ GLContextProviderEGL::CreateHeadless(CreateContextFlags flags,
|
|||||||
GLContextProviderEGL::CreateOffscreen(const mozilla::gfx::IntSize& size,
|
GLContextProviderEGL::CreateOffscreen(const mozilla::gfx::IntSize& size,
|
||||||
const SurfaceCaps& minCaps,
|
const SurfaceCaps& minCaps,
|
||||||
CreateContextFlags flags,
|
CreateContextFlags flags,
|
||||||
nsACString* const out_failureId)
|
nsACString& aFailureId)
|
||||||
{
|
{
|
||||||
bool forceEnableHardware = bool(flags & CreateContextFlags::FORCE_ENABLE_HARDWARE);
|
bool forceEnableHardware = bool(flags & CreateContextFlags::FORCE_ENABLE_HARDWARE);
|
||||||
if (!sEGLLibrary.EnsureInitialized(forceEnableHardware, out_failureId)) { // Needed for IsANGLE().
|
if (!sEGLLibrary.EnsureInitialized(forceEnableHardware, aFailureId)) { // Needed for IsANGLE().
|
||||||
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_LIB_INIT");
|
aFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_LIB_INIT");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1027,7 +1026,7 @@ GLContextProviderEGL::CreateOffscreen(const mozilla::gfx::IntSize& size,
|
|||||||
SurfaceCaps minOffscreenCaps = minCaps;
|
SurfaceCaps minOffscreenCaps = minCaps;
|
||||||
|
|
||||||
if (canOffscreenUseHeadless) {
|
if (canOffscreenUseHeadless) {
|
||||||
gl = CreateHeadless(flags, out_failureId);
|
gl = CreateHeadless(flags, aFailureId);
|
||||||
if (!gl) {
|
if (!gl) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -1040,7 +1039,7 @@ GLContextProviderEGL::CreateOffscreen(const mozilla::gfx::IntSize& size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gl = GLContextEGL::CreateEGLPBufferOffscreenContext(flags, size, minBackbufferCaps,
|
gl = GLContextEGL::CreateEGLPBufferOffscreenContext(flags, size, minBackbufferCaps,
|
||||||
out_failureId);
|
aFailureId);
|
||||||
if (!gl) {
|
if (!gl) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -1058,7 +1057,7 @@ GLContextProviderEGL::CreateOffscreen(const mozilla::gfx::IntSize& size,
|
|||||||
|
|
||||||
// Init the offscreen with the updated offscreen caps.
|
// Init the offscreen with the updated offscreen caps.
|
||||||
if (!gl->InitOffscreen(size, minOffscreenCaps)) {
|
if (!gl->InitOffscreen(size, minOffscreenCaps)) {
|
||||||
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_OFFSCREEN");
|
aFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_OFFSCREEN");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1264,8 +1264,7 @@ GLContextGLX::FindFBConfigForWindow(Display* display, int screen, Window window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static already_AddRefed<GLContextGLX>
|
static already_AddRefed<GLContextGLX>
|
||||||
CreateOffscreenPixmapContext(const IntSize& size, const SurfaceCaps& minCaps,
|
CreateOffscreenPixmapContext(const IntSize& size, const SurfaceCaps& minCaps, nsACString& aFailureId,
|
||||||
nsACString* const out_failureId,
|
|
||||||
ContextProfile profile = ContextProfile::OpenGLCompatibility)
|
ContextProfile profile = ContextProfile::OpenGLCompatibility)
|
||||||
{
|
{
|
||||||
GLXLibrary* glx = &sGLXLibrary;
|
GLXLibrary* glx = &sGLXLibrary;
|
||||||
@ -1328,18 +1327,18 @@ DONE_CREATING_PIXMAP:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*static*/ already_AddRefed<GLContext>
|
/*static*/ already_AddRefed<GLContext>
|
||||||
GLContextProviderGLX::CreateHeadless(CreateContextFlags, nsACString* const out_failureId)
|
GLContextProviderGLX::CreateHeadless(CreateContextFlags, nsACString& aFailureId)
|
||||||
{
|
{
|
||||||
IntSize dummySize = IntSize(16, 16);
|
IntSize dummySize = IntSize(16, 16);
|
||||||
SurfaceCaps dummyCaps = SurfaceCaps::Any();
|
SurfaceCaps dummyCaps = SurfaceCaps::Any();
|
||||||
return CreateOffscreenPixmapContext(dummySize, dummyCaps, out_failureId);
|
return CreateOffscreenPixmapContext(dummySize, dummyCaps, aFailureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static*/ already_AddRefed<GLContext>
|
/*static*/ already_AddRefed<GLContext>
|
||||||
GLContextProviderGLX::CreateOffscreen(const IntSize& size,
|
GLContextProviderGLX::CreateOffscreen(const IntSize& size,
|
||||||
const SurfaceCaps& minCaps,
|
const SurfaceCaps& minCaps,
|
||||||
CreateContextFlags flags,
|
CreateContextFlags flags,
|
||||||
nsACString* const out_failureId)
|
nsACString& aFailureId)
|
||||||
{
|
{
|
||||||
SurfaceCaps minBackbufferCaps = minCaps;
|
SurfaceCaps minBackbufferCaps = minCaps;
|
||||||
if (minCaps.antialias) {
|
if (minCaps.antialias) {
|
||||||
@ -1354,12 +1353,12 @@ GLContextProviderGLX::CreateOffscreen(const IntSize& size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<GLContext> gl;
|
RefPtr<GLContext> gl;
|
||||||
gl = CreateOffscreenPixmapContext(size, minBackbufferCaps, out_failureId, profile);
|
gl = CreateOffscreenPixmapContext(size, minBackbufferCaps, aFailureId, profile);
|
||||||
if (!gl)
|
if (!gl)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (!gl->InitOffscreen(size, minCaps)) {
|
if (!gl->InitOffscreen(size, minCaps)) {
|
||||||
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_GLX_INIT");
|
aFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_GLX_INIT");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,11 +68,11 @@ public:
|
|||||||
CreateOffscreen(const mozilla::gfx::IntSize& size,
|
CreateOffscreen(const mozilla::gfx::IntSize& size,
|
||||||
const SurfaceCaps& minCaps,
|
const SurfaceCaps& minCaps,
|
||||||
CreateContextFlags flags,
|
CreateContextFlags flags,
|
||||||
nsACString* const out_failureId);
|
nsACString& failureId);
|
||||||
|
|
||||||
// Just create a context. We'll add offscreen stuff ourselves.
|
// Just create a context. We'll add offscreen stuff ourselves.
|
||||||
static already_AddRefed<GLContext>
|
static already_AddRefed<GLContext>
|
||||||
CreateHeadless(CreateContextFlags flags, nsACString* const out_failureId);
|
CreateHeadless(CreateContextFlags flags, nsACString& aFailureId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create wrapping Gecko GLContext for external gl context.
|
* Create wrapping Gecko GLContext for external gl context.
|
||||||
|
@ -24,9 +24,9 @@ already_AddRefed<GLContext>
|
|||||||
GLContextProviderNull::CreateOffscreen(const gfx::IntSize&,
|
GLContextProviderNull::CreateOffscreen(const gfx::IntSize&,
|
||||||
const SurfaceCaps&,
|
const SurfaceCaps&,
|
||||||
CreateContextFlags,
|
CreateContextFlags,
|
||||||
nsACString* const out_failureId)
|
nsACString& aFailureId)
|
||||||
{
|
{
|
||||||
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_NULL");
|
aFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_NULL");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,7 +641,7 @@ CreateWindowOffscreenContext()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*static*/ already_AddRefed<GLContext>
|
/*static*/ already_AddRefed<GLContext>
|
||||||
GLContextProviderWGL::CreateHeadless(CreateContextFlags, nsACString* const out_failureId)
|
GLContextProviderWGL::CreateHeadless(CreateContextFlags, nsACString& aFailureId)
|
||||||
{
|
{
|
||||||
if (!sWGLLib.EnsureInitialized()) {
|
if (!sWGLLib.EnsureInitialized()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -677,14 +677,14 @@ GLContextProviderWGL::CreateHeadless(CreateContextFlags, nsACString* const out_f
|
|||||||
GLContextProviderWGL::CreateOffscreen(const IntSize& size,
|
GLContextProviderWGL::CreateOffscreen(const IntSize& size,
|
||||||
const SurfaceCaps& minCaps,
|
const SurfaceCaps& minCaps,
|
||||||
CreateContextFlags flags,
|
CreateContextFlags flags,
|
||||||
nsACString* const out_failureId)
|
nsACString& aFailureId)
|
||||||
{
|
{
|
||||||
RefPtr<GLContext> gl = CreateHeadless(flags, out_failureId);
|
RefPtr<GLContext> gl = CreateHeadless(flags, aFailureId);
|
||||||
if (!gl)
|
if (!gl)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (!gl->InitOffscreen(size, minCaps)) {
|
if (!gl->InitOffscreen(size, minCaps)) {
|
||||||
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_WGL_INIT");
|
aFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_WGL_INIT");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -702,8 +702,7 @@ GLContextProviderWGL::GetGlobalContext()
|
|||||||
|
|
||||||
MOZ_RELEASE_ASSERT(!gGlobalContext, "GFX: Global GL context already initialized.");
|
MOZ_RELEASE_ASSERT(!gGlobalContext, "GFX: Global GL context already initialized.");
|
||||||
nsCString discardFailureId;
|
nsCString discardFailureId;
|
||||||
RefPtr<GLContext> temp = CreateHeadless(CreateContextFlags::NONE,
|
RefPtr<GLContext> temp = CreateHeadless(CreateContextFlags::NONE, discardFailureId);
|
||||||
&discardFailureId);
|
|
||||||
gGlobalContext = temp;
|
gGlobalContext = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,8 +142,7 @@ GetAndInitWARPDisplay(GLLibraryEGL& egl, void* displayType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
IsAccelAngleSupported(const nsCOMPtr<nsIGfxInfo>& gfxInfo,
|
IsAccelAngleSupported(const nsCOMPtr<nsIGfxInfo>& gfxInfo, nsACString& aFailureId)
|
||||||
nsACString* const out_failureId)
|
|
||||||
{
|
{
|
||||||
int32_t angleSupport;
|
int32_t angleSupport;
|
||||||
nsCString failureId;
|
nsCString failureId;
|
||||||
@ -154,7 +153,7 @@ IsAccelAngleSupported(const nsCOMPtr<nsIGfxInfo>& gfxInfo,
|
|||||||
Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_ACCL_FAILURE_ID,
|
Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_ACCL_FAILURE_ID,
|
||||||
failureId);
|
failureId);
|
||||||
if (failureId.IsEmpty()) {
|
if (failureId.IsEmpty()) {
|
||||||
*out_failureId = failureId;
|
aFailureId = failureId;
|
||||||
}
|
}
|
||||||
return (angleSupport == nsIGfxInfo::FEATURE_STATUS_OK);
|
return (angleSupport == nsIGfxInfo::FEATURE_STATUS_OK);
|
||||||
}
|
}
|
||||||
@ -207,7 +206,7 @@ GLLibraryEGL::ReadbackEGLImage(EGLImage image, gfx::DataSourceSurface* out_surfa
|
|||||||
if (!mReadbackGL) {
|
if (!mReadbackGL) {
|
||||||
nsCString discardFailureId;
|
nsCString discardFailureId;
|
||||||
mReadbackGL = gl::GLContextProvider::CreateHeadless(gl::CreateContextFlags::NONE,
|
mReadbackGL = gl::GLContextProvider::CreateHeadless(gl::CreateContextFlags::NONE,
|
||||||
&discardFailureId);
|
discardFailureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScopedTexture destTex(mReadbackGL);
|
ScopedTexture destTex(mReadbackGL);
|
||||||
@ -229,7 +228,7 @@ GLLibraryEGL::ReadbackEGLImage(EGLImage image, gfx::DataSourceSurface* out_surfa
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString* const out_failureId)
|
GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString& aFailureId)
|
||||||
{
|
{
|
||||||
if (mInitialized) {
|
if (mInitialized) {
|
||||||
return true;
|
return true;
|
||||||
@ -395,7 +394,7 @@ GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString* const out_failureId
|
|||||||
EGLDisplay chosenDisplay = nullptr;
|
EGLDisplay chosenDisplay = nullptr;
|
||||||
|
|
||||||
if (IsExtensionSupported(ANGLE_platform_angle_d3d)) {
|
if (IsExtensionSupported(ANGLE_platform_angle_d3d)) {
|
||||||
bool accelAngleSupport = IsAccelAngleSupported(gfxInfo, out_failureId);
|
bool accelAngleSupport = IsAccelAngleSupported(gfxInfo, aFailureId);
|
||||||
|
|
||||||
bool shouldTryAccel = forceAccel || accelAngleSupport;
|
bool shouldTryAccel = forceAccel || accelAngleSupport;
|
||||||
bool shouldTryWARP = !shouldTryAccel;
|
bool shouldTryWARP = !shouldTryAccel;
|
||||||
@ -416,8 +415,8 @@ GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString* const out_failureId
|
|||||||
// If falling back to WARP did not work and we don't want to try
|
// If falling back to WARP did not work and we don't want to try
|
||||||
// using HW accelerated ANGLE, then fail.
|
// using HW accelerated ANGLE, then fail.
|
||||||
if (!shouldTryAccel) {
|
if (!shouldTryAccel) {
|
||||||
if (out_failureId->IsEmpty()) {
|
if (aFailureId.IsEmpty()) {
|
||||||
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_WARP_FALLBACK");
|
aFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_WARP_FALLBACK");
|
||||||
}
|
}
|
||||||
NS_ERROR("Fallback WARP ANGLE context failed to initialize.");
|
NS_ERROR("Fallback WARP ANGLE context failed to initialize.");
|
||||||
return false;
|
return false;
|
||||||
@ -431,8 +430,8 @@ GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString* const out_failureId
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!chosenDisplay) {
|
if (!chosenDisplay) {
|
||||||
if (out_failureId->IsEmpty()) {
|
if (aFailureId.IsEmpty()) {
|
||||||
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_NO_DISPLAY");
|
aFailureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_NO_DISPLAY");
|
||||||
}
|
}
|
||||||
NS_WARNING("Failed to initialize a display.");
|
NS_WARNING("Failed to initialize a display.");
|
||||||
return false;
|
return false;
|
||||||
|
@ -535,7 +535,7 @@ public:
|
|||||||
|
|
||||||
bool ReadbackEGLImage(EGLImage image, gfx::DataSourceSurface* out_surface);
|
bool ReadbackEGLImage(EGLImage image, gfx::DataSourceSurface* out_surface);
|
||||||
|
|
||||||
bool EnsureInitialized(bool forceAccel, nsACString* const out_failureId);
|
bool EnsureInitialized(bool forceAccel, nsACString& aFailureId);
|
||||||
|
|
||||||
void DumpEGLConfig(EGLConfig cfg);
|
void DumpEGLConfig(EGLConfig cfg);
|
||||||
void DumpEGLConfigs();
|
void DumpEGLConfigs();
|
||||||
|
@ -53,7 +53,7 @@ GLImage::GetAsSourceSurface()
|
|||||||
if (!sSnapshotContext) {
|
if (!sSnapshotContext) {
|
||||||
nsCString discardFailureId;
|
nsCString discardFailureId;
|
||||||
sSnapshotContext = GLContextProvider::CreateHeadless(CreateContextFlags::NONE,
|
sSnapshotContext = GLContextProvider::CreateHeadless(CreateContextFlags::NONE,
|
||||||
&discardFailureId);
|
discardFailureId);
|
||||||
if (!sSnapshotContext) {
|
if (!sSnapshotContext) {
|
||||||
NS_WARNING("Failed to create snapshot GLContext");
|
NS_WARNING("Failed to create snapshot GLContext");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -134,7 +134,7 @@ CompositorOGL::CreateContext()
|
|||||||
nsCString discardFailureId;
|
nsCString discardFailureId;
|
||||||
context = GLContextProvider::CreateOffscreen(mSurfaceSize,
|
context = GLContextProvider::CreateOffscreen(mSurfaceSize,
|
||||||
caps, CreateContextFlags::REQUIRE_COMPAT_PROFILE,
|
caps, CreateContextFlags::REQUIRE_COMPAT_PROFILE,
|
||||||
&discardFailureId);
|
discardFailureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!context) {
|
if (!context) {
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
RefPtr<GLContext> context = GLContextProvider::CreateOffscreen(
|
RefPtr<GLContext> context = GLContextProvider::CreateOffscreen(
|
||||||
IntSize(gCompWidth, gCompHeight), caps,
|
IntSize(gCompWidth, gCompHeight), caps,
|
||||||
CreateContextFlags::REQUIRE_COMPAT_PROFILE,
|
CreateContextFlags::REQUIRE_COMPAT_PROFILE,
|
||||||
&discardFailureId);
|
discardFailureId);
|
||||||
return context.forget().take();
|
return context.forget().take();
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -1326,7 +1326,7 @@ gfxPlatform::GetSkiaGLGlue()
|
|||||||
nsCString discardFailureId;
|
nsCString discardFailureId;
|
||||||
glContext = GLContextProvider::CreateHeadless(CreateContextFlags::REQUIRE_COMPAT_PROFILE |
|
glContext = GLContextProvider::CreateHeadless(CreateContextFlags::REQUIRE_COMPAT_PROFILE |
|
||||||
CreateContextFlags::ALLOW_OFFLINE_RENDERER,
|
CreateContextFlags::ALLOW_OFFLINE_RENDERER,
|
||||||
&discardFailureId);
|
discardFailureId);
|
||||||
if (!glContext) {
|
if (!glContext) {
|
||||||
printf_stderr("Failed to create GLContext for SkiaGL!\n");
|
printf_stderr("Failed to create GLContext for SkiaGL!\n");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user