mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
backend/x11: report adaptive sync as enabled
All we can do to influence adaptive sync on the X11 backend is set the _VARIABLE_REFRESH window property like mesa automatically does. We don't have any control beyond that, so we set the state to enabled on creating the output and never allow changing it (just like the Wayland backend).
This commit is contained in:
parent
2ec27d23e0
commit
135e60ff82
1 changed files with 17 additions and 15 deletions
|
@ -113,6 +113,17 @@ static bool output_test(struct wlr_output *wlr_output,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// All we can do to influence adaptive sync on the X11 backend is set the
|
||||||
|
// _VARIABLE_REFRESH window property like mesa automatically does. We don't
|
||||||
|
// have any control beyond that, so we set the state to enabled on creating
|
||||||
|
// the output and never allow changing it (just like the Wayland backend).
|
||||||
|
assert(wlr_output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED);
|
||||||
|
if (state->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED) {
|
||||||
|
if (!state->adaptive_sync_enabled) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (state->committed & WLR_OUTPUT_STATE_MODE) {
|
if (state->committed & WLR_OUTPUT_STATE_MODE) {
|
||||||
assert(state->mode_type == WLR_OUTPUT_STATE_MODE_CUSTOM);
|
assert(state->mode_type == WLR_OUTPUT_STATE_MODE_CUSTOM);
|
||||||
}
|
}
|
||||||
|
@ -335,21 +346,6 @@ static bool output_commit(struct wlr_output *wlr_output,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state->committed & WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED &&
|
|
||||||
x11->atoms.variable_refresh != XCB_ATOM_NONE) {
|
|
||||||
if (state->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);
|
|
||||||
wlr_output->adaptive_sync_status = WLR_OUTPUT_ADAPTIVE_SYNC_UNKNOWN;
|
|
||||||
} else {
|
|
||||||
xcb_delete_property(x11->xcb, output->win,
|
|
||||||
x11->atoms.variable_refresh);
|
|
||||||
wlr_output->adaptive_sync_status = WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state->committed & WLR_OUTPUT_STATE_BUFFER) {
|
if (state->committed & WLR_OUTPUT_STATE_BUFFER) {
|
||||||
if (!output_commit_buffer(output, state)) {
|
if (!output_commit_buffer(output, state)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -574,6 +570,12 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) {
|
||||||
x11->atoms.wm_protocols, XCB_ATOM_ATOM, 32, 1,
|
x11->atoms.wm_protocols, XCB_ATOM_ATOM, 32, 1,
|
||||||
&x11->atoms.wm_delete_window);
|
&x11->atoms.wm_delete_window);
|
||||||
|
|
||||||
|
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);
|
||||||
|
wlr_output->adaptive_sync_status = WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED;
|
||||||
|
|
||||||
wlr_x11_output_set_title(wlr_output, NULL);
|
wlr_x11_output_set_title(wlr_output, NULL);
|
||||||
|
|
||||||
xcb_map_window(x11->xcb, output->win);
|
xcb_map_window(x11->xcb, output->win);
|
||||||
|
|
Loading…
Reference in a new issue