mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-02-07 04:06:14 -05:00
Merge branch 'commit_queue_v1' into 'master'
fifo-v1: new protocol implementation See merge request wlroots/wlroots!4463
This commit is contained in:
commit
85e803c73f
9 changed files with 559 additions and 4 deletions
|
|
@ -6,6 +6,11 @@
|
|||
|
||||
static const long NSEC_PER_SEC = 1000000000;
|
||||
|
||||
/**
|
||||
* Get the current time, in nanoseconds.
|
||||
*/
|
||||
int64_t get_current_time_nsec(void);
|
||||
|
||||
/**
|
||||
* Get the current time, in milliseconds.
|
||||
*/
|
||||
|
|
|
|||
107
include/wlr/types/wlr_fifo_v1.h
Normal file
107
include/wlr/types/wlr_fifo_v1.h
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* 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_FIFO_V1_H
|
||||
#define WLR_TYPES_WLR_FIFO_V1_H
|
||||
|
||||
#include <wayland-server-core.h>
|
||||
|
||||
#include <wlr/types/wlr_compositor.h>
|
||||
#include <wlr/types/wlr_scene.h>
|
||||
|
||||
struct wlr_fifo_manager_v1_new_fifo_event {
|
||||
struct wlr_fifo_v1 *fifo;
|
||||
};
|
||||
|
||||
struct wlr_fifo_manager_v1 {
|
||||
struct wl_global *global;
|
||||
struct wl_display *display;
|
||||
|
||||
struct {
|
||||
struct wl_signal new_fifo; // struct wlr_fifo_manager_v1_new_fifo_event
|
||||
|
||||
/**
|
||||
* Signals that the fifo manager is being destroyed.
|
||||
*/
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
struct {
|
||||
struct wl_listener display_destroy;
|
||||
} WLR_PRIVATE;
|
||||
};
|
||||
|
||||
struct wlr_fifo_v1_state {
|
||||
/*
|
||||
* This field is used to set the fifo barrier on the surface.
|
||||
* Set when the client makes a .set_barrier request. */
|
||||
bool set_barrier;
|
||||
/*
|
||||
* This field is used to lock a commit until the fifo barrier on the surface is cleared.
|
||||
* Set when the client makes a .wait_barrier request. */
|
||||
bool wait_barrier;
|
||||
};
|
||||
|
||||
struct wlr_fifo_v1 {
|
||||
struct wlr_fifo_manager_v1 *manager;
|
||||
|
||||
struct wl_resource *resource;
|
||||
struct wlr_addon addon;
|
||||
|
||||
struct wlr_surface *surface;
|
||||
struct wlr_output *output;
|
||||
|
||||
// list of commit requests waiting on the fifo barrier
|
||||
struct wl_list commits; // fifo_commit.link
|
||||
|
||||
// per-commit state used with the wlr_surface_synced mechanism
|
||||
struct wlr_fifo_v1_state current, pending;
|
||||
|
||||
// per-wlr_fifo_v1 instance state
|
||||
bool barrier_set;
|
||||
uint64_t last_output_present_nsec;
|
||||
bool surface_occluded_source_armed;
|
||||
|
||||
struct {
|
||||
/**
|
||||
* Signals that the fifo object is being destroyed.
|
||||
*/
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
struct {
|
||||
struct wl_listener surface_client_commit;
|
||||
struct wl_listener surface_commit;
|
||||
struct wl_listener output_present;
|
||||
struct wl_listener output_destroy;
|
||||
struct wl_listener fifo_manager_destroy;
|
||||
|
||||
// used to advance the queue when the surface is occluded
|
||||
struct wl_event_source *surface_occluded_source;
|
||||
|
||||
struct wlr_surface_synced synced;
|
||||
} WLR_PRIVATE;
|
||||
|
||||
struct wl_list link; // wlr_scene.fifo_surfaces
|
||||
};
|
||||
|
||||
/**
|
||||
* Create the wp_fifo_manager_v1_interface global, which can be used by clients to
|
||||
* queue commits on a wl_surface for presentation.
|
||||
*/
|
||||
struct wlr_fifo_manager_v1 *wlr_fifo_manager_v1_create(struct wl_display *display,
|
||||
uint32_t version);
|
||||
|
||||
/**
|
||||
* Used to set the output to which the fifo will be applied.
|
||||
* If output is NULL, the fifo will be unset for a previously set output.
|
||||
* Returns true on success, false on failure.
|
||||
*/
|
||||
void wlr_fifo_v1_set_output(struct wlr_fifo_v1 *fifo, struct wlr_output *output);
|
||||
|
||||
#endif
|
||||
|
|
@ -104,6 +104,7 @@ struct wlr_scene {
|
|||
struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1;
|
||||
struct wlr_gamma_control_manager_v1 *gamma_control_manager_v1;
|
||||
struct wlr_color_manager_v1 *color_manager_v1;
|
||||
struct wlr_fifo_manager_v1 *fifo_manager_v1;
|
||||
|
||||
bool restack_xwayland_surfaces;
|
||||
|
||||
|
|
@ -112,6 +113,8 @@ struct wlr_scene {
|
|||
struct wl_listener gamma_control_manager_v1_destroy;
|
||||
struct wl_listener gamma_control_manager_v1_set_gamma;
|
||||
struct wl_listener color_manager_v1_destroy;
|
||||
struct wl_listener fifo_manager_v1_destroy;
|
||||
struct wl_listener fifo_manager_v1_new_fifo;
|
||||
|
||||
enum wlr_scene_debug_damage_option debug_damage_option;
|
||||
bool direct_scanout;
|
||||
|
|
@ -125,6 +128,8 @@ struct wlr_scene_surface {
|
|||
struct wlr_scene_buffer *buffer;
|
||||
struct wlr_surface *surface;
|
||||
|
||||
struct wlr_fifo_v1 *fifo;
|
||||
|
||||
struct {
|
||||
struct wlr_box clip;
|
||||
|
||||
|
|
@ -137,6 +142,7 @@ struct wlr_scene_surface {
|
|||
struct wl_listener frame_done;
|
||||
struct wl_listener surface_destroy;
|
||||
struct wl_listener surface_commit;
|
||||
struct wl_listener fifo_v1_destroy;
|
||||
} WLR_PRIVATE;
|
||||
};
|
||||
|
||||
|
|
@ -381,6 +387,12 @@ void wlr_scene_set_gamma_control_manager_v1(struct wlr_scene *scene,
|
|||
*/
|
||||
void wlr_scene_set_color_manager_v1(struct wlr_scene *scene, struct wlr_color_manager_v1 *manager);
|
||||
|
||||
/**
|
||||
* Handles fifo_v1 for all surfaces and their primary outputs in the scene.
|
||||
*/
|
||||
void wlr_scene_set_fifo_manager_v1(struct wlr_scene *scene,
|
||||
struct wlr_fifo_manager_v1 *fifo_manager);
|
||||
|
||||
/**
|
||||
* Add a node displaying nothing but its children.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue