diff options
author | Simon Ser <contact@emersion.fr> | 2019-07-18 21:38:12 +0300 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-08-02 10:01:29 -0400 |
commit | ee5f98ad49fed0439f3313ec685307831d1d1d05 (patch) | |
tree | 13df7c4d845fd586e62e39a47e0af6bf60376a0d /backend/x11 | |
parent | d20aee6c9de12c8949b4ce7775b53dbc5f3896a6 (diff) |
output: atomic mode, enabled, scale and transform
This commit makes more output properties (mode, enabled, scale and transform)
atomic. This means that they are double-buffered and only applied on commit.
Compositors now need to call wlr_output_commit after setting any of those
properties.
Internally, backends still apply properties sequentially. The behaviour should
be exactly the same as before. Future commits will update some backends to take
advantage of the atomic interface. Some backends are non-atomic by design, e.g.
the X11 backend or the legacy DRM backend.
Updates: https://github.com/swaywm/wlroots/issues/1640
Diffstat (limited to 'backend/x11')
-rw-r--r-- | backend/x11/output.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/backend/x11/output.c b/backend/x11/output.c index 1307f785..7194d7fb 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -103,21 +103,38 @@ static bool output_commit(struct wlr_output *wlr_output) { struct wlr_x11_output *output = get_x11_output_from_output(wlr_output); struct wlr_x11_backend *x11 = output->x11; - pixman_region32_t *damage = NULL; - if (wlr_output->pending.committed & WLR_OUTPUT_STATE_DAMAGE) { - damage = &wlr_output->pending.damage; + if (wlr_output->pending.committed & WLR_OUTPUT_STATE_ENABLED) { + wlr_log(WLR_DEBUG, "Cannot disable an X11 output"); + return false; } - if (!wlr_egl_swap_buffers(&x11->egl, output->surf, damage)) { - return false; + if (wlr_output->pending.committed & WLR_OUTPUT_STATE_MODE) { + assert(wlr_output->pending.mode_type == WLR_OUTPUT_STATE_MODE_CUSTOM); + if (!output_set_custom_mode(wlr_output, + wlr_output->pending.custom_mode.width, + wlr_output->pending.custom_mode.height, + wlr_output->pending.custom_mode.refresh)) { + return false; + } + } + + if (wlr_output->pending.committed & WLR_OUTPUT_STATE_BUFFER) { + pixman_region32_t *damage = NULL; + if (wlr_output->pending.committed & WLR_OUTPUT_STATE_DAMAGE) { + damage = &wlr_output->pending.damage; + } + + if (!wlr_egl_swap_buffers(&x11->egl, output->surf, damage)) { + return false; + } + + wlr_output_send_present(wlr_output, NULL); } - wlr_output_send_present(wlr_output, NULL); return true; } static const struct wlr_output_impl output_impl = { - .set_custom_mode = output_set_custom_mode, .destroy = output_destroy, .attach_render = output_attach_render, .commit = output_commit, |