hwdec_vaapi_vk: rename to vaapi_pl

There's really nothing vulkan-specific about this hwdec wrapper, and it
actually works perfectly fine with an OpenGL-based ra_pl. This is not
hugely important at the time, but I still think it makes sense in case
we ever decide to make vo_gpu_next wrap OpenGL contexts to ra_pl instead
of exposing the underlying ra_gl.
This commit is contained in:
Niklas Haas 2022-02-26 15:13:10 +01:00 committed by Niklas Haas
parent 4387f3bcd0
commit e2c02a4ce3
6 changed files with 25 additions and 26 deletions

View File

@ -1470,16 +1470,16 @@ if vaapi_egl['use']
sources += files('video/out/hwdec/hwdec_vaapi_gl.c')
endif
vaapi_vulkan = {
'name': 'vaapi-vulkan',
'use': vaapi['use'] and vulkan.found(),
vaapi_libplacebo = {
'name': 'vaapi-libplacebo',
'use': vaapi['use'] and libplacebo.found(),
}
if vaapi_vulkan['use']
features += vaapi_vulkan['name']
sources += files('video/out/hwdec/hwdec_vaapi_vk.c')
if vaapi_libplacebo['use']
features += vaapi_libplacebo['name']
sources += files('video/out/hwdec/hwdec_vaapi_pl.c')
endif
if vaapi_egl['use'] or vaapi_vulkan['use']
if vaapi_egl['use'] or vaapi_libplacebo['use']
sources += files('video/out/hwdec/hwdec_vaapi.c')
endif
@ -1776,7 +1776,7 @@ conf_data.set10('HAVE_UWP', uwp.found())
conf_data.set10('HAVE_VAAPI', vaapi['use'])
conf_data.set10('HAVE_VAAPI_DRM', vaapi_drm['use'])
conf_data.set10('HAVE_VAAPI_EGL', vaapi_egl['use'])
conf_data.set10('HAVE_VAAPI_VULKAN', vaapi_vulkan['use'])
conf_data.set10('HAVE_VAAPI_LIBPLACEBO', vaapi_libplacebo['use'])
conf_data.set10('HAVE_VAAPI_WAYLAND', vaapi_wayland['use'])
conf_data.set10('HAVE_VAAPI_X11', vaapi_x11['use'])
conf_data.set10('HAVE_VAPOURSYNTH', vapoursynth.found() and vapoursynth_script.found())

View File

@ -111,8 +111,8 @@ const static vaapi_interop_init interop_inits[] = {
#if HAVE_VAAPI_EGL
vaapi_gl_init,
#endif
#if HAVE_VAAPI_VULKAN
vaapi_vk_init,
#if HAVE_VAAPI_LIBPLACEBO
vaapi_pl_init,
#endif
NULL
};

View File

@ -52,5 +52,4 @@ struct priv {
typedef bool (*vaapi_interop_init)(const struct ra_hwdec *hw);
bool vaapi_gl_init(const struct ra_hwdec *hw);
bool vaapi_vk_init(const struct ra_hwdec *hw);
bool vaapi_pl_init(const struct ra_hwdec *hw);

View File

@ -23,7 +23,7 @@
#include "video/out/placebo/ra_pl.h"
#include "video/out/placebo/utils.h"
static bool vaapi_vk_map(struct ra_hwdec_mapper *mapper, bool probing)
static bool vaapi_pl_map(struct ra_hwdec_mapper *mapper, bool probing)
{
struct priv *p = mapper->priv;
pl_gpu gpu = ra_pl_get(mapper->ra);
@ -102,31 +102,31 @@ static bool vaapi_vk_map(struct ra_hwdec_mapper *mapper, bool probing)
return true;
}
static void vaapi_vk_unmap(struct ra_hwdec_mapper *mapper)
static void vaapi_pl_unmap(struct ra_hwdec_mapper *mapper)
{
for (int n = 0; n < 4; n++)
ra_tex_free(mapper->ra, &mapper->tex[n]);
}
bool vaapi_vk_init(const struct ra_hwdec *hw)
bool vaapi_pl_init(const struct ra_hwdec *hw)
{
struct priv_owner *p = hw->priv;
pl_gpu gpu = ra_pl_get(hw->ra);
if (!gpu) {
// This is not a Vulkan RA;
// This is not a libplacebo RA;
return false;
}
if (!(gpu->import_caps.tex & PL_HANDLE_DMA_BUF)) {
MP_VERBOSE(hw, "VAAPI Vulkan interop requires support for "
"dma_buf import in Vulkan.\n");
MP_VERBOSE(hw, "VAAPI libplacebo interop requires support for "
"PL_HANDLE_DMA_BUF import.\n");
return false;
}
MP_VERBOSE(hw, "using VAAPI Vulkan interop\n");
MP_VERBOSE(hw, "using VAAPI libplacebo interop\n");
p->interop_map = vaapi_vk_map;
p->interop_unmap = vaapi_vk_unmap;
p->interop_map = vaapi_pl_map;
p->interop_unmap = vaapi_pl_unmap;
return true;
}

View File

@ -751,9 +751,9 @@ video_output_features = [
'deps': 'libplacebo',
'func': check_pkg_config('vulkan'),
}, {
'name': 'vaapi-vulkan',
'desc': 'VAAPI Vulkan',
'deps': 'vaapi && vulkan',
'name': 'vaapi-libplacebo',
'desc': 'VAAPI libplacebo',
'deps': 'vaapi && libplacebo',
'func': check_true,
}, {
'name': 'egl-helpers',

View File

@ -457,9 +457,9 @@ def build(ctx):
( "video/out/hwdec/hwdec_cuda.c", "cuda-interop" ),
( "video/out/hwdec/hwdec_cuda_gl.c", "cuda-interop && gl" ),
( "video/out/hwdec/hwdec_cuda_vk.c", "cuda-interop && vulkan" ),
( "video/out/hwdec/hwdec_vaapi.c", "vaapi-egl || vaapi-vulkan" ),
( "video/out/hwdec/hwdec_vaapi.c", "vaapi-egl || vaapi-libplacebo" ),
( "video/out/hwdec/hwdec_vaapi_gl.c", "vaapi-egl" ),
( "video/out/hwdec/hwdec_vaapi_vk.c", "vaapi-vulkan" ),
( "video/out/hwdec/hwdec_vaapi_pl.c", "vaapi-libplacebo" ),
( "video/out/libmpv_sw.c" ),
( "video/out/placebo/ra_pl.c", "libplacebo" ),
( "video/out/placebo/utils.c", "libplacebo" ),