Skip to content

Commit 1f3cc8c

Browse files
committed
<chromium> Only enable robustness if the shared context is using it
Chromium currently assumes that all GLContexts are checking the availability of robustness on the system through the same code path. Since we're passing it a context created by Qt, and that Qt never uses EGL_EXT_create_context_robustness, the context creation fails when trying to share a non-robustness-enabled context with one that does. Fix the issue by asking the shared GLContext if it was allocated using the extension, Chromium's contexts currently always return true and the Qt context will return false. This relies on the fact that the Qt context is always the first one added to the ShareGroup and that it is going to be the one queried, but this should be reasonably reliable. Change-Id: I6456429db678f077cd8a72032711361da01e72ea Reviewed-by: Andras Becsi <[email protected]>
1 parent 7ef833c commit 1f3cc8c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

chromium/ui/gl/gl_context_egl.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ bool GLContextEGL::Initialize(
5252
config_ = compatible_surface->GetConfig();
5353

5454
const EGLint* context_attributes = NULL;
55-
if (GLSurfaceEGL::IsCreateContextRobustnessSupported()) {
55+
if (GLSurfaceEGL::IsCreateContextRobustnessSupported()
56+
&& (!share_group()->GetContext() || share_group()->GetContext()->WasAllocatedUsingRobustnessExtension())) {
5657
DVLOG(1) << "EGL_EXT_create_context_robustness supported.";
5758
context_attributes = kContextRobustnessAttributes;
5859
} else {

chromium/ui/gl/gl_context_glx.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ bool GLContextGLX::Initialize(
5353
if (GLSurfaceGLX::IsCreateContextSupported()) {
5454
DVLOG(1) << "GLX_ARB_create_context supported.";
5555
std::vector<int> attribs;
56-
if (GLSurfaceGLX::IsCreateContextRobustnessSupported()) {
56+
if (GLSurfaceGLX::IsCreateContextRobustnessSupported()
57+
&& (!share_group()->GetContext() || share_group()->GetContext()->WasAllocatedUsingRobustnessExtension())) {
5758
DVLOG(1) << "GLX_ARB_create_context_robustness supported.";
5859
attribs.push_back(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB);
5960
attribs.push_back(GLX_LOSE_CONTEXT_ON_RESET_ARB);

0 commit comments

Comments
 (0)