From 91586c35924ff8bd54eab549e7326d6cf2868b46 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 1 Dec 2017 05:05:00 +0100 Subject: vo_gpu: make it possible to load multiple hwdec interop drivers Make the VO<->decoder interface capable of supporting multiple hwdec APIs at once. The main gain is that this simplifies autoprobing a lot. Before this change, it could happen that the VO loaded the "wrong" hwdec API, and the decoder was stuck with the choice (breaking hw decoding). With the change applied, the VO simply loads all available APIs, so autoprobing trickery is left entirely to the decoder. In the past, we were quite careful about not accidentally loading the wrong interop drivers. This was in part to make sure autoprobing works, but also because libva had this obnoxious bug of dumping garbage to stderr when using the API. libva was fixed, so this is not a problem anymore. The --opengl-hwdec-interop option is changed in various ways (again...), and renamed to --gpu-hwdec-interop. It does not have much use anymore, other than debugging. It's notable that the order in the hwdec interop array ra_hwdec_drivers[] still matters if multiple drivers support the same image formats, so the option can explicitly force one, if that should ever be necessary, or more likely, for debugging. One example are the ra_hwdec_d3d11egl and ra_hwdec_d3d11eglrgb drivers, which both support d3d11 input. vo_gpu now always loads the interop lazily by default, but when it does, it loads them all. vo_opengl_cb now always loads them when the GL context handle is initialized. I don't expect that this causes any problems. It's now possible to do things like changing between vdpau and nvdec decoding at runtime. This is also preparation for cleaning up vd_lavc.c hwdec autoprobing. It's another reason why hwdec_devices_request_all() does not take a hwdec type anymore. --- DOCS/interface-changes.rst | 9 ++++++++ DOCS/man/input.rst | 5 +---- DOCS/man/options.rst | 55 +++++++++++++++++++++++----------------------- 3 files changed, 37 insertions(+), 32 deletions(-) (limited to 'DOCS') diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index 494b769b8b..312fe9552a 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -48,6 +48,15 @@ Interface changes - remove deprecated --demuxer-max-packets - remove most of the deprecated audio and video filters - remove the deprecated --balance option/property + - rename the --opengl-hwdec-interop option to --gpu-hwdec-interop, and + change some of its semantics: extend it take the strings "auto" and + "all". "all" loads all backends. "auto" behaves like "all" for + vo_opengl_cb, while on vo_gpu it loads nothing, but allows on demand + loading by the decoder. The empty string as option value behaves like + "auto". Old --hwdec values do not work anymore. + This option is hereby declared as unstable and may change any time - its + old use is deprecated, and it has very little use outside of debugging + now. --- mpv 0.27.0 --- - drop previously deprecated --field-dominance option - drop previously deprecated "osd" command diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index 75cb9526c6..4e81a3ce2d 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -1433,7 +1433,7 @@ Property list This is known only once the VO has opened (and possibly later). With some VOs (like ``opengl``), this might be never known in advance, but only when the decoder attempted to create the hw decoder successfully. (Using - ``--opengl-hwdec-interop`` can load it eagerly.) If there are multiple + ``--gpu-hwdec-interop`` can load it eagerly.) If there are multiple drivers loaded, they will be separated by ``,``. If no VO is active or no interop driver is known, this property is @@ -1443,9 +1443,6 @@ Property list multiple interop drivers for the same hardware decoder, depending on platform and VO. - This is somewhat similar to the ``--opengl-hwdec-interop`` option, but - it returns the actually loaded backend, not the value of this option. - ``video-format`` Video format as string. diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index f3564cffb6..f01d40e563 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -816,34 +816,33 @@ Video frame glitches or discoloration, and you have ``--hwdec`` turned on, the first thing you should try is disabling it. -``--opengl-hwdec-interop=`` - This is useful for the ``gpu`` and ``opengl-cb`` VOs for creating the - hardware decoding OpenGL interop context, but without actually enabling - hardware decoding itself (like ``--hwdec`` does). - - If set to an empty string (default), the ``--hwdec`` option is used. - - For ``gpu``, if set, do not create the interop context on demand, but - when the VO is created. - - For ``opengl-cb``, if set, load the interop context as soon as the OpenGL - context is created. Since ``opengl-cb`` has no on-demand loading, this - allows enabling hardware decoding at runtime at all, without having - to temporarily set the ``hwdec`` option just during OpenGL context - initialization with ``mpv_opengl_cb_init_gl()``. - - See ``--opengl-hwdec-interop=help`` for accepted values. This lists the - interop backend, with the ``--hwdec`` alias after it in ``[...]``. Consider - all values except the proper interop backend name, ``auto``, and ``no`` as - silently deprecated and subject to change. Also, if you use this in - application code (e.g. via libmpv), any value other than ``auto`` and ``no`` - should be avoided, as backends can change. - - Currently the option sets a single value. It is possible that the option - type changes to a list in the future. - - The old alias ``--hwdec-preload`` has different behavior if the option value - is ``no``. +``--gpu-hwdec-interop=`` + This option is for troubleshooting hwdec interop issues. Since it's a + debugging option, its semantics may change at any time. + + This is useful for the ``gpu`` and ``opengl-cb`` VOs for selecting which + hwdec interop context to use exactly. Effectively it also can be used + to block loading of certain backends. + + If set to ``auto`` (default), the behavior depends on the VO: for ``gpu``, + it does nothing, and the interop context is loaded on demand (when the + decoder probes for ``--hwdec`` support). For ``opengl-cb``, which has + has no on-demand loading, this is equivalent to ``all``. + + The empty string is equivalent to ``auto``. + + If set to ``all``, it attempts to load all interop contexts at GL context + creation time. + + Other than that, a specific backend can be set, and the list of them can + be queried with ``help`` (mpv CLI only). + + Runtime changes to this are ignored (the current option value is used + whenever the renderer is created). + + The old aliases ``--opengl-hwdec-interop`` and ``--hwdec-preload`` are + barely related to this anymore, but will be somewhat compatible in some + cases. ``--hwdec-image-format=`` Set the internal pixel format used by hardware decoding via ``--hwdec`` -- cgit v1.2.3