xf86drmMode: introduce drmModeGetConnectorTypeName
User-space often needs to print the name of a connector type. When a new connector type is added, all user-space programs need to be updated to support the new connector type.
Expose a function to get a connector type name in libdrm.
Signed-off-by: Simon Ser contact@emersion.fr
Merge request reports
Activity
++
all user-space programs need to be updated to support the new connector type.
In plasma, we assume that drm connector name format is part of the ABI as there are applications that save xdg_output.name to files (they shouldn't do that, but they do it anyway), so switching to the new format can create problems for some apps. However, this is definitely a step in the right direction, the only shame is that such a function was not added a lot earlier.
Is it worth gathering how compositors map connector type codes to human readable names to minimize potential breakages?
xdg-output spec says:
The naming convention is compositor defined, but limited to alphanumeric characters and dashes (-). Each name is unique among all wl_output globals, but if a wl_output global is destroyed the same name may be reused later. The names will also remain consistent across sessions with the same hardware and software configuration.
I believe the intention is that e.g. software upgrade might change the names, but then it can result in some end user inconvenience when they need to reconfigure some apps.
How bad breakage in apps are we talking about?
- Mutter: https://gitlab.gnome.org/GNOME/mutter/-/blob/d84fb91cad4e02e871de016d86cd942502cef1aa/src/backends/meta-monitor-manager.c#L1429
- KWin: https://invent.kde.org/plasma/kwin/-/blob/03efdabf2614b535f0aaa9bef2f21bbcebc3fbd1/src/backends/drm/drm_object_connector.cpp#L145
- Weston: https://gitlab.freedesktop.org/wayland/weston/-/blob/main/libweston/backend-drm/drm.c#L1089
- wlroots: https://gitlab.freedesktop.org/wlroots/wlroots/-/blob/c1a2c09ade789e5667bbe2dc04c6781d37fdab83/backend/drm/util.c#L148
- Xorg: https://gitlab.freedesktop.org/xorg/xserver/-/blob/0217cc6e0cf5013366105a90f5f91ccc4bab5425/hw/xfree86/drivers/modesetting/drmmode_display.c#L3051
KWin/Weston/wlroots seem to mostly have the same conventions, Xorg and Mutter have multiple variations.
The kernel has also a list of names, even though it's probably not intended as UAPI: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/drm_connector.c?h=v5.18#n86
If I could choose what names to use, I'd probably pick those, to be consistent with kernel logs and debugs.
Weston matches the kernel names for the names it has.
- Resolved by Simon Ser
added 50 commits
-
f22dc0df...f83ad09d - 48 commits from branch
mesa:main
- 9d494629 - xf86drmMode: introduce drmModeGetConnectorTypeName
- fa19f603 - tests: use drmModeGetConnectorTypeName
-
f22dc0df...f83ad09d - 48 commits from branch
Updated with the kernel names (https://cgit.freedesktop.org/drm/drm/tree/drivers/gpu/drm/drm_connector.c?h=4fc8cb47fcfdc93e274a1291757e478df4f9c39b#n83).
- Resolved by Simon Ser
1785 case DRM_MODE_CONNECTOR_eDP: 1786 return "eDP"; 1787 case DRM_MODE_CONNECTOR_VIRTUAL: 1788 return "Virtual"; 1789 case DRM_MODE_CONNECTOR_DSI: 1790 return "DSI"; 1791 case DRM_MODE_CONNECTOR_DPI: 1792 return "DPI"; 1793 case DRM_MODE_CONNECTOR_WRITEBACK: 1794 return "Writeback"; 1795 case DRM_MODE_CONNECTOR_SPI: 1796 return "SPI"; 1797 case DRM_MODE_CONNECTOR_USB: 1798 return "USB"; 1799 default: 1800 return NULL; Print the raw enum value as an int, for instance. Or print a warning.
Edited by Simon Ser
added 4 commits
-
a2114afe...f7828dc1 - 2 commits from branch
mesa:main
- 50f8d517 - xf86drmMode: introduce drmModeGetConnectorTypeName
- 0427c1f6 - tests: use drmModeGetConnectorTypeName
-
a2114afe...f7828dc1 - 2 commits from branch
enabled an automatic merge when the pipeline for 0427c1f6 succeeds