From fef8ab22e3bc8e073b63ec2cc612d91d8b81a9f6 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 21 Feb 2023 18:12:05 +0100 Subject: output: introduce wlr_output_configure_primary_swapchain() The goal is to simplify wlr_output by moving all of its rendering API into separate helpers. Here is a first step to sunset wlr_output_attach_render(). Instead, compositors call wlr_output_configure_primary_swapchain(), wlr_swapchain_acquire(), wlr_renderer_begin_with_buffer() and wlr_output_attach_buffer(). Note that compositors can supply a base struct wlr_output_state. This is useful to allocate a buffer suitable for submission with a modeset, for instance. Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3079 References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3197 References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3984 --- include/wlr/types/wlr_output.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/wlr') diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 9ea1188f..bd379444 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -563,6 +563,20 @@ void wlr_output_state_set_buffer(struct wlr_output_state *state, struct wlr_buffer *buffer); +/** + * Re-configure the swapchain as required for the output's primary buffer. + * + * If a NULL swapchain is passed in, a new swapchain is allocated. If the + * swapchain is already suitable for the output's primary buffer, this function + * is a no-op. + * + * The state describes the output changes the swapchain's buffers will be + * committed with. A NULL state indicates no change. + */ +bool wlr_output_configure_primary_swapchain(struct wlr_output *output, + const struct wlr_output_state *state, struct wlr_swapchain **swapchain); + + /** * Returns the transform that, when composed with `tr`, gives * `WL_OUTPUT_TRANSFORM_NORMAL`. -- cgit v1.2.3