The open source OpenXR runtime
0
fork

Configure Feed

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

w/direct_mode: Use same num_displays variable for NVIDIA and RandR.

authored by

Lubosz Sarnecki and committed by
Jakob Bornecrantz
4ddcca7a 1ccfa236

+17 -18
+17 -18
src/xrt/compositor/main/comp_window_direct_mode.c
··· 57 57 xcb_screen_t *screen; 58 58 59 59 struct comp_window_direct_randr_display *randr_displays; 60 - uint16_t num_randr_displays; 60 + struct comp_window_direct_nvidia_display *nv_displays; 61 61 62 - struct comp_window_direct_nvidia_display *nv_displays; 63 - uint16_t num_nv_displays; 62 + uint16_t num_displays; 64 63 }; 65 64 66 65 ··· 163 162 struct comp_window_direct *w_direct = (struct comp_window_direct *)w; 164 163 struct vk_bundle *vk = &w->c->vk; 165 164 166 - for (uint32_t i = 0; i < w_direct->num_randr_displays; i++) { 165 + for (uint32_t i = 0; i < w_direct->num_displays; i++) { 167 166 struct comp_window_direct_randr_display *d = 168 167 &w_direct->randr_displays[i]; 169 168 ··· 175 174 d->display = VK_NULL_HANDLE; 176 175 free(d->name); 177 176 } 178 - for (uint32_t i = 0; i < w_direct->num_nv_displays; i++) { 177 + for (uint32_t i = 0; i < w_direct->num_displays; i++) { 179 178 struct comp_window_direct_nvidia_display *d = 180 179 &w_direct->nv_displays[i]; 181 180 d->display = VK_NULL_HANDLE; ··· 199 198 static void 200 199 comp_window_direct_list_randr_screens(struct comp_window_direct *w) 201 200 { 202 - for (int i = 0; i < w->num_randr_displays; i++) { 201 + for (int i = 0; i < w->num_displays; i++) { 203 202 const struct comp_window_direct_randr_display *d = 204 203 &w->randr_displays[i]; 205 204 COMP_DEBUG( ··· 234 233 235 234 comp_window_direct_get_randr_outputs(w_direct); 236 235 237 - if (w_direct->num_randr_displays == 0) { 236 + if (w_direct->num_displays == 0) { 238 237 COMP_ERROR(w->c, "No non-desktop output available."); 239 238 return false; 240 239 } 241 240 242 - if (w->c->settings.display > (int)w_direct->num_randr_displays - 1) { 241 + if (w->c->settings.display > (int)w_direct->num_displays - 1) { 243 242 COMP_DEBUG(w->c, 244 243 "Requested display %d, but only %d displays are " 245 244 "available.", 246 245 w->c->settings.display, 247 - w_direct->num_randr_displays); 246 + w_direct->num_displays); 248 247 249 248 w->c->settings.display = 0; 250 249 struct comp_window_direct_randr_display *d = ··· 293 292 memcpy(d.name, disp->displayName, disp_entry_length); 294 293 d.name[disp_entry_length] = '\0'; 295 294 296 - w->num_nv_displays += 1; 295 + w->num_displays += 1; 297 296 298 297 U_ARRAY_REALLOC_OR_FREE(w->nv_displays, 299 298 struct comp_window_direct_nvidia_display, 300 - w->num_nv_displays); 299 + w->num_displays); 301 300 302 301 if (w->nv_displays == NULL) 303 302 COMP_ERROR(w->base.c, "Unable to reallocate randr_displays"); 304 303 305 - w->nv_displays[w->num_nv_displays - 1] = d; 304 + w->nv_displays[w->num_displays - 1] = d; 306 305 307 306 return true; 308 307 } ··· 359 358 break; 360 359 } 361 360 362 - if (w_direct->num_nv_displays == 0) { 361 + if (w_direct->num_displays == 0) { 363 362 COMP_ERROR(w->c, 364 363 "NVIDIA: No machting displays found. " 365 364 "Is your headset whitelisted?"); ··· 388 387 if (index == -1) 389 388 index = 0; 390 389 391 - if (w->num_randr_displays <= (uint32_t)index) 390 + if (w->num_displays <= (uint32_t)index) 392 391 return NULL; 393 392 394 393 return &w->randr_displays[index]; ··· 401 400 if (index == -1) 402 401 index = 0; 403 402 404 - if (w->num_nv_displays <= (uint32_t)index) 403 + if (w->num_displays <= (uint32_t)index) 405 404 return NULL; 406 405 407 406 return &w->nv_displays[index]; ··· 789 788 memcpy(d.name, name, name_len); 790 789 d.name[name_len] = '\0'; 791 790 792 - w->num_randr_displays += 1; 791 + w->num_displays += 1; 793 792 794 793 U_ARRAY_REALLOC_OR_FREE(w->randr_displays, 795 794 struct comp_window_direct_randr_display, 796 - w->num_randr_displays); 795 + w->num_displays); 797 796 798 797 if (w->randr_displays == NULL) 799 798 COMP_ERROR(w->base.c, "Unable to reallocate randr_displays"); 800 799 801 - w->randr_displays[w->num_randr_displays - 1] = d; 800 + w->randr_displays[w->num_displays - 1] = d; 802 801 } 803 802 804 803 static void