Skip to content

Commit

Permalink
driver: allow apply_driver_workaround to set options
Browse files Browse the repository at this point in the history
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
  • Loading branch information
yshui committed Apr 22, 2020
1 parent 0efdb6c commit adeb09b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/backend/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "log.h"

/// 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) {
setenv("__GL_YIELD", "usleep", true);
}
Expand Down
2 changes: 1 addition & 1 deletion src/backend/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ enum driver {
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.
void apply_driver_workarounds(enum driver);
void apply_driver_workarounds(struct session *ps, enum driver);

// Print driver names to stdout, for diagnostics
static inline void print_drivers(enum driver drivers) {
Expand Down
9 changes: 2 additions & 7 deletions src/picom.c
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ static bool redirect_start(session_t *ps) {

// Re-detect driver since we now have a backend
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);

Expand Down Expand Up @@ -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);
apply_driver_workarounds(ps->drivers);
apply_driver_workarounds(ps, ps->drivers);

// Initialize filters, must be preceded by OpenGL context creation
if (!ps->o.experimental_backends && !init_render(ps)) {
Expand Down

0 comments on commit adeb09b

Please sign in to comment.