The open source OpenXR runtime
0
fork

Configure Feed

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

c/main + a/util: Make all pacers start at non-zero frame IDs

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

+5 -10
+1 -1
src/xrt/auxiliary/util/u_pacing_compositor.c
··· 221 221 static struct frame * 222 222 create_frame(struct pacing_compositor *pc, enum frame_state state) 223 223 { 224 - int64_t frame_id = pc->next_frame_id++; 224 + int64_t frame_id = ++pc->next_frame_id; 225 225 struct frame *f = get_frame(pc, frame_id); 226 226 227 227 f->frame_id = frame_id;
+1 -4
src/xrt/auxiliary/util/u_pacing_compositor_fake.c
··· 153 153 static struct frame * 154 154 get_new_frame(struct fake_timing *ft) 155 155 { 156 - int64_t frame_id = ft->frame_id_generator++; 156 + int64_t frame_id = ++ft->frame_id_generator; 157 157 158 158 uint64_t index = (uint64_t)frame_id % FRAME_COUNT; 159 159 struct frame *f = &ft->frames[index]; ··· 459 459 snprintf(ft->gpu.name, ARRAY_SIZE(ft->gpu.name), "gpu"); 460 460 snprintf(ft->gpu_delay.name, ARRAY_SIZE(ft->gpu_delay.name), "gpu_delay"); 461 461 snprintf(ft->total_frame.name, ARRAY_SIZE(ft->total_frame.name), "total_frame"); 462 - 463 - // To make sure the code can start from a non-zero frame id. 464 - ft->frame_id_generator = 5; 465 462 466 463 // An arbitrary guess, that happens to be based on Index. 467 464 float present_to_display_offset_ms = debug_get_float_option_present_to_display_offset_ms();
+3 -5
src/xrt/compositor/main/comp_target_swapchain.c
··· 877 877 struct comp_target_swapchain *cts = (struct comp_target_swapchain *)ct; 878 878 struct vk_bundle *vk = get_vk(cts); 879 879 880 - assert(cts->current_frame_id >= 0); 880 + assert(cts->current_frame_id > 0); 881 881 assert(cts->current_frame_id <= UINT32_MAX); 882 882 883 883 VkPresentInfoKHR present_info = { ··· 908 908 #endif 909 909 910 910 #ifdef VK_KHR_present_id 911 - // @note first present should be 1, not 0, as the swapchain starts at ID 0 and increments from that 912 - uint64_t present_id = (uint64_t)cts->current_frame_id + 1; 911 + uint64_t present_id = (uint64_t)cts->current_frame_id; 913 912 914 913 VkPresentIdKHR vk_present_id = { 915 914 .sType = VK_STRUCTURE_TYPE_PRESENT_ID_KHR, ··· 955 954 } 956 955 957 956 // @note current frame ID is incremented by 1 to match the ID given to Vulkan, see comp_target_swapchain_present 958 - return vk->vkWaitForPresentKHR(vk->device, cts->swapchain.handle, (uint64_t)cts->current_frame_id + 1, 959 - timeout_ns); 957 + return vk->vkWaitForPresentKHR(vk->device, cts->swapchain.handle, (uint64_t)cts->current_frame_id, timeout_ns); 960 958 #else 961 959 return VK_ERROR_EXTENSION_NOT_PRESENT; 962 960 #endif