comp: make nvidia display selectable with XRT_COMPOSITOR_FORCE_NVIDIA_DISPLAY

Allows temporarily adding a nvidia display name string to the whitelist without recompiling.
This commit is contained in:
Christoph Haag 2020-08-11 00:38:07 +02:00
parent 5ecd0a947d
commit 026cc64681
4 changed files with 19 additions and 0 deletions

View file

@ -775,6 +775,12 @@ _test_for_nvidia(struct comp_compositor *c, struct vk_bundle *vk)
return true;
}
}
if (c->settings.nvidia_display &&
_match_wl_entry(c->settings.nvidia_display, disp)) {
free(display_props);
return true;
}
}
COMP_ERROR(c, "NVIDIA: No whitelisted displays found!");

View file

@ -16,6 +16,7 @@ DEBUG_GET_ONCE_BOOL_OPTION(print_debug, "XRT_COMPOSITOR_PRINT_DEBUG", false)
DEBUG_GET_ONCE_BOOL_OPTION(print_modes, "XRT_COMPOSITOR_PRINT_MODES", false)
DEBUG_GET_ONCE_BOOL_OPTION(force_randr, "XRT_COMPOSITOR_FORCE_RANDR", false)
DEBUG_GET_ONCE_BOOL_OPTION(force_nvidia, "XRT_COMPOSITOR_FORCE_NVIDIA", false)
DEBUG_GET_ONCE_OPTION(nvidia_display, "XRT_COMPOSITOR_FORCE_NVIDIA_DISPLAY", NULL)
DEBUG_GET_ONCE_BOOL_OPTION(force_xcb, "XRT_COMPOSITOR_FORCE_XCB", false)
DEBUG_GET_ONCE_BOOL_OPTION(force_wayland, "XRT_COMPOSITOR_FORCE_WAYLAND", false)
DEBUG_GET_ONCE_BOOL_OPTION(wireframe, "XRT_COMPOSITOR_WIREFRAME", false)
@ -56,6 +57,9 @@ comp_settings_init(struct comp_settings *s, struct xrt_device *xdev)
if (debug_get_bool_option_force_nvidia()) {
s->window_type = WINDOW_DIRECT_NVIDIA;
}
s->nvidia_display = debug_get_option_nvidia_display();
if (debug_get_bool_option_force_randr()) {
s->window_type = WINDOW_DIRECT_RANDR;
}

View file

@ -64,6 +64,9 @@ struct comp_settings
//! Window type to use.
enum window_type window_type;
//! display string forced by user or NULL
const char *nvidia_display;
//! Distortion type to use.
enum xrt_distortion_model distortion_model;

View file

@ -202,6 +202,12 @@ comp_window_direct_nvidia_init(struct comp_window *w)
// TODO: what if we have multiple whitelisted HMD displays connected?
for (uint32_t i = 0; i < display_count; i++) {
struct VkDisplayPropertiesKHR disp = *(display_props + i);
if (w->c->settings.nvidia_display) {
append_nvidia_entry_on_match(
w_direct, w->c->settings.nvidia_display, &disp);
}
// check this display against our whitelist
for (uint32_t j = 0; j < ARRAY_SIZE(NV_DIRECT_WHITELIST); j++)
if (append_nvidia_entry_on_match(