Backed out changeset c54004d2c229 (bug 1779355) for causing build bustage in gfx/gl/GLLibraryEGL.h

This commit is contained in:
Sandor Molnar 2022-08-10 02:28:59 +03:00
Родитель 2fd0743a13
Коммит f252a7427e
3 изменённых файлов: 1 добавлений и 47 удалений

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

@ -2098,7 +2098,7 @@ bool GLContext::IsOffscreenSizeAllowed(const IntSize& aSize) const {
}
bool GLContext::IsValidOwningThread() const {
if (!mOwningThreadId) return true; // Free for all!
if (!mOwningThreadId) return true;
return PlatformThread::CurrentId() == *mOwningThreadId;
}
@ -2433,9 +2433,6 @@ bool GLContext::MakeCurrent(bool aForce) const {
if (!IsValidOwningThread()) {
gfxCriticalError() << "MakeCurrent called on a thread other than the"
<< " creating thread!";
if (gfxEnv::MOZ_GL_RELEASE_ASSERT_CONTEXT_OWNERSHIP()) {
MOZ_CRASH("MOZ_GL_RELEASE_ASSERT_CONTEXT_OWNERSHIP");
}
}
if (!MakeCurrentImpl()) return false;

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

@ -9,10 +9,8 @@
# include "mozilla/X11Util.h"
#endif
#include "gfxEnv.h"
#include "GLTypes.h"
#include "mozilla/EnumTypeTraits.h"
#include "mozilla/gfx/Logging.h"
#include "mozilla/Maybe.h"
#include "mozilla/RefPtr.h"
#include "mozilla/StaticMutex.h"
@ -250,51 +248,12 @@ class GLLibraryEGL final {
private:
EGLBoolean fTerminate(EGLDisplay display) const { WRAP(fTerminate(display)); }
// -
mutable Mutex mMutex = Mutex{"GLLibraryEGL::mMutex"};
mutable std::unordered_map<EGLContext, PlatformThreadId>
mOwningThreadByContext;
EGLBoolean fMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read,
EGLContext ctx) const {
const bool CHECK_CONTEXT_OWNERSHIP = true;
if (CHECK_CONTEXT_OWNERSHIP) {
const auto lock = MutexAutoLock(mMutex);
const auto tid = PlatformThread::CurrentId();
const auto prevCtx = fGetCurrentContext();
if (prevCtx) {
mOwningThreadByContext[prevCtx] = 0;
}
if (ctx) {
auto& ctxOwnerThread = mOwningThreadByContext[ctx];
if (ctxOwnerThread && ctxOwnerThread != tid) {
gfxCriticalError()
<< "EGLContext#" << ctx << " is owned by/Current on"
<< " thread#" << ctxOwnerThread << " but MakeCurrent requested on"
<< " thread#" << tid << "!";
if (gfxEnv::MOZ_EGL_RELEASE_ASSERT_CONTEXT_OWNERSHIP()) {
MOZ_CRASH("MOZ_EGL_RELEASE_ASSERT_CONTEXT_OWNERSHIP");
}
return false;
}
ctxOwnerThread = tid;
}
}
WRAP(fMakeCurrent(dpy, draw, read, ctx));
}
// -
EGLBoolean fDestroyContext(EGLDisplay dpy, EGLContext ctx) const {
{
const auto lock = MutexAutoLock(mMutex);
mOwningThreadByContext.erase(ctx);
}
WRAP(fDestroyContext(dpy, ctx));
}

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

@ -104,8 +104,6 @@ class gfxEnv final {
DECL_GFX_ENV(MOZ_GL_DEBUG)
DECL_GFX_ENV(MOZ_GL_DEBUG_VERBOSE)
DECL_GFX_ENV(MOZ_GL_DEBUG_ABORT_ON_ERROR)
DECL_GFX_ENV(MOZ_GL_RELEASE_ASSERT_CONTEXT_OWNERSHIP)
DECL_GFX_ENV(MOZ_EGL_RELEASE_ASSERT_CONTEXT_OWNERSHIP)
// Count GL extensions
DECL_GFX_ENV(MOZ_GL_DUMP_EXTS)