summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--options/options.c6
-rw-r--r--options/options.h4
-rw-r--r--video/out/drm_common.c12
-rw-r--r--video/out/drm_common.h6
-rw-r--r--video/out/opengl/context_drm_egl.c5
-rw-r--r--video/out/opengl/hwdec_drmprime_drm.c7
-rw-r--r--video/out/vo_drm.c4
7 files changed, 33 insertions, 11 deletions
diff --git a/options/options.c b/options/options.c
index a79a57f449..8e940be347 100644
--- a/options/options.c
+++ b/options/options.c
@@ -70,6 +70,7 @@ extern const struct m_sub_options stream_dvb_conf;
extern const struct m_sub_options stream_lavf_conf;
extern const struct m_sub_options stream_cache_conf;
extern const struct m_sub_options sws_conf;
+extern const struct m_sub_options drm_conf;
extern const struct m_sub_options demux_rawaudio_conf;
extern const struct m_sub_options demux_rawvideo_conf;
extern const struct m_sub_options demux_lavf_conf;
@@ -179,10 +180,7 @@ static const m_option_t mp_vo_opt_list[] = {
OPT_STRING("vo-mmcss-profile", mmcss_profile, 0),
#endif
#if HAVE_DRM
- OPT_STRING_VALIDATE("drm-connector", drm_connector_spec,
- 0, drm_validate_connector_opt),
- OPT_INT("drm-mode", drm_mode_id, 0),
- OPT_INT("drm-overlay", drm_overlay_id, 0),
+ OPT_SUBSTRUCT("", drm_opts, drm_conf, 0),
#endif
OPT_STRING_VALIDATE("opengl-hwdec-interop", gl_hwdec_interop, 0,
ra_hwdec_validate_opt),
diff --git a/options/options.h b/options/options.h
index 008111ade3..0d697a717c 100644
--- a/options/options.h
+++ b/options/options.h
@@ -55,9 +55,7 @@ typedef struct mp_vo_opts {
// vo_opengl, vo_opengl_cb
char *gl_hwdec_interop;
// vo_drm
- char *drm_connector_spec;
- int drm_mode_id;
- int drm_overlay_id;
+ struct drm_opts *drm_opts;
} mp_vo_opts;
struct mp_cache_opts {
diff --git a/video/out/drm_common.c b/video/out/drm_common.c
index c1f374118a..8402ac7e69 100644
--- a/video/out/drm_common.c
+++ b/video/out/drm_common.c
@@ -41,6 +41,18 @@
static int vt_switcher_pipe[2];
+#define OPT_BASE_STRUCT struct drm_opts
+const struct m_sub_options drm_conf = {
+ .opts = (const struct m_option[]) {
+ OPT_STRING_VALIDATE("drm-connector", drm_connector_spec,
+ 0, drm_validate_connector_opt),
+ OPT_INT("drm-mode", drm_mode_id, 0),
+ OPT_INT("drm-overlay", drm_overlay_id, 0),
+ {0},
+ },
+ .size = sizeof(struct drm_opts),
+};
+
static const char *connector_names[] = {
"Unknown", // DRM_MODE_CONNECTOR_Unknown
"VGA", // DRM_MODE_CONNECTOR_VGA
diff --git a/video/out/drm_common.h b/video/out/drm_common.h
index 0e6e76d03e..ff913ff00c 100644
--- a/video/out/drm_common.h
+++ b/video/out/drm_common.h
@@ -42,6 +42,12 @@ struct vt_switcher {
void *handler_data[2];
};
+struct drm_opts {
+ char *drm_connector_spec;
+ int drm_mode_id;
+ int drm_overlay_id;
+};
+
bool vt_switcher_init(struct vt_switcher *s, struct mp_log *log);
void vt_switcher_destroy(struct vt_switcher *s);
void vt_switcher_poll(struct vt_switcher *s, int timeout_ms);
diff --git a/video/out/opengl/context_drm_egl.c b/video/out/opengl/context_drm_egl.c
index c7de762e28..606736d483 100644
--- a/video/out/opengl/context_drm_egl.c
+++ b/video/out/opengl/context_drm_egl.c
@@ -347,8 +347,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_connector_spec,
- ctx->vo->opts->drm_mode_id, ctx->vo->opts->drm_overlay_id);
+ p->kms = kms_create(ctx->log, ctx->vo->opts->drm_opts->drm_connector_spec,
+ ctx->vo->opts->drm_opts->drm_mode_id,
+ ctx->vo->opts->drm_opts->drm_overlay_id);
if (!p->kms) {
MP_ERR(ctx, "Failed to create KMS.\n");
return false;
diff --git a/video/out/opengl/hwdec_drmprime_drm.c b/video/out/opengl/hwdec_drmprime_drm.c
index 95e42254e0..d942ab3d37 100644
--- a/video/out/opengl/hwdec_drmprime_drm.c
+++ b/video/out/opengl/hwdec_drmprime_drm.c
@@ -37,6 +37,8 @@
#include "ra_gl.h"
+extern const struct m_sub_options drm_conf;
+
struct drm_frame {
struct drm_prime_framebuffer fb;
struct mp_image *image; // associated mpv image
@@ -202,7 +204,10 @@ static int init(struct ra_hwdec *hw)
p->log = hw->log;
- mp_read_option_raw(hw->global, "drm-overlay", &m_option_type_int, &drm_overlay);
+ void *tmp = talloc_new(NULL);
+ struct drm_opts *opts = mp_get_config_group(tmp, hw->global, &drm_conf);
+ drm_overlay = opts->drm_overlay_id;
+ talloc_free(tmp);
GL *gl = ra_gl_get(hw->ra);
struct mpv_opengl_cb_drm_params *params =
diff --git a/video/out/vo_drm.c b/video/out/vo_drm.c
index 04ac1cab63..24189d5b02 100644
--- a/video/out/vo_drm.c
+++ b/video/out/vo_drm.c
@@ -412,7 +412,9 @@ static int preinit(struct vo *vo)
}
p->kms = kms_create(
- vo->log, vo->opts->drm_connector_spec, vo->opts->drm_mode_id, vo->opts->drm_overlay_id);
+ vo->log, vo->opts->drm_opts->drm_connector_spec,
+ vo->opts->drm_opts->drm_mode_id,
+ vo->opts->drm_opts->drm_overlay_id);
if (!p->kms) {
MP_ERR(vo, "Failed to create KMS.\n");
goto err;