Commit e1ff28d4 by Jonah Ryan-Davis Committed by Commit Bot

GLX: Always call XSync on creation/destruction of WindowSurfaces

ANGLE was checking that it had opened the connection before calling XSync upon initialization. However, clients may pass in a connection and ANGLE must sync after creating a GLXWindow with the connection. This wasn't happening and was causing issues in Chrome. Bug: chromium:1172803 Change-Id: Ieb2cbfaa226f6d066030f42d8e25b1d9c34779f7 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2757507 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 0973dd68
......@@ -334,7 +334,7 @@ egl::Error DisplayGLX::initialize(egl::Display *display)
}
}
syncXCommands();
syncXCommands(false);
mRenderer.reset(new RendererGLX(std::move(functionsGL), eglAttributes, this));
const gl::Version &maxVersion = mRenderer->getMaxSupportedESVersion();
......@@ -825,9 +825,9 @@ gl::Version DisplayGLX::getMaxSupportedESVersion() const
return mRenderer->getMaxSupportedESVersion();
}
void DisplayGLX::syncXCommands() const
void DisplayGLX::syncXCommands(bool alwaysSync) const
{
if (mUsesNewXDisplay)
if (mUsesNewXDisplay || alwaysSync)
{
XSync(mGLX.getDisplay(), False);
}
......
......@@ -75,11 +75,13 @@ class DisplayGLX : public DisplayGL
gl::Version getMaxSupportedESVersion() const override;
// Synchronizes with the X server, if the display has been opened by ANGLE.
// Synchronizes with the X server.
// Calling this is required at the end of every functions that does buffered
// X calls (not for glX calls) otherwise there might be race conditions
// between the application's display and ANGLE's one.
void syncXCommands() const;
// Calling this only syncs if ANGLE opened the display, or if alwaysSync
// is true.
void syncXCommands(bool alwaysSync) const;
// Depending on the supported GLX extension, swap interval can be set
// globally or per drawable. This function will make sure the drawable's
......
......@@ -132,7 +132,7 @@ egl::Error PixmapSurfaceGLX::initialize(const egl::Display *display)
}
XFlush(mDisplay);
displayGLX->syncXCommands();
displayGLX->syncXCommands(false);
return egl::NoError();
}
......
......@@ -59,7 +59,7 @@ WindowSurfaceGLX::~WindowSurfaceGLX()
XSetErrorHandler(oldErrorHandler);
}
mGLXDisplay->syncXCommands();
mGLXDisplay->syncXCommands(true);
}
egl::Error WindowSurfaceGLX::initialize(const egl::Display *display)
......@@ -141,7 +141,7 @@ egl::Error WindowSurfaceGLX::initialize(const egl::Display *display)
XFreeColormap(mDisplay, colormap);
}
mGLXDisplay->syncXCommands();
mGLXDisplay->syncXCommands(true);
return egl::NoError();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment