Merge gitlab.freedesktop.org:wlroots/wlroots

This commit is contained in:
Christian Kröner 2022-08-30 21:25:19 +02:00
commit 26f6fab4eb
275 changed files with 7472 additions and 5463 deletions

View file

@ -58,6 +58,7 @@ struct wlr_drm_backend {
const struct wlr_drm_interface *iface;
clockid_t clock;
bool addfb2_modifiers;
struct udev_hwdb *hwdb;
int fd;
char *name;
@ -89,15 +90,6 @@ struct wlr_drm_backend {
struct wlr_drm_format_set mgpu_formats;
};
enum wlr_drm_connector_status {
// Connector is available but no output is plugged in
WLR_DRM_CONN_DISCONNECTED,
// An output just has been plugged in and is waiting for a modeset
WLR_DRM_CONN_NEEDS_MODESET,
WLR_DRM_CONN_CLEANUP,
WLR_DRM_CONN_CONNECTED,
};
struct wlr_drm_mode {
struct wlr_output_mode wlr_mode;
drmModeModeInfo drm_mode;
@ -115,9 +107,10 @@ struct wlr_drm_connector {
struct wlr_drm_backend *backend;
char name[24];
enum wlr_drm_connector_status status;
drmModeConnection status;
bool desired_enabled;
uint32_t id;
uint64_t max_bpc;
struct wlr_drm_lease *lease;
struct wlr_drm_crtc *crtc;

View file

@ -21,6 +21,8 @@ union wlr_drm_connector_props {
uint32_t non_desktop;
uint32_t panel_orientation; // not guaranteed to exist
uint32_t tile;
uint32_t content_type; // not guaranteed to exist
uint32_t max_bpc; // not guaranteed to exist
// atomic-modesetting only
@ -76,4 +78,7 @@ bool get_drm_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret);
void *get_drm_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len);
char *get_drm_prop_enum(int fd, uint32_t obj, uint32_t prop);
bool introspect_drm_prop_range(int fd, uint32_t prop_id,
uint64_t *min, uint64_t *max);
#endif

View file

@ -19,10 +19,6 @@ struct wlr_drm_renderer {
struct wlr_drm_surface {
struct wlr_drm_renderer *renderer;
uint32_t width;
uint32_t height;
struct wlr_swapchain *swapchain;
};
@ -40,7 +36,7 @@ bool init_drm_renderer(struct wlr_drm_backend *drm,
void finish_drm_renderer(struct wlr_drm_renderer *renderer);
bool init_drm_surface(struct wlr_drm_surface *surf,
struct wlr_drm_renderer *renderer, uint32_t width, uint32_t height,
struct wlr_drm_renderer *renderer, int width, int height,
const struct wlr_drm_format *drm_format);
bool drm_fb_import(struct wlr_drm_fb **fb, struct wlr_drm_backend *drm,

View file

@ -2,20 +2,17 @@
#define BACKEND_DRM_UTIL_H
#include <stdint.h>
#include <wlr/types/wlr_output.h>
#include <xf86drm.h>
#include <xf86drmMode.h>
struct wlr_drm_connector;
// Calculates a more accurate refresh rate (mHz) than what mode itself provides
int32_t calculate_refresh_rate(const drmModeModeInfo *mode);
// Populates the make/model/phys_{width,height} of output from the edid data
void parse_edid(struct wlr_output *restrict output, size_t len,
const uint8_t *data);
void parse_edid(struct wlr_drm_connector *conn, size_t len, const uint8_t *data);
// Parses the TILE property
void parse_tile(struct wlr_output *restrict output, size_t len,
const uint8_t *data);
// Returns the string representation of a DRM output type
const char *conn_get_name(uint32_t type_id);
void parse_tile(struct wlr_drm_connector *conn, size_t len, const uint8_t *data);
// Part of match_obj
enum {

View file

@ -5,13 +5,12 @@
#include <wayland-server-core.h>
#include <wlr/backend/interface.h>
#include <wlr/backend/libinput.h>
#include <wlr/interfaces/wlr_keyboard.h>
#include <wlr/interfaces/wlr_pointer.h>
#include <wlr/interfaces/wlr_switch.h>
#include <wlr/interfaces/wlr_tablet_pad.h>
#include <wlr/interfaces/wlr_tablet_tool.h>
#include <wlr/interfaces/wlr_touch.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_keyboard.h>
#include <wlr/types/wlr_pointer.h>
#include <wlr/types/wlr_switch.h>
#include <wlr/types/wlr_tablet_pad.h>
#include <wlr/types/wlr_tablet_tool.h>
#include <wlr/types/wlr_touch.h>
struct wlr_libinput_backend {
struct wlr_backend backend;
@ -26,13 +25,21 @@ struct wlr_libinput_backend {
struct wl_listener session_destroy;
struct wl_listener session_signal;
struct wl_array wlr_device_lists; // struct wl_list *
struct wl_list devices; // wlr_libinput_device::link
};
struct wlr_libinput_input_device {
struct wlr_input_device wlr_input_device;
struct wl_list link;
struct libinput_device *handle;
struct wlr_keyboard keyboard;
struct wlr_pointer pointer;
struct wlr_switch switch_device;
struct wlr_touch touch;
struct wlr_tablet tablet;
struct wl_list tablet_tools; // see backend/libinput/tablet_tool.c
struct wlr_tablet_pad tablet_pad;
struct wl_list link;
};
uint32_t usec_to_msec(uint64_t usec);
@ -40,10 +47,6 @@ uint32_t usec_to_msec(uint64_t usec);
void handle_libinput_event(struct wlr_libinput_backend *state,
struct libinput_event *event);
struct wlr_input_device *get_appropriate_device(
enum wlr_input_device_type desired_type,
struct libinput_device *device);
void destroy_libinput_input_device(struct wlr_libinput_input_device *dev);
extern const struct wlr_keyboard_impl libinput_keyboard_impl;
@ -53,74 +56,83 @@ extern const struct wlr_tablet_impl libinput_tablet_impl;
extern const struct wlr_tablet_pad_impl libinput_tablet_pad_impl;
extern const struct wlr_touch_impl libinput_touch_impl;
struct wlr_keyboard *create_libinput_keyboard(
struct libinput_device *device);
void handle_keyboard_key(struct libinput_event *event,
struct libinput_device *device);
void init_device_keyboard(struct wlr_libinput_input_device *dev);
struct wlr_libinput_input_device *device_from_keyboard(struct wlr_keyboard *kb);
void handle_keyboard_key(struct libinput_event *event, struct wlr_keyboard *kb);
struct wlr_pointer *create_libinput_pointer(
struct libinput_device *device);
void init_device_pointer(struct wlr_libinput_input_device *dev);
struct wlr_libinput_input_device *device_from_pointer(struct wlr_pointer *kb);
void handle_pointer_motion(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_motion_abs(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_button(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_axis(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
#if LIBINPUT_HAS_SCROLL_VALUE120
void handle_pointer_axis_value120(struct libinput_event *event,
struct wlr_pointer *pointer, enum wlr_axis_source source);
#endif
void handle_pointer_swipe_begin(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_swipe_update(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_swipe_end(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_pinch_begin(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_pinch_update(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_pinch_end(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_hold_begin(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_hold_end(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
struct wlr_switch *create_libinput_switch(
struct libinput_device *device);
void init_device_switch(struct wlr_libinput_input_device *dev);
struct wlr_libinput_input_device *device_from_switch(
struct wlr_switch *switch_device);
void handle_switch_toggle(struct libinput_event *event,
struct libinput_device *device);
struct wlr_switch *switch_device);
struct wlr_touch *create_libinput_touch(
struct libinput_device *device);
void init_device_touch(struct wlr_libinput_input_device *dev);
struct wlr_libinput_input_device *device_from_touch(
struct wlr_touch *touch);
void handle_touch_down(struct libinput_event *event,
struct libinput_device *device);
struct wlr_touch *touch);
void handle_touch_up(struct libinput_event *event,
struct libinput_device *device);
struct wlr_touch *touch);
void handle_touch_motion(struct libinput_event *event,
struct libinput_device *device);
struct wlr_touch *touch);
void handle_touch_cancel(struct libinput_event *event,
struct libinput_device *device);
struct wlr_touch *touch);
void handle_touch_frame(struct libinput_event *event,
struct libinput_device *device);
struct wlr_touch *touch);
struct wlr_tablet *create_libinput_tablet(
struct libinput_device *device);
void init_device_tablet(struct wlr_libinput_input_device *dev);
void finish_device_tablet(struct wlr_libinput_input_device *dev);
struct wlr_libinput_input_device *device_from_tablet(
struct wlr_tablet *tablet);
void handle_tablet_tool_axis(struct libinput_event *event,
struct libinput_device *device);
struct wlr_tablet *tablet);
void handle_tablet_tool_proximity(struct libinput_event *event,
struct libinput_device *device);
struct wlr_tablet *tablet);
void handle_tablet_tool_tip(struct libinput_event *event,
struct libinput_device *device);
struct wlr_tablet *tablet);
void handle_tablet_tool_button(struct libinput_event *event,
struct libinput_device *device);
struct wlr_tablet *tablet);
struct wlr_tablet_pad *create_libinput_tablet_pad(
struct libinput_device *device);
void init_device_tablet_pad(struct wlr_libinput_input_device *dev);
void finish_device_tablet_pad(struct wlr_libinput_input_device *dev);
struct wlr_libinput_input_device *device_from_tablet_pad(
struct wlr_tablet_pad *tablet_pad);
void handle_tablet_pad_button(struct libinput_event *event,
struct libinput_device *device);
struct wlr_tablet_pad *tablet_pad);
void handle_tablet_pad_ring(struct libinput_event *event,
struct libinput_device *device);
struct wlr_tablet_pad *tablet_pad);
void handle_tablet_pad_strip(struct libinput_event *event,
struct libinput_device *device);
struct wlr_tablet_pad *tablet_pad);
#endif

View file

@ -8,7 +8,11 @@
#include <wlr/backend/wayland.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_keyboard.h>
#include <wlr/types/wlr_pointer.h>
#include <wlr/types/wlr_tablet_pad.h>
#include <wlr/types/wlr_tablet_tool.h>
#include <wlr/types/wlr_touch.h>
#include <wlr/render/drm_format_set.h>
struct wlr_wl_backend {
@ -17,7 +21,6 @@ struct wlr_wl_backend {
/* local state */
bool started;
struct wl_display *local_display;
struct wl_list devices;
struct wl_list outputs;
int drm_fd;
struct wl_list buffers; // wlr_wl_buffer.link
@ -85,64 +88,73 @@ struct wlr_wl_output {
} cursor;
};
struct wlr_wl_input_device {
struct wlr_input_device wlr_input_device;
struct wl_list link;
uint32_t fingers;
struct wlr_wl_backend *backend;
struct wlr_wl_seat *seat;
void *resource;
};
struct wlr_wl_pointer {
struct wlr_pointer wlr_pointer;
struct wlr_wl_input_device *input_device;
struct wlr_wl_seat *seat;
struct wlr_wl_output *output;
enum wlr_axis_source axis_source;
int32_t axis_discrete;
uint32_t fingers; // trackpad gesture
struct wl_listener output_destroy;
struct wl_list link;
};
struct wlr_wl_seat {
char *name;
struct wl_seat *wl_seat;
struct wlr_wl_backend *backend;
struct wl_keyboard *wl_keyboard;
struct wlr_keyboard wlr_keyboard;
struct wl_pointer *wl_pointer;
struct wlr_wl_pointer *active_pointer;
struct wl_list pointers; // wlr_wl_pointer::link
struct zwp_pointer_gesture_swipe_v1 *gesture_swipe;
struct zwp_pointer_gesture_pinch_v1 *gesture_pinch;
struct zwp_pointer_gesture_hold_v1 *gesture_hold;
struct zwp_relative_pointer_v1 *relative_pointer;
enum wlr_axis_source axis_source;
int32_t axis_discrete;
struct wlr_wl_output *output;
struct wl_listener output_destroy;
};
struct wl_touch *wl_touch;
struct wlr_touch wlr_touch;
struct wlr_wl_seat {
struct wl_seat *wl_seat;
struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2;
struct zwp_tablet_v2 *zwp_tablet_v2;
struct wlr_tablet wlr_tablet;
struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2;
struct wlr_tablet_tool wlr_tablet_tool;
struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2;
struct wlr_tablet_pad wlr_tablet_pad;
struct wl_list link; // wlr_wl_backend.seats
char *name;
struct wl_touch *touch;
struct wl_pointer *pointer;
struct wl_keyboard *keyboard;
struct wlr_wl_backend *backend;
struct wlr_wl_pointer *active_pointer;
};
struct wlr_wl_backend *get_wl_backend_from_backend(struct wlr_backend *backend);
void update_wl_output_cursor(struct wlr_wl_output *output);
struct wlr_wl_pointer *pointer_get_wl(struct wlr_pointer *wlr_pointer);
void create_wl_pointer(struct wlr_wl_seat *seat, struct wlr_wl_output *output);
void create_wl_keyboard(struct wlr_wl_seat *seat);
void create_wl_touch(struct wlr_wl_seat *seat);
struct wlr_wl_input_device *create_wl_input_device(
struct wlr_wl_seat *seat, enum wlr_input_device_type type);
void init_seat_keyboard(struct wlr_wl_seat *seat);
void init_seat_pointer(struct wlr_wl_seat *seat);
void finish_seat_pointer(struct wlr_wl_seat *seat);
void create_pointer(struct wlr_wl_seat *seat, struct wlr_wl_output *output);
void init_seat_touch(struct wlr_wl_seat *seat);
void init_seat_tablet(struct wlr_wl_seat *seat);
void finish_seat_tablet(struct wlr_wl_seat *seat);
bool create_wl_seat(struct wl_seat *wl_seat, struct wlr_wl_backend *wl);
void destroy_wl_seats(struct wlr_wl_backend *wl);
void destroy_wl_input_device(struct wlr_wl_input_device *dev);
void destroy_wl_buffer(struct wlr_wl_buffer *buffer);
extern const struct wl_seat_listener seat_listener;
extern const struct wlr_tablet_pad_impl tablet_pad_impl;
extern const struct wlr_tablet_impl tablet_impl;
struct wlr_wl_tablet_seat *wl_add_tablet_seat(
struct zwp_tablet_manager_v2 *manager,
struct wlr_wl_seat *seat);
extern const struct wlr_pointer_impl wl_pointer_impl;
extern const struct wlr_tablet_pad_impl wl_tablet_pad_impl;
extern const struct wlr_tablet_impl wl_tablet_impl;
#endif