From 5d1ba0f44687f49cd28fcd8f69abac3cb0e07eb8 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 16 Aug 2019 19:41:56 +0300 Subject: 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) --- backend/rdp/output.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'backend/rdp/output.c') diff --git a/backend/rdp/output.c b/backend/rdp/output.c index 302a99de..3043d2c8 100644 --- a/backend/rdp/output.c +++ b/backend/rdp/output.c @@ -166,9 +166,9 @@ static bool nsc_swap_buffers( return true; } -static bool output_commit(struct wlr_output *wlr_output) { - struct wlr_rdp_output *output = - rdp_output_from_output(wlr_output); +static bool output_commit_buffer(struct wlr_rdp_output *output) { + struct wlr_output *wlr_output = &output->wlr_output; + bool ret = false; pixman_region32_t output_region; @@ -220,6 +220,33 @@ out: return ret; } +static bool output_commit(struct wlr_output *wlr_output) { + struct wlr_rdp_output *output = rdp_output_from_output(wlr_output); + + if (wlr_output->pending.committed & WLR_OUTPUT_STATE_ENABLED) { + wlr_log(WLR_DEBUG, "Cannot disable an RDP output"); + 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) { + if (!output_commit_buffer(output)) { + return false; + } + } + + return true; +} + static void output_destroy(struct wlr_output *wlr_output) { struct wlr_rdp_output *output = rdp_output_from_output(wlr_output); @@ -234,7 +261,6 @@ static void output_destroy(struct wlr_output *wlr_output) { } 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, -- cgit v1.2.3