aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2024-02-14 19:10:36 +0100
committerSimon Ser <contact@emersion.fr>2024-02-14 19:12:14 +0100
commit836cb820d0b25135cc861782df2781bf2d177795 (patch)
tree51fbc89fc9026380dedf582ebb5fdc9a1dbf7200
parentfeb54979c0940655e36119c63e18a9ee72cc03b0 (diff)
backend/drm: call get_drm_connector_props() when creating connector
This function fetches property IDs. These don't change for the lifetime of the connector. Instead of refreshing the property IDs on hotplug (and leaving property IDs unset for disconnected connectors), only fetch the property IDs when we create the connector.
-rw-r--r--backend/drm/drm.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 005bff11..10485a8a 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -1379,6 +1379,11 @@ static struct wlr_drm_connector *create_drm_connector(struct wlr_drm_backend *dr
wlr_conn->status = DRM_MODE_DISCONNECTED;
wlr_conn->id = drm_conn->connector_id;
+ if (!get_drm_connector_props(drm->fd, wlr_conn->id, &wlr_conn->props)) {
+ free(wlr_conn);
+ return false;
+ }
+
const char *conn_name =
drmModeGetConnectorTypeName(drm_conn->connector_type);
if (conn_name == NULL) {
@@ -1511,10 +1516,6 @@ static bool connect_drm_connector(struct wlr_drm_connector *wlr_conn,
wlr_log(WLR_ERROR, "Unknown subpixel value: %d", (int)drm_conn->subpixel);
}
- if (!get_drm_connector_props(drm->fd, wlr_conn->id, &wlr_conn->props)) {
- return false;
- }
-
uint64_t non_desktop;
if (get_drm_prop(drm->fd, wlr_conn->id,
wlr_conn->props.non_desktop, &non_desktop)) {