diff options
author | Simon Ser <contact@emersion.fr> | 2019-08-16 19:41:56 +0300 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-12-30 11:21:11 -0700 |
commit | 5d1ba0f44687f49cd28fcd8f69abac3cb0e07eb8 (patch) | |
tree | c4adad72451ca45b37163a5d8eddbdf6677caa6a /backend/drm | |
parent | e0e5a167ed4bf4be85e1db6565cf169c5c84d9ec (diff) |
output: re-introduce atomic mode, enabled, scale and transform
This reverts commit 01f903874b7e27539488fad7f31476d5bcbc6ac9 and re-applies
commit ee5f98ad49fed0439f3313ec685307831d1d1d05.
Updates: https://github.com/swaywm/wlroots/issues/1640 (Atomic output updates issue)
See also: https://github.com/swaywm/wlroots/pull/1762 (Atomic output updates original PR)
See also: https://github.com/swaywm/wlroots/issues/1780 (Issue caused by atomic output updates)
See also: https://github.com/swaywm/sway/issues/4419 (Issue caused by atomic output updates)
See also: https://github.com/swaywm/wlroots/pull/1781 (Revert PR)
Diffstat (limited to 'backend/drm')
-rw-r--r-- | backend/drm/drm.c | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c index a4f22590..60c9e44c 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -334,12 +334,9 @@ static bool drm_connector_attach_render(struct wlr_output *output, return make_drm_surface_current(&conn->crtc->primary->surf, buffer_age); } -static bool drm_connector_commit(struct wlr_output *output) { +static bool drm_connector_commit_buffer(struct wlr_output *output) { struct wlr_drm_connector *conn = get_drm_connector_from_output(output); struct wlr_drm_backend *drm = get_drm_backend_from_backend(output->backend); - if (!drm->session->active) { - return false; - } struct wlr_drm_crtc *crtc = conn->crtc; if (!crtc) { @@ -415,6 +412,49 @@ static bool drm_connector_commit(struct wlr_output *output) { return true; } +static bool drm_connector_set_custom_mode(struct wlr_output *output, + int32_t width, int32_t height, int32_t refresh); + +static bool drm_connector_commit(struct wlr_output *output) { + struct wlr_drm_backend *drm = get_drm_backend_from_backend(output->backend); + + if (!drm->session->active) { + return false; + } + + if (output->pending.committed & WLR_OUTPUT_STATE_ENABLED) { + if (!enable_drm_connector(output, output->pending.enabled)) { + return false; + } + } + + if (output->pending.committed & WLR_OUTPUT_STATE_MODE) { + switch (output->pending.mode_type) { + case WLR_OUTPUT_STATE_MODE_FIXED: + if (!drm_connector_set_mode(output, output->pending.mode)) { + return false; + } + break; + case WLR_OUTPUT_STATE_MODE_CUSTOM: + if (!drm_connector_set_custom_mode(output, + output->pending.custom_mode.width, + output->pending.custom_mode.height, + output->pending.custom_mode.refresh)) { + return false; + } + break; + } + } + + if (output->pending.committed & WLR_OUTPUT_STATE_BUFFER) { + if (!drm_connector_commit_buffer(output)) { + return false; + } + } + + return true; +} + static void fill_empty_gamma_table(size_t size, uint16_t *r, uint16_t *g, uint16_t *b) { for (uint32_t i = 0; i < size; ++i) { @@ -1002,9 +1042,6 @@ static void drm_connector_destroy(struct wlr_output *output) { } static const struct wlr_output_impl output_impl = { - .enable = enable_drm_connector, - .set_mode = drm_connector_set_mode, - .set_custom_mode = drm_connector_set_custom_mode, .set_cursor = drm_connector_set_cursor, .move_cursor = drm_connector_move_cursor, .destroy = drm_connector_destroy, |