Skip to content

Commit

Permalink
Apply workarounds from mitchell-gil96 for nvidia
Browse files Browse the repository at this point in the history
  • Loading branch information
sandsmark committed Feb 24, 2021
1 parent ea6eebb commit 3007e64
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/backend/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
/// Apply driver specified global workarounds. It's safe to call this multiple times.
void apply_driver_workarounds(struct session *ps, enum driver driver) {
if (driver & DRIVER_NVIDIA) {
setenv("__GL_YIELD", "usleep", true);
setenv("__GL_MaxFramesAllowed", "1", true);
ps->o.xrender_sync_fence = true;
ps->o.glx_no_rebind_pixmap = true;
ps->o.vsync_use_glfinish = false;
}
}

Expand Down
7 changes: 6 additions & 1 deletion src/backend/gl/glx.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ struct _glx_data {
int screen;
xcb_window_t target_win;
GLXContext ctx;
bool useGLFinish;
};

#define glXGetFBConfigAttribChecked(a, b, attr, c) \
Expand Down Expand Up @@ -240,6 +241,7 @@ static backend_t *glx_init(session_t *ps) {
gd->display = ps->dpy;
gd->screen = ps->scr;
gd->target_win = session_get_target_window(ps);
gd->useGLFinish = ps->o.vsync_use_glfinish;

XVisualInfo *pvis = NULL;

Expand Down Expand Up @@ -466,7 +468,10 @@ static void glx_present(backend_t *base, const region_t *region attr_unused) {
struct _glx_data *gd = (void *)base;
gl_present(base, region);
glXSwapBuffers(gd->display, gd->target_win);
glFinish();

if (gd->useGLFinish) {
glFinish();
}
}

static int glx_buffer_age(backend_t *base) {
Expand Down

1 comment on commit 3007e64

@MitchMG2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was all kwand's idea. I just volunteered to be a lab rat and reported back.

Please sign in to comment.