summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-10-16 10:53:33 +0200
committerwm4 <wm4@nowhere>2017-10-16 10:57:51 +0200
commit7cfae5adceed47122ced715c8b9cda0b87a1f1bf (patch)
tree9ac9ab76a3a95f50f46729a84616250202219519 /video
parentc6b97a4935cf2e5d1008e4b0d03c8cece415fec1 (diff)
downloadmpv-7cfae5adceed47122ced715c8b9cda0b87a1f1bf.tar.bz2
mpv-7cfae5adceed47122ced715c8b9cda0b87a1f1bf.tar.xz
vo_gpu: semi-fix --gpu-context/--gpu-api options and help output
This was confusing at best. Change it to output the actual choices. (Seems like in the end it's always me who has to clean up other people's bullshit.) Context names were not unique - but they should be, so fix it. The whole point of the original --opengl-backend option was to side-step the tricky auto-detection, so you know exactly what you get. The goal of this commit is to make --gpu-context work the same way. Fix the non-unique names by appending "vk" to the names. Keep in mind that this was not suitable for slecting the "UI" backend anyway, since "x11" would force GLX, whereas people on not-NVIDIA actually want "x11egl". Users trying to use --gpu-context=x11 to force the X11 backend would always end up with GLX, which would at least break VAAPI hardware decoding for them. Basically the idea that this option could select the "UI" type is completely broken - it selects an implementation, which implies a UI. Selecting the UI type This would require a separate mechanism. (Although in theory this separate mechanism could be part of the --gpu-context option - in any case, someone would have to implement it.) To achieve help output that can actually be understood, just duplicate the code. Most of that code is duplicated anyway, and trying to share just the list code with the result of making the output unreadable doesn't make too much sense. If we wanted to save code/effort, we could just remove the help output altogether. --gpu-api has non-unique entries, and it would be nice to group them (e.g. list all OpenGL capable contexts with "opengl"), but C makes this simple idea too much of a pain, so don't do it. Also remove a stray tab from the android entry on the manpage.
Diffstat (limited to 'video')
-rw-r--r--video/out/gpu/context.c25
-rw-r--r--video/out/vulkan/context_wayland.c2
-rw-r--r--video/out/vulkan/context_win.c2
-rw-r--r--video/out/vulkan/context_xlib.c2
4 files changed, 14 insertions, 17 deletions
diff --git a/video/out/gpu/context.c b/video/out/gpu/context.c
index 8be0b2fc90..8dc8a5c71f 100644
--- a/video/out/gpu/context.c
+++ b/video/out/gpu/context.c
@@ -111,24 +111,16 @@ static const struct ra_ctx_fns *contexts[] = {
#endif
};
-static bool get_help(struct mp_log *log, struct bstr param)
+int ra_ctx_validate_api(struct mp_log *log, const struct m_option *opt,
+ struct bstr name, struct bstr param)
{
if (bstr_equals0(param, "help")) {
- mp_info(log, "GPU contexts / APIs:\n");
+ mp_info(log, "GPU APIs (contexts):\n");
mp_info(log, " auto (autodetect)\n");
for (int n = 0; n < MP_ARRAY_SIZE(contexts); n++)
- mp_info(log, " %s (%s)\n", contexts[n]->name, contexts[n]->type);
- return true;
- }
-
- return false;
-}
-
-int ra_ctx_validate_api(struct mp_log *log, const struct m_option *opt,
- struct bstr name, struct bstr param)
-{
- if (get_help(log, param))
+ mp_info(log, " %s (%s)\n", contexts[n]->type, contexts[n]->name);
return M_OPT_EXIT;
+ }
if (bstr_equals0(param, "auto"))
return 1;
for (int i = 0; i < MP_ARRAY_SIZE(contexts); i++) {
@@ -141,8 +133,13 @@ int ra_ctx_validate_api(struct mp_log *log, const struct m_option *opt,
int ra_ctx_validate_context(struct mp_log *log, const struct m_option *opt,
struct bstr name, struct bstr param)
{
- if (get_help(log, param))
+ if (bstr_equals0(param, "help")) {
+ mp_info(log, "GPU contexts (APIs):\n");
+ mp_info(log, " auto (autodetect)\n");
+ for (int n = 0; n < MP_ARRAY_SIZE(contexts); n++)
+ mp_info(log, " %s (%s)\n", contexts[n]->name, contexts[n]->type);
return M_OPT_EXIT;
+ }
if (bstr_equals0(param, "auto"))
return 1;
for (int i = 0; i < MP_ARRAY_SIZE(contexts); i++) {
diff --git a/video/out/vulkan/context_wayland.c b/video/out/vulkan/context_wayland.c
index 92ee7aa1a9..7276775242 100644
--- a/video/out/vulkan/context_wayland.c
+++ b/video/out/vulkan/context_wayland.c
@@ -123,7 +123,7 @@ static void wayland_vk_wait_events(struct ra_ctx *ctx, int64_t until_time_us)
const struct ra_ctx_fns ra_ctx_vulkan_wayland = {
.type = "vulkan",
- .name = "wayland",
+ .name = "waylandvk",
.reconfig = wayland_vk_reconfig,
.control = wayland_vk_control,
.wakeup = wayland_vk_wakeup,
diff --git a/video/out/vulkan/context_win.c b/video/out/vulkan/context_win.c
index 899ab83257..cf31586d00 100644
--- a/video/out/vulkan/context_win.c
+++ b/video/out/vulkan/context_win.c
@@ -97,7 +97,7 @@ static int win_control(struct ra_ctx *ctx, int *events, int request, void *arg)
const struct ra_ctx_fns ra_ctx_vulkan_win = {
.type = "vulkan",
- .name = "win",
+ .name = "winvk",
.reconfig = win_reconfig,
.control = win_control,
.init = win_init,
diff --git a/video/out/vulkan/context_xlib.c b/video/out/vulkan/context_xlib.c
index 26efd6f583..c3bd49f4fb 100644
--- a/video/out/vulkan/context_xlib.c
+++ b/video/out/vulkan/context_xlib.c
@@ -107,7 +107,7 @@ static void xlib_wait_events(struct ra_ctx *ctx, int64_t until_time_us)
const struct ra_ctx_fns ra_ctx_vulkan_xlib = {
.type = "vulkan",
- .name = "x11",
+ .name = "x11vk",
.reconfig = xlib_reconfig,
.control = xlib_control,
.wakeup = xlib_wakeup,