Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eglstreams-kms: Fix NVIDIA driver version detection. #678

Merged
merged 1 commit into from
Dec 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 42 additions & 0 deletions src/platforms/eglstream-kms/server/platform_symbols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,48 @@ mg::PlatformPriority probe_graphics_platform(
return false;
}

eglBindAPI(MIR_SERVER_EGL_OPENGL_API);
EGLint const config_attribs[] = {
EGL_RENDERABLE_TYPE, MIR_SERVER_EGL_OPENGL_BIT,
EGL_SURFACE_TYPE, EGL_STREAM_BIT_KHR,
EGL_NONE
};
EGLConfig config;
EGLint num_configs;
if (eglChooseConfig(display, config_attribs, &config, 1, &num_configs) != EGL_TRUE)
{
mir::log_warning("Failed to create EGL context");
return false;
}
EGLContext ctx{EGL_NO_CONTEXT};
auto ctx_init = mir::raii::paired_calls(
[&ctx, display, config]()
{
EGLint const context_attr[] = {
#if MIR_SERVER_EGL_OPENGL_BIT == EGL_OPENGL_ES2_BIT
EGL_CONTEXT_CLIENT_VERSION, 2,
#endif
EGL_NONE
};
ctx = eglCreateContext(display, config, EGL_NO_CONTEXT, context_attr);
},
[ctx, display]()
{
if (ctx != EGL_NO_CONTEXT)
{
eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroyContext(display, ctx);
}
});

if (ctx == EGL_NO_CONTEXT)
{
mir::log_warning("Failed to create EGL context");
return false;
}

eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, ctx);

auto const gl_version = reinterpret_cast<char const*>(glGetString(GL_VERSION));
if (!gl_version)
{
Expand Down