diff options
Diffstat (limited to 'video/out/wayland_common.h')
-rw-r--r-- | video/out/wayland_common.h | 215 |
1 files changed, 117 insertions, 98 deletions
diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h index 41edcf5d2f..7a2f31918e 100644 --- a/video/out/wayland_common.h +++ b/video/out/wayland_common.h @@ -19,145 +19,164 @@ #define MPLAYER_WAYLAND_COMMON_H #include <wayland-client.h> -#include <wayland-cursor.h> -#include <xkbcommon/xkbcommon.h> - -#include "vo.h" #include "input/event.h" +#include "vo.h" + +struct vo_wayland_seat; + +typedef struct { + uint32_t format; + uint32_t padding; + uint64_t modifier; +} wayland_format; struct wayland_opts { - int disable_vsync; + int configure_bounds; + int content_type; + bool disable_vsync; int edge_pixels_pointer; int edge_pixels_touch; }; -struct vo_wayland_sync { - int64_t ust; - int64_t msc; - int64_t sbc; - bool filled; -}; - -struct vo_wayland_output { - struct vo_wayland_state *wl; - uint32_t id; - struct wl_output *output; - struct mp_rect geometry; - int phys_width; - int phys_height; - int scale; - uint32_t flags; - double refresh_rate; - char *make; - char *model; - bool has_surface; - struct wl_list link; -}; - struct vo_wayland_state { - struct mp_log *log; - struct vo *vo; - struct wl_display *display; - struct wl_shm *shm; - struct wl_compositor *compositor; - struct wl_registry *registry; - struct wayland_opts *opts; - - struct m_config_cache *vo_opts_cache; - struct mp_vo_opts *vo_opts; + struct m_config_cache *vo_opts_cache; + struct mp_log *log; + struct mp_vo_opts *vo_opts; + struct vo *vo; + struct wayland_opts *opts; + struct wl_callback *frame_callback; + struct wl_compositor *compositor; + struct wl_subcompositor *subcompositor; + struct wl_display *display; + struct wl_registry *registry; + struct wl_shm *shm; + struct wl_surface *surface; + struct wl_surface *osd_surface; + struct wl_subsurface *osd_subsurface; + struct wl_surface *video_surface; + struct wl_surface *callback_surface; + struct wl_subsurface *video_subsurface; - /* State */ + /* Geometry */ struct mp_rect geometry; struct mp_rect window_size; - struct mp_rect vdparams; - int gcd; - int reduced_width; + struct wl_list output_list; + struct vo_wayland_output *current_output; + int bounded_height; + int bounded_width; int reduced_height; - bool frame_wait; - bool state_change; - bool toplevel_configured; + int reduced_width; + + /* State */ bool activated; - bool has_keyboard_input; bool focused; + bool frame_wait; + bool geometry_configured; bool hidden; - int timeout_count; - int wakeup_pipe[2]; - int pending_vo_events; + bool initial_size_hint; + bool locked_size; + bool need_rescale; + bool reconfigured; + bool scale_configured; + bool state_change; + bool tiled; + bool toplevel_configured; + int display_fd; int mouse_x; int mouse_y; - int mouse_unscaled_x; - int mouse_unscaled_y; - int scaling; - int touch_entries; - int toplevel_width; - int toplevel_height; - uint32_t pointer_id; - int display_fd; - struct wl_callback *frame_callback; - struct wl_list output_list; - struct vo_wayland_output *current_output; + int pending_vo_events; + double pending_scaling; + double scaling; + int timeout_count; + int wakeup_pipe[2]; - /* Shell */ - struct wl_surface *surface; - struct xdg_wm_base *wm_base; - struct xdg_toplevel *xdg_toplevel; - struct xdg_surface *xdg_surface; + /* content-type */ + /* TODO: unvoid these if required wayland protocols is bumped to 1.27+ */ + void *content_type_manager; + void *content_type; + int current_content_type; + + /* cursor-shape */ + /* TODO: unvoid these if required wayland protocols is bumped to 1.32+ */ + void *cursor_shape_manager; + + /* fractional-scale */ + /* TODO: unvoid these if required wayland protocols is bumped to 1.31+ */ + void *fractional_scale_manager; + void *fractional_scale; + + /* idle-inhibit */ + struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager; + struct zwp_idle_inhibitor_v1 *idle_inhibitor; + + /* linux-dmabuf */ + struct zwp_linux_dmabuf_v1 *dmabuf; + struct zwp_linux_dmabuf_feedback_v1 *dmabuf_feedback; + wayland_format *format_map; + uint32_t format_size; + + /* presentation-time */ struct wp_presentation *presentation; - struct wp_presentation_feedback *feedback; + struct vo_wayland_feedback_pool *fback_pool; + struct mp_present *present; + int64_t refresh_interval; + bool use_present; + + /* single-pixel-buffer */ + /* TODO: unvoid this if required wayland-protocols is bumped to 1.27+ */ + void *single_pixel_manager; + + /* xdg-decoration */ struct zxdg_decoration_manager_v1 *xdg_decoration_manager; struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration; - struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager; - struct zwp_idle_inhibitor_v1 *idle_inhibitor; + int requested_decoration; + + /* xdg-shell */ + struct xdg_wm_base *wm_base; + struct xdg_surface *xdg_surface; + struct xdg_toplevel *xdg_toplevel; - /* Presentation Feedback */ - struct vo_wayland_sync *sync; - int sync_size; - int64_t last_ust; - int64_t last_msc; - int64_t last_skipped_vsyncs; - int64_t last_queue_display_time; - int64_t vsync_duration; + /* viewporter */ + struct wp_viewporter *viewporter; + struct wp_viewport *viewport; + struct wp_viewport *cursor_viewport; + struct wp_viewport *osd_viewport; + struct wp_viewport *video_viewport; /* Input */ - uint32_t keyboard_code; - struct wl_seat *seat; - struct wl_pointer *pointer; - struct wl_touch *touch; - struct wl_keyboard *keyboard; + struct wl_list seat_list; struct xkb_context *xkb_context; - struct xkb_keymap *xkb_keymap; - struct xkb_state *xkb_state; /* DND */ struct wl_data_device_manager *dnd_devman; - struct wl_data_device *dnd_ddev; struct wl_data_offer *dnd_offer; - enum mp_dnd_action dnd_action; + int dnd_action; // actually enum mp_dnd_action char *dnd_mime_type; - int dnd_mime_score; int dnd_fd; + int dnd_mime_score; /* Cursor */ struct wl_cursor_theme *cursor_theme; struct wl_cursor *default_cursor; struct wl_surface *cursor_surface; - int allocated_cursor_scale; bool cursor_visible; + int allocated_cursor_scale; + struct vo_wayland_seat *last_button_seat; }; -int vo_wayland_init(struct vo *vo); -int vo_wayland_reconfig(struct vo *vo); +bool vo_wayland_check_visible(struct vo *vo); +bool vo_wayland_init(struct vo *vo); +bool vo_wayland_reconfig(struct vo *vo); + +int vo_wayland_allocate_memfd(struct vo *vo, size_t size); int vo_wayland_control(struct vo *vo, int *events, int request, void *arg); -int last_available_sync(struct vo_wayland_state *wl); -void vo_wayland_check_events(struct vo *vo); + +void vo_wayland_handle_scale(struct vo_wayland_state *wl); +void vo_wayland_set_opaque_region(struct vo_wayland_state *wl, bool alpha); +void vo_wayland_sync_swap(struct vo_wayland_state *wl); void vo_wayland_uninit(struct vo *vo); -void vo_wayland_wakeup(struct vo *vo); -void vo_wayland_wait_events(struct vo *vo, int64_t until_time_us); +void vo_wayland_wait_events(struct vo *vo, int64_t until_time_ns); void vo_wayland_wait_frame(struct vo_wayland_state *wl); -void vo_wayland_set_opaque_region(struct vo_wayland_state *wl, int alpha); -void vo_wayland_sync_clear(struct vo_wayland_state *wl); -void wayland_sync_swap(struct vo_wayland_state *wl); -void vo_wayland_sync_shift(struct vo_wayland_state *wl); -void queue_new_sync(struct vo_wayland_state *wl); +void vo_wayland_wakeup(struct vo *vo); #endif /* MPLAYER_WAYLAND_COMMON_H */ |