backend/drm: use drmModeGetConnectorTypeName

No need to manually maintain this table now.

The wlroots names and the libdrm (= kernel) names all match.

References: 50f8d51773
This commit is contained in:
Simon Ser 2022-07-08 22:04:20 +02:00
parent 972a5cdf7a
commit bd587a7f43
4 changed files with 8 additions and 36 deletions

View file

@ -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);

View file

@ -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) {

View file

@ -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 {

View file

@ -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',