Skip to content
Snippets Groups Projects
Commit 4e292fb4 authored by Simon Ser's avatar Simon Ser
Browse files

wip: Add wlr_output_layer

This is based on previous work [1] [2].

This new API allows compositors to display buffers without needing to
perform rendering operations. This API can be implemented on Wayland
using subsurfaces and on DRM using KMS planes.

Compared to [1], this approach leverages wlr_addon_set to let backends
attach their own private state to layers, and removes the pending
state (necessary for interop with wlr_output_commit_state()).

[1]: wlroots/wlroots!1985
[2]: wlroots/wlroots!3447
parent 517ea218
No related branches found
No related tags found
No related merge requests found
Pipeline #624430 passed
......@@ -59,6 +59,7 @@ enum wlr_output_state_field {
WLR_OUTPUT_STATE_GAMMA_LUT = 1 << 7,
WLR_OUTPUT_STATE_RENDER_FORMAT = 1 << 8,
WLR_OUTPUT_STATE_SUBPIXEL = 1 << 9,
WLR_OUTPUT_STATE_LAYERS = 1 << 10,
};
enum wlr_output_state_mode_type {
......@@ -93,6 +94,10 @@ struct wlr_output_state {
// only valid if WLR_OUTPUT_STATE_GAMMA_LUT
uint16_t *gamma_lut;
size_t gamma_lut_size;
// only valid if WLR_OUTPUT_STATE_LAYERS
struct wlr_output_layer_state *layers;
size_t layers_len;
};
struct wlr_output_impl;
......@@ -181,6 +186,8 @@ struct wlr_output {
struct wlr_buffer *cursor_front_buffer;
int software_cursor_locks; // number of locks forcing software cursors
struct wl_list layers; // wlr_output_layer.link
struct wlr_allocator *allocator;
struct wlr_renderer *renderer;
struct wlr_swapchain *swapchain;
......
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_OUTPUT_LAYER_H
#define WLR_TYPES_WLR_OUTPUT_LAYER_H
#include <wlr/types/wlr_output.h>
#include <wlr/util/addon.h>
struct wlr_output_layer {
struct wl_list link; // wlr_output.layers
struct wlr_addon_set addons;
void *data;
};
enum wlr_output_layer_state_field {
WLR_OUTPUT_LAYER_STATE_BUFFER = 1 << 0,
WLR_OUTPUT_LAYER_STATE_POSITION = 1 << 1,
};
struct wlr_output_layer_state {
struct wlr_output_layer *layer;
uint32_t committed; // bitfield of enum wlr_output_layer_state_field
struct wlr_buffer *buffer;
int x, y;
};
struct wlr_output_layer *wlr_output_create_layer(struct wlr_output *output);
void wlr_output_layer_destroy(struct wlr_output_layer *layer);
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment