mirror of https://github.com/mpv-player/mpv
drm_common: enable specific device selection by means of path
This commit is contained in:
parent
e6cf918eb8
commit
f560437594
|
@ -27,6 +27,8 @@ Interface changes
|
|||
::
|
||||
|
||||
--- mpv 0.34.0 ---
|
||||
- deprecate selecting by card number with `--drm-connector`, add
|
||||
`--drm-device` which can be used instead
|
||||
- add `--screen-name` and `--fs-screen-name` flags to allow selecting the
|
||||
screen by its name instead of the index
|
||||
- add `--macos-geometry-calculation` to change the rectangle used for screen
|
||||
|
|
|
@ -552,8 +552,13 @@ Available video output drivers are:
|
|||
Select the connector to use (usually this is a monitor.) If ``<name>``
|
||||
is empty or ``auto``, mpv renders the output on the first available
|
||||
connector. Use ``--drm-connector=help`` to get a list of available
|
||||
connectors. When using multiple graphic cards, use the ``<gpu_number>``
|
||||
argument to disambiguate.
|
||||
connectors. The ``<gpu_number>`` argument can be used to disambiguate
|
||||
multiple graphic cards, but is deprecated in favor of ``--drm-device``.
|
||||
(default: empty)
|
||||
|
||||
``--drm-device=<path>``
|
||||
Select the DRM device file to use. If specified this overrides automatic
|
||||
card selection and any card number specified ``--drm-connector``.
|
||||
(default: empty)
|
||||
|
||||
``--drm-mode=<preferred|highest|N|WxH[@R]>``
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue