The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

c/client: Use the EGL compositor's display in swapchain

authored by

Jakob Bornecrantz and committed by
Ryan Pavlik
f9b50971 b7b46908

+58 -31
+2
doc/changes/compositor/mr.827.md
··· 1 + client: Use the EGL compositor's display in swapchain, previously it tried to 2 + use the current one, which when running on a new thread would explode.
+1
src/xrt/compositor/CMakeLists.txt
··· 88 88 if(XRT_HAVE_EGL) 89 89 list(APPEND CLIENT_SOURCE_FILES 90 90 client/comp_egl_client.c 91 + client/comp_egl_client.h 91 92 ) 92 93 endif() 93 94
+1 -30
src/xrt/compositor/client/comp_egl_client.c
··· 22 22 #include "ogl/ogl_api.h" 23 23 24 24 #include "client/comp_gl_client.h" 25 + #include "client/comp_egl_client.h" 25 26 #include "client/comp_gl_memobj_swapchain.h" 26 27 #include "client/comp_gl_eglimage_swapchain.h" 27 28 ··· 118 119 119 120 /* 120 121 * 121 - * EGL compositor subclass. 122 - * 123 - */ 124 - 125 - /*! 126 - * EGL based compositor, carries the extra needed EGL information needed by the 127 - * client side code and can handle both GL Desktop or GLES contexts. 128 - * 129 - * @ingroup comp_client 130 - */ 131 - struct client_egl_compositor 132 - { 133 - struct client_gl_compositor base; 134 - 135 - EGLDisplay dpy; 136 - }; 137 - 138 - 139 - /* 140 - * 141 122 * Helper functions. 142 123 * 143 124 */ 144 - 145 - /*! 146 - * Down-cast helper. 147 - * @protected @memberof client_egl_compositor 148 - */ 149 - static inline struct client_egl_compositor * 150 - client_egl_compositor(struct xrt_compositor *xc) 151 - { 152 - return (struct client_egl_compositor *)xc; 153 - } 154 125 155 126 XRT_MAYBE_UNUSED static bool 156 127 has_extension(const char *extensions, const char *ext)
+50
src/xrt/compositor/client/comp_egl_client.h
··· 1 + // Copyright 2019-2021, Collabora, Ltd. 2 + // SPDX-License-Identifier: BSL-1.0 3 + /*! 4 + * @file 5 + * @brief Glue code to EGL client side glue code. 6 + * @author Jakob Bornecrantz <jakob@collabora.com> 7 + * @ingroup comp_client 8 + */ 9 + 10 + #pragma once 11 + 12 + #include "xrt/xrt_compositor.h" 13 + 14 + #include "ogl/egl_api.h" 15 + 16 + #include "client/comp_gl_client.h" 17 + 18 + 19 + #ifdef __cplusplus 20 + extern "C" { 21 + #endif 22 + 23 + 24 + /*! 25 + * EGL based compositor, carries the extra needed EGL information needed by the 26 + * client side code and can handle both GL Desktop or GLES contexts. 27 + * 28 + * @ingroup comp_client 29 + */ 30 + struct client_egl_compositor 31 + { 32 + struct client_gl_compositor base; 33 + 34 + EGLDisplay dpy; 35 + }; 36 + 37 + /*! 38 + * Down-cast helper. 39 + * @protected @memberof client_egl_compositor 40 + */ 41 + static inline struct client_egl_compositor * 42 + client_egl_compositor(struct xrt_compositor *xc) 43 + { 44 + return (struct client_egl_compositor *)xc; 45 + } 46 + 47 + 48 + #ifdef __cplusplus 49 + } 50 + #endif
+3 -1
src/xrt/compositor/client/comp_gl_eglimage_swapchain.c
··· 27 27 #include "ogl/ogl_helpers.h" 28 28 29 29 #include "client/comp_gl_client.h" 30 + #include "client/comp_egl_client.h" 30 31 #include "client/comp_gl_eglimage_swapchain.h" 31 32 32 33 #include <inttypes.h> ··· 164 165 struct xrt_swapchain_native *xscn, 165 166 struct client_gl_swapchain **out_sc) 166 167 { 168 + struct client_egl_compositor *ceglc = client_egl_compositor(xc); 167 169 ll = debug_get_log_option_egl_swapchain_log(); 168 170 169 171 if (xscn == NULL) { ··· 197 199 sc->base.base.base.reference.count = 1; 198 200 sc->base.base.base.num_images = native_xsc->num_images; // Fetch the number of images from the native swapchain. 199 201 sc->base.xscn = xscn; 200 - sc->display = eglGetCurrentDisplay(); 202 + sc->display = ceglc->dpy; 201 203 202 204 struct xrt_swapchain_gl *xscgl = &sc->base.base; 203 205
+1
src/xrt/compositor/meson.build
··· 102 102 if build_egl 103 103 compositor_srcs += [ 104 104 'client/comp_egl_client.c', 105 + 'client/comp_egl_client.h', 105 106 ] 106 107 compositor_deps += [egl] 107 108 endif