Backed out changeset ff417c667b5b (bug 1779355) for causing build bustages on GLLibraryEGL.h CLOSED TREE

This commit is contained in:
Norisz Fay 2022-07-18 20:48:26 +03:00
Родитель a44ee2ceab
Коммит 12f6ce9a82
5 изменённых файлов: 2 добавлений и 52 удалений

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

@ -2098,7 +2098,6 @@ bool GLContext::IsOffscreenSizeAllowed(const IntSize& aSize) const {
}
bool GLContext::IsOwningThread() const {
if (!mOwningThreadId) return true; // Free for all!
return PlatformThread::CurrentId() == mOwningThreadId;
}
@ -2431,11 +2430,8 @@ bool GLContext::MakeCurrent(bool aForce) const {
}
}
if (!IsOwningThread()) {
gfxCriticalError() << "MakeCurrent called on a thread other than its"
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;

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

@ -3569,10 +3569,8 @@ class GLContext : public GenericAtomicRefCounted, public SupportsWeakPtr {
RefPtr<GLContext> mSharedContext;
// The thread id which this context was created.
public:
PlatformThreadId mOwningThreadId;
const PlatformThreadId mOwningThreadId;
protected:
GLContextSymbols mSymbols = {};
UniquePtr<GLBlitHelper> mBlitHelper;

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

@ -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)

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

@ -70,7 +70,6 @@ RefPtr<GLContext> ClaimSnapshotGLContext() {
LOGDMABUF(("GetAsSourceSurface: Failed to create snapshot GLContext."));
return nullptr;
}
sSnapshotContext->mOwningThreadId = 0; // No singular owner.
}
if (!sSnapshotContext->MakeCurrent()) {
LOGDMABUF(("GetAsSourceSurface: Failed to make GLContext current."));