diff --git a/doc/changes/compositor/mr.2004.md b/doc/changes/compositor/mr.2004.md new file mode 100644 index 000000000..1a50c8b8f --- /dev/null +++ b/doc/changes/compositor/mr.2004.md @@ -0,0 +1 @@ +client: improve EGL context creation and use and match reset notification strategy when creating a shared context. diff --git a/src/xrt/compositor/client/comp_egl_client.c b/src/xrt/compositor/client/comp_egl_client.c index 192ae4cf2..ca2e0feec 100644 --- a/src/xrt/compositor/client/comp_egl_client.c +++ b/src/xrt/compositor/client/comp_egl_client.c @@ -208,20 +208,23 @@ create_context( eglBindAPI(api_type); - // clang-format off - EGLint attrs[] = { - EGL_CONTEXT_MAJOR_VERSION_KHR, 3, - EGL_CONTEXT_MINOR_VERSION_KHR, 1, // Panfrost only supports 3.1 - EGL_NONE, EGL_NONE, - EGL_NONE, - }; - // clang-format on + size_t attrc = 0; + EGLint attrs[7] = {0}; + + attrs[attrc++] = EGL_CONTEXT_MAJOR_VERSION; + attrs[attrc++] = 3; + // Panfrost only supports 3.1 + attrs[attrc++] = EGL_CONTEXT_MINOR_VERSION; + attrs[attrc++] = 1; if (api_type == EGL_OPENGL_API) { - attrs[4] = EGL_CONTEXT_OPENGL_PROFILE_MASK; - attrs[5] = EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT; + attrs[attrc++] = EGL_CONTEXT_OPENGL_PROFILE_MASK; + attrs[attrc++] = EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT; } + attrs[attrc++] = EGL_NONE; + assert(attrc <= ARRAY_SIZE(attrs)); + EGLContext our_context = eglCreateContext(display, config, app_context, attrs); // Restore old API type.