c/main: Improve word choice/clarity

This commit is contained in:
Ryan Pavlik 2022-05-17 15:25:35 -05:00
parent 0730f08f2d
commit 973b8f3b7f
7 changed files with 22 additions and 26 deletions

View file

@ -760,15 +760,15 @@ compositor_init_vulkan(struct comp_compositor *c)
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
static bool
_match_wl_entry(const char *wl_entry, VkDisplayPropertiesKHR *disp)
_match_allowlist_entry(const char *al_entry, VkDisplayPropertiesKHR *disp)
{
unsigned long wl_entry_length = strlen(wl_entry);
unsigned long al_entry_length = strlen(al_entry);
unsigned long disp_entry_length = strlen(disp->displayName);
if (disp_entry_length < wl_entry_length)
if (disp_entry_length < al_entry_length)
return false;
// we have a match with this whitelist entry.
if (strncmp(wl_entry, disp->displayName, wl_entry_length) == 0)
// we have a match with this allowlist entry.
if (strncmp(al_entry, disp->displayName, al_entry_length) == 0)
return true;
return false;
@ -814,25 +814,25 @@ _test_for_nvidia(struct comp_compositor *c, struct vk_bundle *vk)
for (uint32_t i = 0; i < display_count; i++) {
VkDisplayPropertiesKHR *disp = display_props + i;
// check this display against our whitelist
for (uint32_t j = 0; j < ARRAY_SIZE(NV_DIRECT_WHITELIST); j++) {
if (_match_wl_entry(NV_DIRECT_WHITELIST[j], disp)) {
// check this display against our allowlist
for (uint32_t j = 0; j < ARRAY_SIZE(NV_DIRECT_ALLOWLIST); j++) {
if (_match_allowlist_entry(NV_DIRECT_ALLOWLIST[j], disp)) {
free(display_props);
return true;
}
}
if (c->settings.nvidia_display && _match_wl_entry(c->settings.nvidia_display, disp)) {
if (c->settings.nvidia_display && _match_allowlist_entry(c->settings.nvidia_display, disp)) {
free(display_props);
return true;
}
}
COMP_ERROR(c, "NVIDIA: No whitelisted displays found!");
COMP_ERROR(c, "NVIDIA: No allowlisted displays found!");
COMP_ERROR(c, "== Current Whitelist ==");
for (uint32_t i = 0; i < ARRAY_SIZE(NV_DIRECT_WHITELIST); i++)
COMP_ERROR(c, "%s", NV_DIRECT_WHITELIST[i]);
COMP_ERROR(c, "== Current Allowlist ==");
for (uint32_t i = 0; i < ARRAY_SIZE(NV_DIRECT_ALLOWLIST); i++)
COMP_ERROR(c, "%s", NV_DIRECT_ALLOWLIST[i]);
COMP_ERROR(c, "== Found Displays ==");
for (uint32_t i = 0; i < display_count; i++)

View file

@ -27,7 +27,7 @@ extern "C" {
* be careful about which displays we attempt to acquire.
* We may wish to allow user configuration to extend this list.
*/
XRT_MAYBE_UNUSED static const char *NV_DIRECT_WHITELIST[] = {
XRT_MAYBE_UNUSED static const char *NV_DIRECT_ALLOWLIST[] = {
"Sony SIE HMD *08", "HTC Corporation HTC-VIVE",
"HTC Corporation VIVE Pro", "Oculus VR Inc. Rift", /* Matches DK1, DK2 and CV1 */
"Valve Corporation Index HMD",

View file

@ -631,7 +631,7 @@ comp_target_swapchain_create_images(struct comp_target *ct,
cts->preferred.color_space = color_space;
// Sanity check.
// Preliminary check of the environment
ret = vk->vkGetPhysicalDeviceSurfaceSupportKHR( //
vk->physical_device, // physicalDevice
vk->queue_family_index, // queueFamilyIndex
@ -643,7 +643,6 @@ comp_target_swapchain_create_images(struct comp_target *ct,
COMP_ERROR(ct->c, "vkGetPhysicalDeviceSurfaceSupportKHR: Surface not supported!");
}
// More sanity checks.
if (!check_surface_present_mode(cts, cts->surface.handle, cts->present_mode)) {
// Free old.
destroy_old(cts, old_swapchain_handle);

View file

@ -144,7 +144,7 @@ append_nvidia_entry_on_match(struct comp_window_direct_nvidia *w,
if (strncmp(wl_entry, disp->displayName, wl_entry_length) != 0)
return false;
// we have a match with this whitelist entry.
// we have a match with this allowlist entry.
w->base.base.c->settings.preferred.width = disp->physicalResolution.width;
w->base.base.c->settings.preferred.height = disp->physicalResolution.height;
struct comp_window_direct_nvidia_display d = {.name = U_TYPED_ARRAY_CALLOC(char, disp_entry_length + 1),
@ -172,7 +172,6 @@ comp_window_direct_nvidia_init(struct comp_target *ct)
struct comp_window_direct_nvidia *w_direct = (struct comp_window_direct_nvidia *)ct;
struct vk_bundle *vk = get_vk(ct);
// Sanity check.
if (vk->instance == VK_NULL_HANDLE) {
COMP_ERROR(ct->c, "Vulkan not initialized before NVIDIA init!");
return false;
@ -183,7 +182,7 @@ comp_window_direct_nvidia_init(struct comp_target *ct)
return false;
}
// find our display using nvidia whitelist, enumerate its modes, and
// find our display using nvidia allowlist, enumerate its modes, and
// pick the best one get a list of attached displays
uint32_t display_count;
if (vk->vkGetPhysicalDeviceDisplayPropertiesKHR(vk->physical_device, &display_count, NULL) != VK_SUCCESS) {
@ -205,7 +204,7 @@ comp_window_direct_nvidia_init(struct comp_target *ct)
return false;
}
// TODO: what if we have multiple whitelisted HMD displays connected?
/// @todo what if we have multiple allowlisted HMD displays connected?
for (uint32_t i = 0; i < display_count; i++) {
struct VkDisplayPropertiesKHR disp = *(display_props + i);
@ -213,9 +212,9 @@ comp_window_direct_nvidia_init(struct comp_target *ct)
append_nvidia_entry_on_match(w_direct, ct->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(w_direct, NV_DIRECT_WHITELIST[j], &disp))
// check this display against our allowlist
for (uint32_t j = 0; j < ARRAY_SIZE(NV_DIRECT_ALLOWLIST); j++)
if (append_nvidia_entry_on_match(w_direct, NV_DIRECT_ALLOWLIST[j], &disp))
break;
}

View file

@ -177,7 +177,6 @@ comp_window_direct_randr_init(struct comp_target *ct)
struct comp_window_direct_randr *w_direct = (struct comp_window_direct_randr *)ct;
struct vk_bundle *vk = get_vk(w_direct);
// Sanity check.
if (vk->instance != VK_NULL_HANDLE) {
COMP_ERROR(ct->c, "Vulkan initialized before RANDR init!");
return false;

View file

@ -161,7 +161,6 @@ comp_window_vk_display_init(struct comp_target *ct)
struct comp_window_vk_display *w_direct = (struct comp_window_vk_display *)ct;
struct vk_bundle *vk = get_vk(ct);
// Sanity check.
if (vk->instance == VK_NULL_HANDLE) {
COMP_ERROR(ct->c, "Vulkan not initialized before vk display init!");
return false;

View file

@ -322,7 +322,7 @@ comp_window_wayland_init(struct comp_target *ct)
w_wayland->xdg_toplevel = xdg_surface_get_toplevel(w_wayland->xdg_surface);
xdg_toplevel_add_listener(w_wayland->xdg_toplevel, &xdg_toplevel_listener, w_wayland);
/* Sane defaults */
/* basic defaults */
xdg_toplevel_set_app_id(w_wayland->xdg_toplevel, "openxr");
xdg_toplevel_set_title(w_wayland->xdg_toplevel, "OpenXR application");