mirror of
https://github.com/lbgos/rift-s-linux.git
synced 2026-10-28 21:01:28 +01:00
c/main + a/util: Make all pacers start at non-zero frame IDs
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2512>
This commit is contained in:
1 parent
0ffa7103ba
commit
850e8e4c2e
3 files changed
+5
-10
No files matched your search
@@ -221,7 +221,7 @@ get_frame(struct pacing_compositor *pc, int64_t frame_id)
|
||||
static struct frame *
|
||||
create_frame(struct pacing_compositor *pc, enum frame_state state)
|
||||
{
|
||||
int64_t frame_id = pc->next_frame_id++;
|
||||
int64_t frame_id = ++pc->next_frame_id;
|
||||
struct frame *f = get_frame(pc, frame_id);
|
||||
|
||||
f->frame_id = frame_id;
|
||||
|
||||
@@ -153,7 +153,7 @@ get_frame_or_null(struct fake_timing *ft, int64_t frame_id)
|
||||
static struct frame *
|
||||
get_new_frame(struct fake_timing *ft)
|
||||
{
|
||||
int64_t frame_id = ft->frame_id_generator++;
|
||||
int64_t frame_id = ++ft->frame_id_generator;
|
||||
|
||||
uint64_t index = (uint64_t)frame_id % FRAME_COUNT;
|
||||
struct frame *f = &ft->frames[index];
|
||||
@@ -460,9 +460,6 @@ u_pc_fake_create(int64_t estimated_frame_period_ns, int64_t now_ns, struct u_pac
|
||||
snprintf(ft->gpu_delay.name, ARRAY_SIZE(ft->gpu_delay.name), "gpu_delay");
|
||||
snprintf(ft->total_frame.name, ARRAY_SIZE(ft->total_frame.name), "total_frame");
|
||||
|
||||
// To make sure the code can start from a non-zero frame id.
|
||||
ft->frame_id_generator = 5;
|
||||
|
||||
// An arbitrary guess, that happens to be based on Index.
|
||||
float present_to_display_offset_ms = debug_get_float_option_present_to_display_offset_ms();
|
||||
|
||||
|
||||
@@ -877,7 +877,7 @@ comp_target_swapchain_present(struct comp_target *ct,
|
||||
struct comp_target_swapchain *cts = (struct comp_target_swapchain *)ct;
|
||||
struct vk_bundle *vk = get_vk(cts);
|
||||
|
||||
assert(cts->current_frame_id >= 0);
|
||||
assert(cts->current_frame_id > 0);
|
||||
assert(cts->current_frame_id <= UINT32_MAX);
|
||||
|
||||
VkPresentInfoKHR present_info = {
|
||||
@@ -908,8 +908,7 @@ comp_target_swapchain_present(struct comp_target *ct,
|
||||
#endif
|
||||
|
||||
#ifdef VK_KHR_present_id
|
||||
// @note first present should be 1, not 0, as the swapchain starts at ID 0 and increments from that
|
||||
uint64_t present_id = (uint64_t)cts->current_frame_id + 1;
|
||||
uint64_t present_id = (uint64_t)cts->current_frame_id;
|
||||
|
||||
VkPresentIdKHR vk_present_id = {
|
||||
.sType = VK_STRUCTURE_TYPE_PRESENT_ID_KHR,
|
||||
@@ -955,8 +954,7 @@ comp_target_swapchain_wait_for_present(struct comp_target *ct, time_duration_ns
|
||||
}
|
||||
|
||||
// @note current frame ID is incremented by 1 to match the ID given to Vulkan, see comp_target_swapchain_present
|
||||
return vk->vkWaitForPresentKHR(vk->device, cts->swapchain.handle, (uint64_t)cts->current_frame_id + 1,
|
||||
timeout_ns);
|
||||
return vk->vkWaitForPresentKHR(vk->device, cts->swapchain.handle, (uint64_t)cts->current_frame_id, timeout_ns);
|
||||
#else
|
||||
return VK_ERROR_EXTENSION_NOT_PRESENT;
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user