Bug 1296911 - Use a separate X display on the GLX VSync thread. r=lsalzman

This reverts commit cce8e136869d313e999fdd0b98c88dfa3603c3de.

--HG--
extra : rebase_source : 4ef007395dc7eeae2287ef6ab119cadc3e896f20
This commit is contained in:
Andrew Comminos 2016-08-22 14:44:54 -04:00
Родитель 0eb9b8b128
Коммит 68b11e8613
1 изменённых файлов: 15 добавлений и 5 удалений

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

@ -673,6 +673,7 @@ public:
public:
GLXDisplay() : mGLContext(nullptr)
, mXDisplay(nullptr)
, mSetupLock("GLXVsyncSetupLock")
, mVsyncThread("GLXVsyncThread")
, mVsyncTask(nullptr)
@ -705,15 +706,22 @@ public:
MOZ_ASSERT(!NS_IsMainThread());
MOZ_ASSERT(!mGLContext, "GLContext already setup!");
_XDisplay* display = gfxPlatformGtk::GetPlatform()->GetCompositorDisplay();
// Create video sync timer on a separate Display to prevent locking the
// main thread X display.
mXDisplay = XOpenDisplay(nullptr);
if (!mXDisplay) {
lock.NotifyAll();
return;
}
// Most compositors wait for vsync events on the root window.
Window root = DefaultRootWindow(display);
int screen = DefaultScreen(display);
Window root = DefaultRootWindow(mXDisplay);
int screen = DefaultScreen(mXDisplay);
ScopedXFree<GLXFBConfig> cfgs;
GLXFBConfig config;
int visid;
if (!gl::GLContextGLX::FindFBConfigForWindow(display, screen, root,
if (!gl::GLContextGLX::FindFBConfigForWindow(mXDisplay, screen, root,
&cfgs, &config, &visid)) {
lock.NotifyAll();
return;
@ -724,7 +732,7 @@ public:
gl::SurfaceCaps::Any(),
nullptr,
false,
display,
mXDisplay,
root,
config,
false);
@ -846,10 +854,12 @@ public:
MOZ_ASSERT(!NS_IsMainThread());
mGLContext = nullptr;
XCloseDisplay(mXDisplay);
}
// Owned by the vsync thread.
RefPtr<gl::GLContextGLX> mGLContext;
_XDisplay* mXDisplay;
Monitor mSetupLock;
base::Thread mVsyncThread;
RefPtr<Runnable> mVsyncTask;