aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--backend/drm/drm.c9
-rw-r--r--backend/drm/util.c31
-rw-r--r--include/backend/drm/util.h2
-rw-r--r--meson.build2
4 files changed, 8 insertions, 36 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) {
diff --git a/include/backend/drm/util.h b/include/backend/drm/util.h
index 323894b5..fc632e12 100644
--- a/include/backend/drm/util.h
+++ b/include/backend/drm/util.h
@@ -11,8 +11,6 @@ struct wlr_drm_connector;
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_drm_connector *conn, 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);
// Part of match_obj
enum {
diff --git a/meson.build b/meson.build
index 944dfa3e..d04d3c16 100644
--- a/meson.build
+++ b/meson.build
@@ -107,7 +107,7 @@ wayland_server = dependency('wayland-server',
)
drm = dependency('libdrm',
- version: '>=2.4.109',
+ version: '>=2.4.112',
fallback: 'libdrm',
default_options: [
'libkms=false',