aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-08-10 18:47:14 +0200
committerSimon Ser <contact@emersion.fr>2021-09-07 11:18:18 +0200
commit3c74bd0c915e7ddd1b5dcc05d14f5555de10e980 (patch)
tree505a22f40ab0fc4379961d668129c73dba9b5786 /include
parent3fbf6e02a35e66abb52ca9c79527f3d07e8d9e4a (diff)
backend/drm: introduce wlr_drm_connector_state
Previously, we were copying wlr_output_state on the stack and patching it up to be guaranteed to have a proper drmModeModeInfo stored in it (and not a custom mode). Also, we had a bunch of helpers deriving DRM-specific information from the generic wlr_output_state. Copying the wlr_output_state worked fine so far, but with output layers we'll be getting a wl_list in there. An empty wl_list stores two pointers to itself, copying it on the stack blindly results in infinite loops in wl_list_for_each. To fix this, rework our DRM backend to stop copying wlr_output_state, instead add a new struct wlr_drm_connector_state which holds both the wlr_output_state and additional DRM-specific information.
Diffstat (limited to 'include')
-rw-r--r--include/backend/drm/drm.h13
-rw-r--r--include/backend/drm/iface.h4
2 files changed, 10 insertions, 7 deletions
diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h
index 87160ac6..69e563a9 100644
--- a/include/backend/drm/drm.h
+++ b/include/backend/drm/drm.h
@@ -104,6 +104,13 @@ struct wlr_drm_mode {
drmModeModeInfo drm_mode;
};
+struct wlr_drm_connector_state {
+ const struct wlr_output_state *base;
+ bool modeset;
+ bool active;
+ drmModeModeInfo mode;
+};
+
struct wlr_drm_connector {
struct wlr_output output; // only valid if status != DISCONNECTED
@@ -153,12 +160,6 @@ size_t drm_crtc_get_gamma_lut_size(struct wlr_drm_backend *drm,
struct wlr_drm_fb *plane_get_next_fb(struct wlr_drm_plane *plane);
-bool drm_connector_state_is_modeset(const struct wlr_output_state *state);
-bool drm_connector_state_active(struct wlr_drm_connector *conn,
- const struct wlr_output_state *state);
-void drm_connector_state_mode(struct wlr_drm_connector *conn,
- const struct wlr_output_state *state, drmModeModeInfo *mode);
-
#define wlr_drm_conn_log(conn, verb, fmt, ...) \
wlr_log(verb, "connector %s: " fmt, conn->name, ##__VA_ARGS__)
#define wlr_drm_conn_log_errno(conn, verb, fmt, ...) \
diff --git a/include/backend/drm/iface.h b/include/backend/drm/iface.h
index 98f7e06c..d52bbd3d 100644
--- a/include/backend/drm/iface.h
+++ b/include/backend/drm/iface.h
@@ -9,12 +9,14 @@
struct wlr_drm_backend;
struct wlr_drm_connector;
struct wlr_drm_crtc;
+struct wlr_drm_connector_state;
// Used to provide atomic or legacy DRM functions
struct wlr_drm_interface {
// Commit all pending changes on a CRTC.
bool (*crtc_commit)(struct wlr_drm_connector *conn,
- const struct wlr_output_state *state, uint32_t flags, bool test_only);
+ const struct wlr_drm_connector_state *state, uint32_t flags,
+ bool test_only);
};
extern const struct wlr_drm_interface atomic_iface;