summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2022-08-11 14:40:15 +0200
committersfan5 <sfan5@live.de>2022-08-11 18:31:04 +0200
commitf2ef942ef5554753b6f1ee0b0342c2a274d4e496 (patch)
tree8e6d24db78d7f2ed86c883509cc07f3dfe02abd9 /video/out
parent5f6e8f856c6038264c7774babd96bde191d398d2 (diff)
downloadmpv-f2ef942ef5554753b6f1ee0b0342c2a274d4e496.tar.bz2
mpv-f2ef942ef5554753b6f1ee0b0342c2a274d4e496.tar.xz
drm_common: remove hard dependency on drmIsKMS()
ae768a1e141eb88243e46757d41ca0cada9502b4 forgot to bump the required libdrm version however Debian 11 just barely misses the requirement, which is a good reason not to require it unconditionally anyway.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/drm_common.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/video/out/drm_common.c b/video/out/drm_common.c
index b2bbc03ceb..d6511b7100 100644
--- a/video/out/drm_common.c
+++ b/video/out/drm_common.c
@@ -523,6 +523,19 @@ static int open_card_path(const char *path)
return open(path, O_RDWR | O_CLOEXEC);
}
+static bool card_supports_kms(const char *path)
+{
+#if HAVE_DRM_IS_KMS
+ int fd = open_card_path(path);
+ bool ret = fd != -1 && drmIsKMS(fd);
+ if (fd != -1)
+ close(fd);
+ return ret;
+#else
+ return true;
+#endif
+}
+
static char *get_primary_device_path(struct mp_log *log, int *card_no)
{
drmDevice *devices[DRM_MAX_MINOR] = { 0 };
@@ -558,11 +571,7 @@ 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_supports_kms(primary_node_path)) {
if (card_no_given) {
mp_err(log,
"DRM card number %d given, yet it does not support "