summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2022-08-02 18:55:22 +0200
committersfan5 <sfan5@live.de>2022-08-03 16:43:08 +0200
commitae768a1e141eb88243e46757d41ca0cada9502b4 (patch)
tree56c2a512d7985a112af67ce4952dc1f5598cfeaf /video/out
parent8b1f9787125f2eaa85912f5143c470a4261d084a (diff)
downloadmpv-ae768a1e141eb88243e46757d41ca0cada9502b4.tar.bz2
mpv-ae768a1e141eb88243e46757d41ca0cada9502b4.tar.xz
drm_common: skip cards that don't support KMS for autodetection
Avoids another pitfall on systems where the first card has a primary node but is not capable of KMS. With this change --drm-context=drm should work correctly out-of-the-box in all cases.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/drm_common.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/video/out/drm_common.c b/video/out/drm_common.c
index 7ba9636edb..b2bbc03ceb 100644
--- a/video/out/drm_common.c
+++ b/video/out/drm_common.c
@@ -558,6 +558,21 @@ static char *get_primary_device_path(struct mp_log *log, int *card_no)
const char *primary_node_path = dev->nodes[DRM_NODE_PRIMARY];
+ int fd = open_card_path(primary_node_path);
+ const int is_kms = fd != -1 && drmIsKMS(fd);
+ if (fd != -1)
+ close(fd);
+ if (!is_kms) {
+ if (card_no_given) {
+ mp_err(log,
+ "DRM card number %d given, yet it does not support "
+ "KMS!\n", i);
+ break;
+ }
+
+ continue;
+ }
+
mp_verbose(log, "Picked DRM card %d, primary node %s%s.\n",
i, primary_node_path,
card_no_given ? "" : " as the default");