Bug 1245747 - Terminate the EGL display on context loss - r=jgilbert

This commit is contained in:
Edwin Flores 2016-07-26 13:31:22 +01:00
Родитель 5bc0a6e499
Коммит 6de3bae6e3
3 изменённых файлов: 20 добавлений и 0 удалений

Просмотреть файл

@ -341,6 +341,9 @@ bool
GLContextEGL::MakeCurrentImpl(bool aForce) {
bool succeeded = true;
if (IsContextLost())
return false;
// Assume that EGL has the same problem as WGL does,
// where MakeCurrent with an already-current context is
// still expensive.
@ -368,6 +371,7 @@ GLContextEGL::MakeCurrentImpl(bool aForce) {
if (!succeeded) {
int eglError = sEGLLibrary.fGetError();
if (eglError == LOCAL_EGL_CONTEXT_LOST) {
sEGLLibrary.SetDeviceLost();
mContextLost = true;
NS_WARNING("EGL context has been lost.");
} else {
@ -381,6 +385,11 @@ GLContextEGL::MakeCurrentImpl(bool aForce) {
}
} else {
MOZ_ASSERT(sEGLLibrary.CachedCurrentContextMatches());
if (sEGLLibrary.HasRobustness() && fGetGraphicsResetStatus() != NO_ERROR) {
sEGLLibrary.SetDeviceLost();
mContextLost = true;
}
}
return succeeded;
@ -510,6 +519,8 @@ GLContextEGL::CreateGLContext(CreateContextFlags flags,
if (sEGLLibrary.HasRobustness()) {
// contextAttribs.AppendElement(LOCAL_EGL_CONTEXT_ROBUST_ACCESS_EXT);
// contextAttribs.AppendElement(LOCAL_EGL_TRUE);
contextAttribs.AppendElement(LOCAL_EGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_EXT);
contextAttribs.AppendElement(LOCAL_EGL_LOSE_CONTEXT_ON_RESET_EXT);
}
for (size_t i = 0; i < MOZ_ARRAY_LENGTH(gTerminationAttribs); i++) {

Просмотреть файл

@ -289,6 +289,14 @@ GLLibraryEGL::ReadbackEGLImage(EGLImage image, gfx::DataSourceSurface* out_surfa
return true;
}
void
GLLibraryEGL::SetDeviceLost()
{
fTerminate(mEGLDisplay);
mEGLDisplay = nullptr;
mInitialized = false;
}
bool
GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString* const out_failureId)
{

Просмотреть файл

@ -557,6 +557,7 @@ public:
bool ReadbackEGLImage(EGLImage image, gfx::DataSourceSurface* out_surface);
void SetDeviceLost();
bool EnsureInitialized(bool forceAccel, nsACString* const out_failureId);
void DumpEGLConfig(EGLConfig cfg);