Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
backend/x11: add support for adaptive_sync_enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
emersion committed Mar 2, 2020
1 parent 7b8540f commit 4813d1c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/x11/backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
{ .name = "WM_DELETE_WINDOW", .atom = &x11->atoms.wm_delete_window },
{ .name = "_NET_WM_NAME", .atom = &x11->atoms.net_wm_name },
{ .name = "UTF8_STRING", .atom = &x11->atoms.utf8_string },
{ .name = "_VARIABLE_REFRESH", .atom = &x11->atoms.variable_refresh },
};

for (size_t i = 0; i < sizeof(atom) / sizeof(atom[0]); ++i) {
Expand Down
13 changes: 13 additions & 0 deletions backend/x11/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,19 @@ static bool output_commit(struct wlr_output *wlr_output) {
}
}

if (wlr_output->pending.committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED &&
x11->atoms.variable_refresh != XCB_ATOM_NONE) {
if (wlr_output->pending.adaptive_sync_enabled) {
uint32_t enabled = 1;
xcb_change_property(x11->xcb, XCB_PROP_MODE_REPLACE, output->win,
x11->atoms.variable_refresh, XCB_ATOM_CARDINAL, 32, 1,
&enabled);
} else {
xcb_delete_property(x11->xcb, output->win,
x11->atoms.variable_refresh);
}
}

if (wlr_output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
pixman_region32_t *damage = NULL;
if (wlr_output->pending.committed & WLR_OUTPUT_STATE_DAMAGE) {
Expand Down
1 change: 1 addition & 0 deletions include/backend/x11.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ struct wlr_x11_backend {
xcb_atom_t wm_delete_window;
xcb_atom_t net_wm_name;
xcb_atom_t utf8_string;
xcb_atom_t variable_refresh;
} atoms;

// The time we last received an event
Expand Down

0 comments on commit 4813d1c

Please sign in to comment.