diff options
| author | Simon Ser <contact@emersion.fr> | 2020-12-08 00:12:52 +0100 | 
|---|---|---|
| committer | Simon Ser <contact@emersion.fr> | 2020-12-08 18:57:11 +0100 | 
| commit | eb5886ddbebd5280b36fff7a5f4a356231b3dba1 (patch) | |
| tree | c090cd017ad9e7014d47ab7fa9e9d4fde2ca8188 /backend/headless/output.c | |
| parent | b790e5ea3479b0024c5bdd6ad5ad4f6fa46c89db (diff) | |
| download | wlroots-eb5886ddbebd5280b36fff7a5f4a356231b3dba1.tar.xz | |
backend/headless: add support for direct scan-out
I was about to add a check to fail instead of crash when the compositor
uses direct scan-out, but with renderer v6 it's so simple to just add
support for direct scan-out, why bother?
Closes: https://github.com/swaywm/wlroots/issues/2523
Diffstat (limited to 'backend/headless/output.c')
| -rw-r--r-- | backend/headless/output.c | 26 | 
1 files changed, 18 insertions, 8 deletions
diff --git a/backend/headless/output.c b/backend/headless/output.c index 8ce7a32b..bb15c23d 100644 --- a/backend/headless/output.c +++ b/backend/headless/output.c @@ -91,17 +91,27 @@ static bool output_commit(struct wlr_output *wlr_output) {  	}  	if (wlr_output->pending.committed & WLR_OUTPUT_STATE_BUFFER) { -		assert(output->back_buffer != NULL); - -		wlr_renderer_bind_buffer(output->backend->renderer, NULL); -		wlr_egl_unset_current(output->backend->egl); +		struct wlr_buffer *buffer = NULL; +		switch (wlr_output->pending.buffer_type) { +		case WLR_OUTPUT_STATE_BUFFER_RENDER: +			assert(output->back_buffer != NULL); + +			wlr_renderer_bind_buffer(output->backend->renderer, NULL); +			wlr_egl_unset_current(output->backend->egl); + +			buffer = output->back_buffer; +			output->back_buffer = NULL; +			break; +		case WLR_OUTPUT_STATE_BUFFER_SCANOUT: +			buffer = wlr_buffer_lock(wlr_output->pending.buffer); +			break; +		} +		assert(buffer != NULL);  		wlr_buffer_unlock(output->front_buffer); -		output->front_buffer = output->back_buffer; -		output->back_buffer = NULL; +		output->front_buffer = buffer; -		wlr_swapchain_set_buffer_submitted(output->swapchain, -			output->front_buffer); +		wlr_swapchain_set_buffer_submitted(output->swapchain, buffer);  		wlr_output_send_present(wlr_output, NULL);  	}  | 
