aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-07-08 22:04:20 +0200
committerSimon Ser <contact@emersion.fr>2022-07-25 17:28:33 +0000
commitbd587a7f431e53764d5e8051f2717d32d4c62b69 (patch)
treec3ba457a8ecd2c75bf02c9daeca89c27fdfbd31f /backend
parent972a5cdf7a9701a266119d60da48624ca8ebf703 (diff)
backend/drm: use drmModeGetConnectorTypeName
No need to manually maintain this table now. The wlroots names and the libdrm (= kernel) names all match. References: https://gitlab.freedesktop.org/mesa/drm/-/commit/50f8d517733d24fce6693ffae552f9833e2e6aa9
Diffstat (limited to 'backend')
-rw-r--r--backend/drm/drm.c9
-rw-r--r--backend/drm/util.c31
2 files changed, 7 insertions, 33 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 262a533e..660477b6 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -1250,9 +1250,14 @@ void scan_drm_connectors(struct wlr_drm_backend *drm,
wlr_conn->status = WLR_DRM_CONN_DISCONNECTED;
wlr_conn->id = drm_conn->connector_id;
+ const char *conn_name =
+ drmModeGetConnectorTypeName(drm_conn->connector_type);
+ if (conn_name == NULL) {
+ conn_name = "Unknown";
+ }
+
snprintf(wlr_conn->name, sizeof(wlr_conn->name),
- "%s-%"PRIu32, conn_get_name(drm_conn->connector_type),
- drm_conn->connector_type_id);
+ "%s-%"PRIu32, conn_name, drm_conn->connector_type_id);
wl_list_insert(drm->outputs.prev, &wlr_conn->link);
wlr_log(WLR_INFO, "Found connector '%s'", wlr_conn->name);
diff --git a/backend/drm/util.c b/backend/drm/util.c
index d56eee38..2083e617 100644
--- a/backend/drm/util.c
+++ b/backend/drm/util.c
@@ -121,37 +121,6 @@ void parse_edid(struct wlr_drm_connector *conn, size_t len, const uint8_t *data)
}
}
-const char *conn_get_name(uint32_t type_id) {
- switch (type_id) {
- case DRM_MODE_CONNECTOR_Unknown: return "Unknown";
- case DRM_MODE_CONNECTOR_VGA: return "VGA";
- case DRM_MODE_CONNECTOR_DVII: return "DVI-I";
- case DRM_MODE_CONNECTOR_DVID: return "DVI-D";
- case DRM_MODE_CONNECTOR_DVIA: return "DVI-A";
- case DRM_MODE_CONNECTOR_Composite: return "Composite";
- case DRM_MODE_CONNECTOR_SVIDEO: return "SVIDEO";
- case DRM_MODE_CONNECTOR_LVDS: return "LVDS";
- case DRM_MODE_CONNECTOR_Component: return "Component";
- case DRM_MODE_CONNECTOR_9PinDIN: return "DIN";
- case DRM_MODE_CONNECTOR_DisplayPort: return "DP";
- case DRM_MODE_CONNECTOR_HDMIA: return "HDMI-A";
- case DRM_MODE_CONNECTOR_HDMIB: return "HDMI-B";
- case DRM_MODE_CONNECTOR_TV: return "TV";
- case DRM_MODE_CONNECTOR_eDP: return "eDP";
- case DRM_MODE_CONNECTOR_VIRTUAL: return "Virtual";
- case DRM_MODE_CONNECTOR_DSI: return "DSI";
- case DRM_MODE_CONNECTOR_DPI: return "DPI";
- case DRM_MODE_CONNECTOR_WRITEBACK: return "Writeback";
-#ifdef DRM_MODE_CONNECTOR_SPI
- case DRM_MODE_CONNECTOR_SPI: return "SPI";
-#endif
-#ifdef DRM_MODE_CONNECTOR_USB
- case DRM_MODE_CONNECTOR_USB: return "USB";
-#endif
- default: return "Unknown";
- }
-}
-
static bool is_taken(size_t n, const uint32_t arr[static n], uint32_t key) {
for (size_t i = 0; i < n; ++i) {
if (arr[i] == key) {