Merge remote-tracking branch 'yshui/pacing-fixes' into pacing-fixes
This commit is contained in:
@@ -20,7 +20,7 @@ void apply_driver_workarounds(struct session *ps, enum driver driver) {
|
||||
}
|
||||
|
||||
enum vblank_scheduler_type choose_vblank_scheduler(enum driver driver) {
|
||||
if (driver & DRIVER_INTEL) {
|
||||
if (driver & DRIVER_NVIDIA) {
|
||||
return VBLANK_SCHEDULER_SGI_VIDEO_SYNC;
|
||||
}
|
||||
return VBLANK_SCHEDULER_PRESENT;
|
||||
|
||||
11
src/common.h
11
src/common.h
@@ -134,17 +134,6 @@ struct shader_info {
|
||||
UT_hash_handle hh;
|
||||
};
|
||||
|
||||
enum render_progress {
|
||||
/// Render is finished and presented to the screen.
|
||||
RENDER_IDLE = 0,
|
||||
/// Rendering is queued, but not started yet.
|
||||
RENDER_QUEUED,
|
||||
/// Backend has been called, render commands have been issued.
|
||||
RENDER_STARTED,
|
||||
/// Backend reported render commands have been finished. (not actually used).
|
||||
RENDER_FINISHED,
|
||||
};
|
||||
|
||||
/// Structure containing all necessary data for a session.
|
||||
typedef struct session {
|
||||
// === Event handlers ===
|
||||
|
||||
19
src/config.c
19
src/config.c
@@ -624,10 +624,14 @@ struct debug_options_entry {
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static const char *vblank_scheduler_choices[] = { "present", "sgi_video_sync", NULL };
|
||||
const char *vblank_scheduler_str[] = {
|
||||
[VBLANK_SCHEDULER_PRESENT] = "present",
|
||||
[VBLANK_SCHEDULER_SGI_VIDEO_SYNC] = "sgi_video_sync",
|
||||
[LAST_VBLANK_SCHEDULER] = NULL
|
||||
};
|
||||
static const struct debug_options_entry debug_options_entries[] = {
|
||||
{"smart_frame_pacing", NULL, offsetof(struct debug_options, smart_frame_pacing)},
|
||||
{"force_vblank_sched", vblank_scheduler_choices, offsetof(struct debug_options, force_vblank_scheduler)},
|
||||
{"smart_frame_pacing", NULL, offsetof(struct debug_options, smart_frame_pacing)},
|
||||
{"force_vblank_sched", vblank_scheduler_str, offsetof(struct debug_options, force_vblank_scheduler)},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -655,11 +659,14 @@ void parse_debug_option_single(char *setting, struct debug_options *debug_option
|
||||
}
|
||||
if (!parse_int(arg, value)) {
|
||||
log_error("Invalid value for debug option %s: %s, it "
|
||||
"will be ignored",
|
||||
setting, arg);
|
||||
"will be ignored.",
|
||||
debug_options_entries[i].name, arg);
|
||||
}
|
||||
} else {
|
||||
} else if (debug_options_entries[i].choices == NULL) {
|
||||
*value = 1;
|
||||
} else {
|
||||
log_error(
|
||||
"Missing value for debug option %s, it will be ignored.", setting);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -103,13 +103,7 @@ enum vblank_scheduler_type {
|
||||
LAST_VBLANK_SCHEDULER,
|
||||
};
|
||||
|
||||
static inline const char *vblank_scheduler_type_str(enum vblank_scheduler_type type) {
|
||||
switch (type) {
|
||||
case VBLANK_SCHEDULER_PRESENT: return "present";
|
||||
case VBLANK_SCHEDULER_SGI_VIDEO_SYNC: return "sgi_video_sync";
|
||||
default: return "invalid";
|
||||
}
|
||||
}
|
||||
extern const char *vblank_scheduler_str[];
|
||||
|
||||
/// Internal, private options for debugging and development use.
|
||||
struct debug_options {
|
||||
|
||||
@@ -227,9 +227,9 @@ void collect_vblank_interval_statistics(struct vblank_event *e, void *ud) {
|
||||
|
||||
void schedule_render(session_t *ps, bool triggered_by_vblank);
|
||||
|
||||
/// vblank callback scheduled by schedule_render.
|
||||
/// vblank callback scheduled by schedule_render, when a render is ongoing.
|
||||
///
|
||||
/// Check if previously queued render has finished, and record the time it took.
|
||||
/// Check if previously queued render has finished, and reschedule render if it has.
|
||||
void reschedule_render_at_vblank(struct vblank_event *e, void *ud) {
|
||||
auto ps = (session_t *)ud;
|
||||
assert(ps->frame_pacing);
|
||||
@@ -1675,8 +1675,7 @@ static bool redirect_start(session_t *ps) {
|
||||
scheduler_type =
|
||||
(enum vblank_scheduler_type)ps->o.debug_options.force_vblank_scheduler;
|
||||
}
|
||||
log_info("Using vblank scheduler: %s.",
|
||||
vblank_scheduler_type_str(scheduler_type));
|
||||
log_info("Using vblank scheduler: %s.", vblank_scheduler_str[scheduler_type]);
|
||||
ps->vblank_scheduler = vblank_scheduler_new(
|
||||
ps->loop, &ps->c, session_get_target_window(ps), scheduler_type);
|
||||
if (!ps->vblank_scheduler) {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <time.h>
|
||||
#include <xcb/xcb.h>
|
||||
#include <xcb/xproto.h>
|
||||
#include "config.h"
|
||||
|
||||
#ifdef CONFIG_OPENGL
|
||||
// Enable sgi_video_sync_vblank_scheduler
|
||||
@@ -526,4 +527,4 @@ bool vblank_handle_x_events(struct vblank_scheduler *self) {
|
||||
return fn(self);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user