The open source OpenXR runtime

xrt: Bump overlay limit from 16 to 128

Based on my tests, there's virtually no difference in CPU and GPU
performance even when increasing RENDER_MAX_LAYERS to 1024.
For now, a value of 128 should be sufficient for everyone.

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2341>

+24 -17
+1
doc/changes/xrt/mr.2341.md
··· 1 + xrt: Bump overlay limit from 16 to 128
+1 -1
src/xrt/compositor/main/comp_compositor.c
··· 1088 1088 struct xrt_system_compositor_info *sys_info = &sys_info_storage; 1089 1089 1090 1090 // Required by OpenXR spec. 1091 - sys_info->max_layers = 16; 1091 + sys_info->max_layers = XRT_MAX_LAYERS; 1092 1092 sys_info->compositor_vk_deviceUUID = c->settings.selected_gpu_deviceUUID; 1093 1093 sys_info->client_vk_deviceUUID = c->settings.client_gpu_deviceUUID; 1094 1094 sys_info->client_d3d_deviceLUID = c->settings.client_gpu_deviceLUID;
+2 -1
src/xrt/compositor/multi/comp_multi_private.h
··· 11 11 12 12 #include "xrt/xrt_compiler.h" 13 13 #include "xrt/xrt_defines.h" 14 + #include "xrt/xrt_limits.h" 14 15 #include "xrt/xrt_compositor.h" 15 16 16 17 #include "os/os_time.h" ··· 37 38 * @todo Move to `xrt_limits.h` and share. 38 39 * @ingroup comp_multi 39 40 */ 40 - #define MULTI_MAX_LAYERS 16 41 + #define MULTI_MAX_LAYERS XRT_MAX_LAYERS 41 42 42 43 43 44 /*
+1 -1
src/xrt/compositor/null/null_compositor.c
··· 267 267 struct xrt_system_compositor_info *sys_info = &c->sys_info; 268 268 269 269 // Required by OpenXR spec. 270 - sys_info->max_layers = 16; 270 + sys_info->max_layers = XRT_MAX_LAYERS; 271 271 272 272 // UUIDs and LUID already set in vk init. 273 273 (void)sys_info->compositor_vk_deviceUUID;
+2 -2
src/xrt/compositor/render/render_interface.h
··· 53 53 54 54 /*! 55 55 * Max number of layers for layer squasher, can be different from 56 - * @ref COMP_MAX_LAYERS as the render module is separate from the compositor. 56 + * @ref XRT_MAX_LAYERS as the render module is separate from the compositor. 57 57 */ 58 - #define RENDER_MAX_LAYERS (16) 58 + #define RENDER_MAX_LAYERS (XRT_MAX_LAYERS) 59 59 60 60 /*! 61 61 * Max number of images that can be given at a single time to the layer
+3 -1
src/xrt/compositor/shaders/layer.comp
··· 22 22 // Should we do timewarp. 23 23 layout(constant_id = 1) const bool do_timewarp = false; 24 24 layout(constant_id = 2) const bool do_color_correction = true; 25 - layout(constant_id = 3) const int RENDER_MAX_LAYERS = 16; 25 + 26 + //! This is always set by the render_resource pipeline creation code to the actual limit. 27 + layout(constant_id = 3) const int RENDER_MAX_LAYERS = 128; 26 28 layout(constant_id = 4) const int SAMPLER_ARRAY_SIZE = 16; 27 29 28 30 layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
+1 -4
src/xrt/compositor/util/comp_layer_accum.h
··· 18 18 #include <assert.h> 19 19 #include <stdint.h> 20 20 21 - #define COMP_MAX_LAYERS 16 22 - 23 - 24 21 #ifdef __cplusplus 25 22 extern "C" { 26 23 #endif ··· 93 90 struct xrt_layer_frame_data data; 94 91 95 92 //! All of the layers. 96 - struct comp_layer layers[COMP_MAX_LAYERS]; 93 + struct comp_layer layers[XRT_MAX_LAYERS]; 97 94 98 95 //! Number of submitted layers. 99 96 uint32_t layer_count;
+5
src/xrt/include/xrt/xrt_limits.h
··· 49 49 #define XRT_MAX_SUPPORTED_REFRESH_RATES 16 50 50 51 51 /*! 52 + * Max number of layers which can be handled at once. 53 + */ 54 + #define XRT_MAX_LAYERS 128 55 + 56 + /*! 52 57 * @} 53 58 */
+3 -2
src/xrt/ipc/server/ipc_server.h
··· 12 12 #pragma once 13 13 14 14 #include "xrt/xrt_compiler.h" 15 + #include "xrt/xrt_limits.h" 16 + #include "xrt/xrt_space.h" 15 17 #include "xrt/xrt_system.h" 16 - #include "xrt/xrt_space.h" 17 18 18 19 #include "os/os_threading.h" 19 20 ··· 49 50 */ 50 51 51 52 #define IPC_MAX_CLIENT_SEMAPHORES 8 52 - #define IPC_MAX_CLIENT_SWAPCHAINS 32 53 + #define IPC_MAX_CLIENT_SWAPCHAINS (XRT_MAX_LAYERS * 2) 53 54 #define IPC_MAX_CLIENT_SPACES 128 54 55 55 56 struct xrt_instance;
+1 -1
src/xrt/ipc/shared/ipc_protocol.h
··· 33 33 #define IPC_MAX_VIEWS 8 // max views we will return configs for 34 34 #define IPC_MAX_FORMATS 32 // max formats our server-side compositor supports 35 35 #define IPC_MAX_DEVICES 8 // max number of devices we will map using shared mem 36 - #define IPC_MAX_LAYERS 16 36 + #define IPC_MAX_LAYERS XRT_MAX_LAYERS 37 37 #define IPC_MAX_SLOTS 128 38 38 #define IPC_MAX_CLIENTS 8 39 39 #define IPC_MAX_RAW_VIEWS 32 // Max views that we can get, artificial limit.
+2 -2
src/xrt/state_trackers/oxr/oxr_api_session.c
··· 178 178 // Get from compositor. 179 179 struct xrt_system_compositor_info *info = sess->sys->xsysc ? &sess->sys->xsysc->info : NULL; 180 180 181 - // headless extension does not modify the 16 layer minimum. 182 - uint32_t max_layers = 16; 181 + // headless extension does not modify the layer count 182 + uint32_t max_layers = XRT_MAX_LAYERS; 183 183 if (info) { 184 184 max_layers = info->max_layers; 185 185 }
+1 -1
src/xrt/state_trackers/oxr/oxr_system.c
··· 388 388 properties->graphicsProperties.maxLayerCount = info->max_layers; 389 389 } else { 390 390 // probably using the headless extension, but the extension does not modify the 16 layer minimum. 391 - properties->graphicsProperties.maxLayerCount = 16; 391 + properties->graphicsProperties.maxLayerCount = XRT_MAX_LAYERS; 392 392 } 393 393 properties->graphicsProperties.maxSwapchainImageWidth = 1024 * 16; 394 394 properties->graphicsProperties.maxSwapchainImageHeight = 1024 * 16;
+1 -1
src/xrt/targets/sdl_test/sdl_compositor.c
··· 257 257 struct xrt_system_compositor_info *sys_info = &c->sys_info; 258 258 259 259 // Required by OpenXR spec. 260 - sys_info->max_layers = 16; 260 + sys_info->max_layers = XRT_MAX_LAYERS; 261 261 262 262 // UUIDs and LUID already set in vk init. 263 263 (void)sys_info->compositor_vk_deviceUUID;