mirror of
https://github.com/yshui/picom.git
synced 2024-11-11 13:51:02 -05:00
driver: choose sgi_video_sync scheduler for NVIDIA
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
b582d2989e
commit
a28e221b83
3 changed files with 17 additions and 5 deletions
|
@ -19,6 +19,13 @@ void apply_driver_workarounds(struct session *ps, enum driver driver) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum vblank_scheduler_type choose_vblank_scheduler(enum driver driver) {
|
||||||
|
if (driver & DRIVER_NVIDIA) {
|
||||||
|
return VBLANK_SCHEDULER_SGI_VIDEO_SYNC;
|
||||||
|
}
|
||||||
|
return VBLANK_SCHEDULER_PRESENT;
|
||||||
|
}
|
||||||
|
|
||||||
enum driver detect_driver(xcb_connection_t *c, backend_t *backend_data, xcb_window_t window) {
|
enum driver detect_driver(xcb_connection_t *c, backend_t *backend_data, xcb_window_t window) {
|
||||||
enum driver ret = 0;
|
enum driver ret = 0;
|
||||||
// First we try doing backend agnostic detection using RANDR
|
// First we try doing backend agnostic detection using RANDR
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
struct session;
|
struct session;
|
||||||
|
@ -41,6 +42,8 @@ enum driver detect_driver(xcb_connection_t *, struct backend_base *, xcb_window_
|
||||||
|
|
||||||
/// Apply driver specified global workarounds. It's safe to call this multiple times.
|
/// Apply driver specified global workarounds. It's safe to call this multiple times.
|
||||||
void apply_driver_workarounds(struct session *ps, enum driver);
|
void apply_driver_workarounds(struct session *ps, enum driver);
|
||||||
|
/// Choose a vblank scheduler based on the driver.
|
||||||
|
enum vblank_scheduler_type choose_vblank_scheduler(enum driver driver);
|
||||||
|
|
||||||
// Print driver names to stdout, for diagnostics
|
// Print driver names to stdout, for diagnostics
|
||||||
static inline void print_drivers(enum driver drivers) {
|
static inline void print_drivers(enum driver drivers) {
|
||||||
|
|
12
src/picom.c
12
src/picom.c
|
@ -1493,6 +1493,10 @@ static bool redirect_start(session_t *ps) {
|
||||||
ps->frame_pacing = false;
|
ps->frame_pacing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Re-detect driver since we now have a backend
|
||||||
|
ps->drivers = detect_driver(ps->c.c, ps->backend_data, ps->c.screen_info->root);
|
||||||
|
apply_driver_workarounds(ps, ps->drivers);
|
||||||
|
|
||||||
if (ps->present_exists && ps->frame_pacing) {
|
if (ps->present_exists && ps->frame_pacing) {
|
||||||
// Initialize rendering and frame timing statistics, and frame pacing
|
// Initialize rendering and frame timing statistics, and frame pacing
|
||||||
// states.
|
// states.
|
||||||
|
@ -1500,11 +1504,13 @@ static bool redirect_start(session_t *ps) {
|
||||||
ps->last_msc = 0;
|
ps->last_msc = 0;
|
||||||
ps->last_schedule_delay = 0;
|
ps->last_schedule_delay = 0;
|
||||||
render_statistics_reset(&ps->render_stats);
|
render_statistics_reset(&ps->render_stats);
|
||||||
enum vblank_scheduler_type scheduler_type = VBLANK_SCHEDULER_PRESENT;
|
enum vblank_scheduler_type scheduler_type =
|
||||||
|
choose_vblank_scheduler(ps->drivers);
|
||||||
if (ps->o.debug_options.force_vblank_scheduler != LAST_VBLANK_SCHEDULER) {
|
if (ps->o.debug_options.force_vblank_scheduler != LAST_VBLANK_SCHEDULER) {
|
||||||
scheduler_type =
|
scheduler_type =
|
||||||
(enum vblank_scheduler_type)ps->o.debug_options.force_vblank_scheduler;
|
(enum vblank_scheduler_type)ps->o.debug_options.force_vblank_scheduler;
|
||||||
}
|
}
|
||||||
|
log_info("Using vblank scheduler: %s.", vblank_scheduler_str[scheduler_type]);
|
||||||
ps->vblank_scheduler = vblank_scheduler_new(
|
ps->vblank_scheduler = vblank_scheduler_new(
|
||||||
ps->loop, &ps->c, session_get_target_window(ps), scheduler_type);
|
ps->loop, &ps->c, session_get_target_window(ps), scheduler_type);
|
||||||
if (!ps->vblank_scheduler) {
|
if (!ps->vblank_scheduler) {
|
||||||
|
@ -1523,10 +1529,6 @@ static bool redirect_start(session_t *ps) {
|
||||||
ps->redirected = true;
|
ps->redirected = true;
|
||||||
ps->first_frame = true;
|
ps->first_frame = true;
|
||||||
|
|
||||||
// Re-detect driver since we now have a backend
|
|
||||||
ps->drivers = detect_driver(ps->c.c, ps->backend_data, ps->c.screen_info->root);
|
|
||||||
apply_driver_workarounds(ps, ps->drivers);
|
|
||||||
|
|
||||||
root_damaged(ps);
|
root_damaged(ps);
|
||||||
|
|
||||||
// Repaint the whole screen
|
// Repaint the whole screen
|
||||||
|
|
Loading…
Reference in a new issue