diff --git a/src/backend/driver.c b/src/backend/driver.c index 3be7215693..f17743a4aa 100644 --- a/src/backend/driver.c +++ b/src/backend/driver.c @@ -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; diff --git a/src/common.h b/src/common.h index 6876c24a72..273e399188 100644 --- a/src/common.h +++ b/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 === diff --git a/src/config.c b/src/config.c index 37dc4586d8..076fe1ec62 100644 --- a/src/config.c +++ b/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; } diff --git a/src/config.h b/src/config.h index 226a692c54..0a736d3faf 100644 --- a/src/config.h +++ b/src/config.h @@ -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 { diff --git a/src/picom.c b/src/picom.c index 78faf846e3..bdf4bbc028 100644 --- a/src/picom.c +++ b/src/picom.c @@ -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) { diff --git a/src/vblank.c b/src/vblank.c index cbfc18c187..fb9b0672f9 100644 --- a/src/vblank.c +++ b/src/vblank.c @@ -7,6 +7,7 @@ #include #include #include +#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; -} \ No newline at end of file +}