output: introduce wlr_output_group

An output group is an output implementation that contains one or more
separate outputs as children. The children can be grouped together to
turn into one big output (for a tiled display).

Updates:
- use upstream src_box/dst_box
- provide wlr_backend_impl, set features.timeline=true if all children
  have it
- fix output destroy (happens on vt switch) by properly removing output
  from group registry
- add output->impl->test because otherwise trying direct scan out can
  fail and stop updating the screen (scene_entry_try_direct_scanout)
- use wlr_output_finish() on destroy
- remove output->impl->get_buffer_caps (but keep the logic that
  buffer_caps is the intersection of all children)
This commit is contained in:
EBADBEEF 2023-05-30 19:39:48 -07:00
parent a1ddc25b45
commit cbf921ccbb
3 changed files with 731 additions and 0 deletions

View file

@ -0,0 +1,63 @@
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_OUTPUT_GROUP_H
#define WLR_TYPES_WLR_OUTPUT_GROUP_H
#include <stdint.h>
#include <wlr/types/wlr_output_group.h>
#include <wlr/types/wlr_output.h>
#include <wlr/render/drm_format_set.h>
#include <wlr/util/box.h>
#include <wlr/backend.h>
struct wlr_output_group_tile_info {
uint32_t group_id;
uint32_t is_single_monitor;
uint32_t num_h;
uint32_t num_v;
uint32_t h_loc;
uint32_t v_loc;
uint32_t h_size;
uint32_t v_size;
};
struct wlr_output_group_child {
struct wlr_output *output;
struct wlr_output_group *group;
struct wlr_fbox src_box;
struct wlr_box dst_box;
struct wlr_output_group_tile_info tile_info;
uint32_t index;
struct wlr_output_mode *tiled_mode;
struct wl_listener present;
struct wl_listener frame;
struct wl_listener needs_frame;
struct wl_listener output_destroy;
struct wl_list link;
};
struct wlr_output_group {
struct wlr_output output;
/* private data below */
int queued_frame_count;
int num_children;
struct wlr_output_mode *tiled_mode;
struct wl_list children; //wlr_output_group_child.link
struct wl_list mirrors; //wlr_output_group_child.link
struct wlr_drm_format_set cursor_formats;
struct wlr_drm_format_set primary_formats;
struct wl_event_source *ready;
struct wl_list link;
struct wlr_backend backend;
struct wlr_output_cursor_size *cursor_sizes;
size_t cursor_sizes_len;
};
struct wlr_output_group *wlr_output_group_create(void);
struct wlr_output_group *wlr_output_group_match_tile(struct wlr_output_group_tile_info *tile_info);
void wlr_output_group_add_tile(struct wlr_output_group *group, struct wlr_output *output,
struct wlr_output_group_tile_info *tile_info);
#endif