summaryrefslogtreecommitdiffstats
path: root/video/out/drm_common.c
diff options
context:
space:
mode:
authorJan Ekström <jeebjp@gmail.com>2021-01-22 23:07:38 +0200
committersfan5 <sfan5@live.de>2021-10-25 20:37:03 +0200
commitf56043759494dd584c8d82e7890f92fada18e34b (patch)
tree367d00e4b23f53d76a4229b42a69b1a960f4f4af /video/out/drm_common.c
parente6cf918eb8ba3e6892f7d22a6bbcbbae3e6b5bf5 (diff)
downloadmpv-f56043759494dd584c8d82e7890f92fada18e34b.tar.bz2
mpv-f56043759494dd584c8d82e7890f92fada18e34b.tar.xz
drm_common: enable specific device selection by means of path
Diffstat (limited to 'video/out/drm_common.c')
-rw-r--r--video/out/drm_common.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/video/out/drm_common.c b/video/out/drm_common.c
index 07c6815209..b631ee656c 100644
--- a/video/out/drm_common.c
+++ b/video/out/drm_common.c
@@ -74,6 +74,7 @@ static double mode_get_Hz(const drmModeModeInfo *mode);
#define OPT_BASE_STRUCT struct drm_opts
const struct m_sub_options drm_conf = {
.opts = (const struct m_option[]) {
+ {"drm-device", OPT_STRING(drm_device_path), .flags = M_OPT_FILE},
{"drm-connector", OPT_STRING(drm_connector_spec),
.help = drm_connector_opt_help},
{"drm-mode", OPT_STRING_VALIDATE(drm_mode_spec, drm_validate_mode_opt),
@@ -570,6 +571,8 @@ static void parse_connector_spec(struct mp_log *log,
}
char *dot_ptr = strchr(connector_spec, '.');
if (dot_ptr) {
+ mp_warn(log, "Warning: Selecting a connector by index with drm-connector "
+ "is deprecated. Use the drm-device option instead.\n");
*card_no = atoi(connector_spec);
*connector_name = talloc_strdup(log, dot_ptr + 1);
} else {
@@ -578,15 +581,26 @@ static void parse_connector_spec(struct mp_log *log,
}
}
-struct kms *kms_create(struct mp_log *log, const char *connector_spec,
+struct kms *kms_create(struct mp_log *log,
+ const char *drm_device_path,
+ const char *connector_spec,
const char* mode_spec,
int draw_plane, int drmprime_video_plane,
bool use_atomic)
{
int card_no = -1;
char *connector_name = NULL;
+
parse_connector_spec(log, connector_spec, &card_no, &connector_name);
- char *primary_node_path = get_primary_device_path(log, &card_no);
+ if (drm_device_path && card_no != -1)
+ mp_warn(log, "Both DRM device and card number (as part of "
+ "drm-connector) are set! Will prefer given device path "
+ "'%s'!\n",
+ drm_device_path);
+
+ char *primary_node_path = drm_device_path ?
+ talloc_strdup(log, drm_device_path) :
+ get_primary_device_path(log, &card_no);
if (!primary_node_path) {
mp_err(log,