mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-10-28 10:04:37 +08:00
swscale: gate Vulkan support on the SPIR-V backend being available
If Vulkan was enabled but no SPIR-V headers were found, the Vulkan code in swscale was still compiled, but no backend was exported. Vulkan frames were still reported as supported by sws_test_hw_format(). Add a swscale_vulkan configure symbol, enabled when Vulkan and either SPIR-V header are available, and use it for all Vulkan code in swscale and for the spirv FATE tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
61a1dde02d
commit
a5f05c8615
9 files changed
+15
-22
No files matched your search
@@ -2794,6 +2794,7 @@ CONFIG_EXTRA="
|
||||
snappy
|
||||
srtp
|
||||
startcode
|
||||
swscale_vulkan
|
||||
texturedsp
|
||||
texturedspenc
|
||||
tpeldsp
|
||||
@@ -3363,6 +3364,8 @@ vulkan_deps="threads"
|
||||
vulkan_deps_any="libdl LoadLibrary"
|
||||
spirv_headers_spirv_h_deps="vulkan"
|
||||
spirv_unified1_spirv_h_deps="vulkan"
|
||||
swscale_vulkan_deps="vulkan"
|
||||
swscale_vulkan_if_any="spirv_headers_spirv_h spirv_unified1_spirv_h"
|
||||
|
||||
apv_vulkan_hwaccel_deps="vulkan spirv_compiler"
|
||||
apv_vulkan_hwaccel_select="apv_decoder"
|
||||
|
||||
+1
-1
@@ -643,7 +643,7 @@ int sws_test_hw_format(enum AVPixelFormat format)
|
||||
{
|
||||
switch (format) {
|
||||
case AV_PIX_FMT_NONE: return 1;
|
||||
#if CONFIG_VULKAN
|
||||
#if CONFIG_SWSCALE_VULKAN
|
||||
case AV_PIX_FMT_VULKAN: return 1;
|
||||
#endif
|
||||
default: return 0;
|
||||
|
||||
+4
-4
@@ -39,7 +39,7 @@
|
||||
#include "graph.h"
|
||||
#include "ops.h"
|
||||
#include "ops_dispatch.h"
|
||||
#if CONFIG_VULKAN
|
||||
#if CONFIG_SWSCALE_VULKAN
|
||||
#include "vulkan/ops.h"
|
||||
#endif
|
||||
|
||||
@@ -102,7 +102,7 @@ static int frame_alloc_planes_ref(AVFrame *dst, const AVFrame *src,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CONFIG_VULKAN
|
||||
#if CONFIG_SWSCALE_VULKAN
|
||||
static int pass_alloc_output_hw(SwsPass *pass, AVFrame *avframe,
|
||||
AVBufferRef *dev_ref)
|
||||
{
|
||||
@@ -141,7 +141,7 @@ static int pass_alloc_output(SwsPass *pass)
|
||||
|
||||
int ret;
|
||||
|
||||
#if CONFIG_VULKAN
|
||||
#if CONFIG_SWSCALE_VULKAN
|
||||
const SwsGraph *graph = pass->graph;
|
||||
if (graph->src.hw_format == AV_PIX_FMT_VULKAN &&
|
||||
graph->dst.hw_format == AV_PIX_FMT_VULKAN) {
|
||||
@@ -166,7 +166,7 @@ static int pass_alloc_output(SwsPass *pass)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if CONFIG_VULKAN
|
||||
#if CONFIG_SWSCALE_VULKAN
|
||||
done:
|
||||
#endif
|
||||
buffer->avframe = avframe;
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ extern const SwsOpBackend backend_c;
|
||||
extern const SwsOpBackend backend_murder;
|
||||
extern const SwsOpBackend backend_aarch64;
|
||||
extern const SwsOpBackend backend_x86;
|
||||
#if HAVE_SPIRV_HEADERS_SPIRV_H || HAVE_SPIRV_UNIFIED1_SPIRV_H
|
||||
#if CONFIG_SWSCALE_VULKAN
|
||||
extern const SwsOpBackend backend_spirv;
|
||||
#endif
|
||||
|
||||
@@ -47,7 +47,7 @@ const SwsOpBackend * const ff_sws_op_backends[] = {
|
||||
&backend_x86,
|
||||
#endif
|
||||
&backend_c,
|
||||
#if HAVE_SPIRV_HEADERS_SPIRV_H || HAVE_SPIRV_UNIFIED1_SPIRV_H
|
||||
#if CONFIG_SWSCALE_VULKAN
|
||||
&backend_spirv,
|
||||
#endif
|
||||
NULL
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "config.h"
|
||||
#include "swscale_internal.h"
|
||||
#include "swscale.h"
|
||||
#if CONFIG_VULKAN
|
||||
#if CONFIG_SWSCALE_VULKAN
|
||||
#include "vulkan/ops.h"
|
||||
#endif
|
||||
|
||||
@@ -1542,7 +1542,7 @@ int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, const AVFrame *src)
|
||||
if (dev_ctx->type != AV_HWDEVICE_TYPE_VULKAN)
|
||||
return AVERROR(ENOTSUP);
|
||||
|
||||
#if CONFIG_UNSTABLE && CONFIG_VULKAN
|
||||
#if CONFIG_UNSTABLE && CONFIG_SWSCALE_VULKAN
|
||||
ret = ff_sws_vk_init(ctx, src_hwfc->device_ref);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@
|
||||
#include "graph.h"
|
||||
#include "jit.h"
|
||||
|
||||
#if CONFIG_VULKAN
|
||||
#if CONFIG_SWSCALE_VULKAN
|
||||
#include "vulkan/ops.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
clean::
|
||||
$(RM) $(CLEANSUFFIXES:%=libswscale/vulkan/%)
|
||||
|
||||
OBJS-$(CONFIG_VULKAN) += vulkan/ops.o vulkan/vulkan.o
|
||||
OBJS-$(CONFIG_SWSCALE_VULKAN) += vulkan/ops.o vulkan/vulkan.o
|
||||
@@ -27,9 +27,7 @@
|
||||
|
||||
#include "ops.h"
|
||||
|
||||
#if HAVE_SPIRV_HEADERS_SPIRV_H || HAVE_SPIRV_UNIFIED1_SPIRV_H
|
||||
#include "spvasm.h"
|
||||
#endif
|
||||
|
||||
static void ff_sws_vk_uninit(AVRefStructOpaque opaque, void *obj)
|
||||
{
|
||||
@@ -278,7 +276,6 @@ fail:
|
||||
return err;
|
||||
}
|
||||
|
||||
#if HAVE_SPIRV_HEADERS_SPIRV_H || HAVE_SPIRV_UNIFIED1_SPIRV_H
|
||||
struct DitherData {
|
||||
int size;
|
||||
int arr_1d_id;
|
||||
@@ -1276,7 +1273,6 @@ static int add_ops_spirv(SwsContext *sws, VulkanPriv *p, FFVulkanOpsCtx *s,
|
||||
|
||||
return ff_vk_shader_link(&s->vkctx, shd, spvbuf, len, "main");
|
||||
}
|
||||
#endif
|
||||
|
||||
static int compile(SwsContext *sws, const SwsOpList *ops, SwsCompiledOp *out)
|
||||
{
|
||||
@@ -1296,10 +1292,7 @@ static int compile(SwsContext *sws, const SwsOpList *ops, SwsCompiledOp *out)
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
err = AVERROR(ENOTSUP);
|
||||
#if HAVE_SPIRV_HEADERS_SPIRV_H || HAVE_SPIRV_UNIFIED1_SPIRV_H
|
||||
err = add_ops_spirv(sws, p, s, ops, &p->shd);
|
||||
#endif
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
|
||||
@@ -1326,7 +1319,6 @@ fail:
|
||||
return err;
|
||||
}
|
||||
|
||||
#if HAVE_SPIRV_HEADERS_SPIRV_H || HAVE_SPIRV_UNIFIED1_SPIRV_H
|
||||
static int compile_spirv(SwsContext *sws, const SwsOpList *ops,
|
||||
SwsCompiledOp *out)
|
||||
{
|
||||
@@ -1339,4 +1331,3 @@ const SwsOpBackend backend_spirv = {
|
||||
.compile = compile_spirv,
|
||||
.hw_format = AV_PIX_FMT_VULKAN,
|
||||
};
|
||||
#endif
|
||||
@@ -54,8 +54,7 @@ endif
|
||||
ifeq ($(ARCH_AARCH64),yes)
|
||||
SWS_UNSTABLE_BACKENDS-$(HAVE_NEON) += aarch64
|
||||
endif
|
||||
SWS_UNSTABLE_BACKENDS-$(HAVE_SPIRV_HEADERS_SPIRV_H) += spirv
|
||||
SWS_UNSTABLE_BACKENDS-$(HAVE_SPIRV_UNIFIED1_SPIRV_H) += spirv
|
||||
SWS_UNSTABLE_BACKENDS-$(CONFIG_SWSCALE_VULKAN) += spirv
|
||||
|
||||
# Set -hw default for Vulkan tests.
|
||||
fate-sws-unscaled-spirv fate-sws-unstable-spirv: SWS_HW = -hw default
|
||||
|
||||
Reference in new issue
Block a user