driver: allow apply_driver_workaround to set options

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2020-04-22 20:13:18 +01:00
parent 0efdb6c2d9
commit adeb09b775
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
3 changed files with 4 additions and 9 deletions

View File

@ -13,7 +13,7 @@
#include "log.h" #include "log.h"
/// 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(enum driver driver) { void apply_driver_workarounds(struct session *ps, enum driver driver) {
if (driver & DRIVER_NVIDIA) { if (driver & DRIVER_NVIDIA) {
setenv("__GL_YIELD", "usleep", true); setenv("__GL_YIELD", "usleep", true);
} }

View File

@ -33,7 +33,7 @@ enum driver {
enum driver detect_driver(xcb_connection_t *, struct backend_base *, xcb_window_t); enum driver detect_driver(xcb_connection_t *, struct backend_base *, xcb_window_t);
/// 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(enum driver); void apply_driver_workarounds(struct session *ps, enum 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) {

View File

@ -1224,7 +1224,7 @@ static bool redirect_start(session_t *ps) {
// Re-detect driver since we now have a backend // Re-detect driver since we now have a backend
ps->drivers = detect_driver(ps->c, ps->backend_data, ps->root); ps->drivers = detect_driver(ps->c, ps->backend_data, ps->root);
apply_driver_workarounds(ps->drivers); apply_driver_workarounds(ps, ps->drivers);
root_damaged(ps); root_damaged(ps);
@ -1960,13 +1960,8 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
} }
} }
// Target window must be initialized before the backend
//
// backend_operations::present == NULL means this backend doesn't need a target
// window; non experimental backends always need a target window
ps->drivers = detect_driver(ps->c, ps->backend_data, ps->root); ps->drivers = detect_driver(ps->c, ps->backend_data, ps->root);
apply_driver_workarounds(ps->drivers); apply_driver_workarounds(ps, ps->drivers);
// Initialize filters, must be preceded by OpenGL context creation // Initialize filters, must be preceded by OpenGL context creation
if (!ps->o.experimental_backends && !init_render(ps)) { if (!ps->o.experimental_backends && !init_render(ps)) {