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.
This commit is contained in:
sfan5 2022-08-02 18:55:22 +02:00
parent 8b1f978712
commit ae768a1e14
1 changed files with 15 additions and 0 deletions

View File

@ -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]; 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", mp_verbose(log, "Picked DRM card %d, primary node %s%s.\n",
i, primary_node_path, i, primary_node_path,
card_no_given ? "" : " as the default"); card_no_given ? "" : " as the default");