summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
Diffstat (limited to 'video/out')
-rw-r--r--video/out/drm_common.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/video/out/drm_common.c b/video/out/drm_common.c
index b4064879de..0ec0788480 100644
--- a/video/out/drm_common.c
+++ b/video/out/drm_common.c
@@ -816,6 +816,24 @@ static bool card_supports_kms(const char *path)
return ret;
}
+static bool card_has_connection(const char *path)
+{
+ int fd = open_card_path(path);
+ bool ret = false;
+ if (fd != -1) {
+ drmModeRes *res = drmModeGetResources(fd);
+ if (res) {
+ drmModeConnector *connector = get_first_connected_connector(res, fd);
+ if (connector)
+ ret = true;
+ drmModeFreeConnector(connector);
+ drmModeFreeResources(res);
+ }
+ close(fd);
+ }
+ return ret;
+}
+
static void get_primary_device_path(struct vo_drm_state *drm)
{
if (drm->opts->device_path) {
@@ -865,6 +883,17 @@ static void get_primary_device_path(struct vo_drm_state *drm)
continue;
}
+ if (!card_has_connection(card_path)) {
+ if (card_no_given) {
+ MP_ERR(drm,
+ "DRM card number %d given, but it does not have any "
+ "connected outputs.\n", i);
+ break;
+ }
+
+ continue;
+ }
+
MP_VERBOSE(drm, "Picked DRM card %d, primary node %s%s.\n",
i, card_path,
card_no_given ? "" : " as the default");