summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2022-08-27 09:53:31 -0700
committerPhilip Langdale <github.philipl@overt.org>2022-10-11 10:07:48 -0700
commit064059e6c36329e1b1fd567d0efdfbaf13ec53c4 (patch)
tree154a9afe75e3288499da84ffb9157166c81c60bb
parentd050e350fee8b3bef3f77e9c161bf35aea8faa2e (diff)
downloadmpv-064059e6c36329e1b1fd567d0efdfbaf13ec53c4.tar.bz2
mpv-064059e6c36329e1b1fd567d0efdfbaf13ec53c4.tar.xz
vo_gpu/hwdec: rename and introduce legacy names for some interops
We've had some annoying names for interops, which we can't simply rename because that would break config files and command lines. So we need to put a little more effort in and add a concept of legacy names that allow us to continue loading them, but with a warning. The two I'm renaming here are: * vaapi-egl -> vaapi (vaapi works with Vulkan too) * drmprime-drm -> drmprime-overlay (actually describes what it does) * cuda-nvdec -> cuda (cuda interop is not nvdec specific)
-rw-r--r--DOCS/man/vo.rst16
-rw-r--r--meson.build2
-rw-r--r--video/out/drm_atomic.c2
-rw-r--r--video/out/gpu/hwdec.c16
-rw-r--r--video/out/gpu/hwdec.h5
-rw-r--r--video/out/hwdec/hwdec_cuda.c3
-rw-r--r--video/out/hwdec/hwdec_drmprime_overlay.c (renamed from video/out/opengl/hwdec_drmprime_drm.c)6
-rw-r--r--video/out/hwdec/hwdec_vaapi.c5
-rw-r--r--wscript_build.py2
9 files changed, 36 insertions, 21 deletions
diff --git a/DOCS/man/vo.rst b/DOCS/man/vo.rst
index 5e5b1394d9..c71ebd4c45 100644
--- a/DOCS/man/vo.rst
+++ b/DOCS/man/vo.rst
@@ -614,11 +614,11 @@ Available video output drivers are:
based, and related to the CRTC.
(default: primary)
- When using this option with the drmprime-drm hwdec interop, only the OSD
- is rendered to this plane.
+ When using this option with the drmprime-overlay hwdec interop, only the
+ OSD is rendered to this plane.
``--drm-drmprime-video-plane=<primary|overlay|N>``
- Select the DRM plane to use for video with the drmprime-drm hwdec
+ Select the DRM plane to use for video with the drmprime-overlay hwdec
interop (used by e.g. the rkmpp hwdec on RockChip SoCs, and v4l2 hwdec:s
on various other SoC:s). The plane is unused otherwise. This option
accepts the same values as ``--drm-draw-plane``. (default: overlay)
@@ -644,12 +644,12 @@ Available video output drivers are:
``--drm-draw-surface-size=<[WxH]>``
Sets the size of the surface used on the draw plane. The surface will
then be upscaled to the current screen resolution. This option can be
- useful when used together with the drmprime-drm hwdec interop at high
- resolutions, as it allows scaling the draw plane (which in this case
- only handles the OSD) down to a size the GPU can handle.
+ useful when used together with the drmprime-overlay hwdec interop at
+ high resolutions, as it allows scaling the draw plane (which in this
+ case only handles the OSD) down to a size the GPU can handle.
- When used without the drmprime-drm hwdec interop this option will just
- cause the video to get rendered at a different resolution and then
+ When used without the drmprime-overlay hwdec interop this option will
+ just cause the video to get rendered at a different resolution and then
scaled to screen size.
Note: this option is only available with DRM atomic support.
diff --git a/meson.build b/meson.build
index 244977dc9c..2783490a2e 100644
--- a/meson.build
+++ b/meson.build
@@ -900,8 +900,8 @@ if features['drm']
'video/out/drm_atomic.c',
'video/out/drm_common.c',
'video/out/drm_prime.c',
- 'video/out/opengl/hwdec_drmprime_drm.c',
'video/out/hwdec/hwdec_drmprime.c',
+ 'video/out/hwdec/hwdec_drmprime_overlay.c',
'video/out/vo_drm.c')
endif
diff --git a/video/out/drm_atomic.c b/video/out/drm_atomic.c
index e615d2f9c7..dfd27c6f52 100644
--- a/video/out/drm_atomic.c
+++ b/video/out/drm_atomic.c
@@ -274,7 +274,7 @@ struct drm_atomic_context *drm_atomic_create_context(struct mp_log *log, int fd,
mp_verbose(log, "Using %s plane %d as drmprime plane\n", plane_type, drmprime_video_plane_id);
ctx->drmprime_video_plane = drm_object_create(log, ctx->fd, drmprime_video_plane_id, DRM_MODE_OBJECT_PLANE);
} else {
- mp_verbose(log, "Failed to find drmprime plane with idx=%d. drmprime-drm hwdec interop will not work\n", drmprime_video_plane_idx);
+ mp_verbose(log, "Failed to find drmprime plane with idx=%d. drmprime-overlay hwdec interop will not work\n", drmprime_video_plane_idx);
}
} else {
mp_verbose(log, "Found drmprime plane with ID %d\n", ctx->drmprime_video_plane->id);
diff --git a/video/out/gpu/hwdec.c b/video/out/gpu/hwdec.c
index 8bc60b502c..6fe6a69f4f 100644
--- a/video/out/gpu/hwdec.c
+++ b/video/out/gpu/hwdec.c
@@ -25,7 +25,7 @@
#include "options/m_config.h"
#include "hwdec.h"
-extern const struct ra_hwdec_driver ra_hwdec_vaegl;
+extern const struct ra_hwdec_driver ra_hwdec_vaapi;
extern const struct ra_hwdec_driver ra_hwdec_videotoolbox;
extern const struct ra_hwdec_driver ra_hwdec_vdpau;
extern const struct ra_hwdec_driver ra_hwdec_dxva2egl;
@@ -36,12 +36,12 @@ extern const struct ra_hwdec_driver ra_hwdec_dxva2dxgi;
extern const struct ra_hwdec_driver ra_hwdec_cuda;
extern const struct ra_hwdec_driver ra_hwdec_rpi_overlay;
extern const struct ra_hwdec_driver ra_hwdec_drmprime;
-extern const struct ra_hwdec_driver ra_hwdec_drmprime_drm;
+extern const struct ra_hwdec_driver ra_hwdec_drmprime_overlay;
extern const struct ra_hwdec_driver ra_hwdec_aimagereader;
const struct ra_hwdec_driver *const ra_hwdec_drivers[] = {
#if HAVE_VAAPI_EGL || HAVE_VAAPI_LIBPLACEBO
- &ra_hwdec_vaegl,
+ &ra_hwdec_vaapi,
#endif
#if HAVE_VIDEOTOOLBOX_GL || HAVE_IOS_GL
&ra_hwdec_videotoolbox,
@@ -73,7 +73,7 @@ const struct ra_hwdec_driver *const ra_hwdec_drivers[] = {
&ra_hwdec_rpi_overlay,
#endif
#if HAVE_DRM
- &ra_hwdec_drmprime_drm,
+ &ra_hwdec_drmprime_overlay,
&ra_hwdec_drmprime,
#endif
#if HAVE_ANDROID_MEDIA_NDK
@@ -189,6 +189,8 @@ static int ra_hwdec_validate_opt_full(struct mp_log *log, bool include_modes,
mp_info(log, " %s\n", drv->name);
} else if (bstr_equals0(param, drv->name)) {
return 1;
+ } else if (bstr_equals0(param, drv->legacy_name)) {
+ return 1;
}
}
if (help) {
@@ -279,6 +281,12 @@ void ra_hwdec_ctx_init(struct ra_hwdec_ctx *ctx, struct mp_hwdec_devices *devs,
if (strcmp(type, drv->name) == 0) {
load_add_hwdec(ctx, devs, drv, false);
break;
+ } else if (strcmp(type, drv->legacy_name) == 0) {
+ MP_WARN(ctx, "gpu-hwdec-interop was selected with the legacy name '%s'. "
+ "Please change it to '%s' in your config file or command line.\n",
+ drv->legacy_name, drv->name);
+ load_add_hwdec(ctx, devs, drv, false);
+ break;
}
}
}
diff --git a/video/out/gpu/hwdec.h b/video/out/gpu/hwdec.h
index 0dd2e14588..b0013e8775 100644
--- a/video/out/gpu/hwdec.h
+++ b/video/out/gpu/hwdec.h
@@ -127,6 +127,11 @@ struct ra_hwdec_driver {
// hw_image==src==dst==NULL is passed to clear the overlay.
int (*overlay_frame)(struct ra_hwdec *hw, struct mp_image *hw_image,
struct mp_rect *src, struct mp_rect *dst, bool newframe);
+
+ // Some interop backends have changed name over time. We record the old name
+ // so that config files and command lines continue to work when they
+ // reference the old name.
+ const char *legacy_name;
};
extern const struct ra_hwdec_driver *const ra_hwdec_drivers[];
diff --git a/video/out/hwdec/hwdec_cuda.c b/video/out/hwdec/hwdec_cuda.c
index 47428bd75f..ce53ab47fb 100644
--- a/video/out/hwdec/hwdec_cuda.c
+++ b/video/out/hwdec/hwdec_cuda.c
@@ -271,7 +271,7 @@ static int mapper_map(struct ra_hwdec_mapper *mapper)
}
const struct ra_hwdec_driver ra_hwdec_cuda = {
- .name = "cuda-nvdec",
+ .name = "cuda",
.imgfmts = {IMGFMT_CUDA, 0},
.priv_size = sizeof(struct cuda_hw_priv),
.init = cuda_init,
@@ -283,4 +283,5 @@ const struct ra_hwdec_driver ra_hwdec_cuda = {
.map = mapper_map,
.unmap = mapper_unmap,
},
+ .legacy_name = "cuda-nvdec",
};
diff --git a/video/out/opengl/hwdec_drmprime_drm.c b/video/out/hwdec/hwdec_drmprime_overlay.c
index 76afd3ff88..c0ccb75072 100644
--- a/video/out/opengl/hwdec_drmprime_drm.c
+++ b/video/out/hwdec/hwdec_drmprime_overlay.c
@@ -26,7 +26,6 @@
#include <libavutil/hwcontext.h>
#include <libavutil/hwcontext_drm.h>
-#include "common.h"
#include "video/hwdec.h"
#include "common/msg.h"
#include "options/m_config.h"
@@ -312,11 +311,12 @@ err:
return -1;
}
-const struct ra_hwdec_driver ra_hwdec_drmprime_drm = {
- .name = "drmprime-drm",
+const struct ra_hwdec_driver ra_hwdec_drmprime_overlay = {
+ .name = "drmprime-overlay",
.priv_size = sizeof(struct priv),
.imgfmts = {IMGFMT_DRMPRIME, 0},
.init = init,
.overlay_frame = overlay_frame,
.uninit = uninit,
+ .legacy_name = "drmprime-drm",
};
diff --git a/video/out/hwdec/hwdec_vaapi.c b/video/out/hwdec/hwdec_vaapi.c
index f827bd1a85..c0a0c44a25 100644
--- a/video/out/hwdec/hwdec_vaapi.c
+++ b/video/out/hwdec/hwdec_vaapi.c
@@ -464,8 +464,8 @@ done:
MP_VERBOSE(hw, "Done probing surface formats.\n");
}
-const struct ra_hwdec_driver ra_hwdec_vaegl = {
- .name = "vaapi-egl",
+const struct ra_hwdec_driver ra_hwdec_vaapi = {
+ .name = "vaapi",
.priv_size = sizeof(struct priv_owner),
.imgfmts = {IMGFMT_VAAPI, 0},
.init = init,
@@ -477,4 +477,5 @@ const struct ra_hwdec_driver ra_hwdec_vaegl = {
.map = mapper_map,
.unmap = mapper_unmap,
},
+ .legacy_name = "vaapi-egl"
};
diff --git a/wscript_build.py b/wscript_build.py
index a22fd1f38f..dc87e45d4c 100644
--- a/wscript_build.py
+++ b/wscript_build.py
@@ -474,6 +474,7 @@ def build(ctx):
( "video/out/hwdec/hwdec_cuda_gl.c", "cuda-interop && gl" ),
( "video/out/hwdec/hwdec_cuda_vk.c", "cuda-interop && vulkan" ),
( "video/out/hwdec/hwdec_drmprime.c", "drm" ),
+ ( "video/out/hwdec/hwdec_drmprime_overlay.c","drm" ),
( "video/out/hwdec/hwdec_vaapi.c", "vaapi-egl || vaapi-libplacebo" ),
( "video/out/hwdec/dmabuf_interop_gl.c", "dmabuf-interop-gl" ),
( "video/out/hwdec/dmabuf_interop_pl.c", "dmabuf-interop-pl" ),
@@ -496,7 +497,6 @@ def build(ctx):
( "video/out/opengl/egl_helpers.c", "egl-helpers" ),
( "video/out/opengl/formats.c", "gl" ),
( "video/out/opengl/hwdec_d3d11egl.c", "d3d-hwaccel && egl-angle" ),
- ( "video/out/opengl/hwdec_drmprime_drm.c","drm" ),
( "video/out/opengl/hwdec_dxva2egl.c", "d3d9-hwaccel && egl-angle" ),
( "video/out/opengl/hwdec_dxva2gldx.c", "gl-dxinterop-d3d9" ),
( "video/out/opengl/hwdec_ios.m", "ios-gl" ),