summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
Diffstat (limited to 'video/out')
-rw-r--r--video/out/drm_common.c18
-rw-r--r--video/out/drm_common.h5
-rw-r--r--video/out/opengl/context_drm_egl.c4
-rw-r--r--video/out/vo_drm.c1
4 files changed, 24 insertions, 4 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,
diff --git a/video/out/drm_common.h b/video/out/drm_common.h
index e11d240dca..5aa3681ea8 100644
--- a/video/out/drm_common.h
+++ b/video/out/drm_common.h
@@ -47,6 +47,7 @@ struct vt_switcher {
};
struct drm_opts {
+ char *drm_device_path;
char *drm_connector_spec;
char *drm_mode_spec;
int drm_atomic;
@@ -80,7 +81,9 @@ void vt_switcher_acquire(struct vt_switcher *s, void (*handler)(void*),
void vt_switcher_release(struct vt_switcher *s, void (*handler)(void*),
void *user_data);
-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);
diff --git a/video/out/opengl/context_drm_egl.c b/video/out/opengl/context_drm_egl.c
index fe87f5ccc4..99cc6116fb 100644
--- a/video/out/opengl/context_drm_egl.c
+++ b/video/out/opengl/context_drm_egl.c
@@ -732,7 +732,9 @@ static bool drm_egl_init(struct ra_ctx *ctx)
}
MP_VERBOSE(ctx, "Initializing KMS\n");
- p->kms = kms_create(ctx->log, ctx->vo->opts->drm_opts->drm_connector_spec,
+ p->kms = kms_create(ctx->log,
+ ctx->vo->opts->drm_opts->drm_device_path,
+ ctx->vo->opts->drm_opts->drm_connector_spec,
ctx->vo->opts->drm_opts->drm_mode_spec,
ctx->vo->opts->drm_opts->drm_draw_plane,
ctx->vo->opts->drm_opts->drm_drmprime_video_plane,
diff --git a/video/out/vo_drm.c b/video/out/vo_drm.c
index c0ce1707ff..129aa12b7a 100644
--- a/video/out/vo_drm.c
+++ b/video/out/vo_drm.c
@@ -566,6 +566,7 @@ static int preinit(struct vo *vo)
}
p->kms = kms_create(vo->log,
+ vo->opts->drm_opts->drm_device_path,
vo->opts->drm_opts->drm_connector_spec,
vo->opts->drm_opts->drm_mode_spec,
0, 0, false);