Skip to content
Snippets Groups Projects
Commit 29e86638 authored by Martin Storsjö's avatar Martin Storsjö Committed by Steve Lhomme
Browse files

contrib: ffmpeg: Apply patches for vulkan on 32 bit architectures

This fixes building with modern Clang for 32 bit architectures.
Integer/pointer conversion issues (visible on 32 bit architectures)
that only are warnings in older compilers have been made hard errors
in recent versions of Clang.

This issue appeared in VLC after ffmpeg was updated to the 5.1 version.
parent c4a656a7
No related branches found
No related tags found
1 merge request!3379contrib: ffmpeg: Apply patches for vulkan on 32 bit architectures
Pipeline #320701 passed with stage
in 57 minutes and 23 seconds
From 2d5f9c9a5472ec826ab9e3f2d3e1ded11aeecd4b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Sun, 5 Mar 2023 23:36:53 +0200
Subject: [PATCH 1/2] vulkan: Fix win/i386 calling convention
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This fixes the following error when compiling with a modern
version of Clang for Windows/i386:
src/libavutil/hwcontext_vulkan.c:738:32: error: incompatible function pointer types initializing 'PFN_vkDebugUtilsMessengerCallbackEXT' (aka 'unsigned int (*)(enum VkDebugUtilsMessageSeverityFlagBitsEXT, unsigned int, const struct VkDebugUtilsMessengerCallbackDataEXT *, void *) __attribute__((stdcall))') with an expression of type 'VkBool32 (VkDebugUtilsMessageSeverityFlagBitsEXT, VkDebugUtilsMessageTypeFlagsEXT, const VkDebugUtilsMessengerCallbackDataEXT *, void *)' (aka 'unsigned int (enum VkDebugUtilsMessageSeverityFlagBitsEXT, unsigned int, const struct VkDebugUtilsMessengerCallbackDataEXT *, void *)') [-Wincompatible-function-pointer-types]
.pfnUserCallback = vk_dbg_callback,
^~~~~~~~~~~~~~~
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit f9620d74cd49c35223304ba41e28be6144e45783)
---
libavutil/hwcontext_vulkan.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 2a9b5f4aac..5b86aa65e9 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -401,10 +401,10 @@ static const char *vk_ret2str(VkResult res)
#undef CASE
}
-static VkBool32 vk_dbg_callback(VkDebugUtilsMessageSeverityFlagBitsEXT severity,
- VkDebugUtilsMessageTypeFlagsEXT messageType,
- const VkDebugUtilsMessengerCallbackDataEXT *data,
- void *priv)
+static VkBool32 VKAPI_CALL vk_dbg_callback(VkDebugUtilsMessageSeverityFlagBitsEXT severity,
+ VkDebugUtilsMessageTypeFlagsEXT messageType,
+ const VkDebugUtilsMessengerCallbackDataEXT *data,
+ void *priv)
{
int l;
AVHWDeviceContext *ctx = priv;
--
2.34.1
From 0ce6b348746c3c0fc5cb4f1494c50bcca9a28172 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
Date: Thu, 2 Mar 2023 17:27:30 +0100
Subject: [PATCH 2/2] lavu/vulkan: fix handle type for 32-bit targets
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fixes compilation with clang which errors out on Wint-conversion.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit cc76e8340d28438c1ac56ee7dfd774d25e944264)
---
libavutil/hwcontext_vulkan.c | 2 +-
libavutil/vulkan.h | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 5b86aa65e9..ffd4f5dec4 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -1149,7 +1149,7 @@ static void free_exec_ctx(AVHWFramesContext *hwfc, VulkanExecCtx *cmd)
av_freep(&cmd->queues);
av_freep(&cmd->bufs);
- cmd->pool = NULL;
+ cmd->pool = VK_NULL_HANDLE;
}
static VkCommandBuffer get_buf_exec_ctx(AVHWFramesContext *hwfc, VulkanExecCtx *cmd)
diff --git a/libavutil/vulkan.h b/libavutil/vulkan.h
index d1ea1e24fb..90922c6cf3 100644
--- a/libavutil/vulkan.h
+++ b/libavutil/vulkan.h
@@ -122,7 +122,11 @@ typedef struct FFVulkanPipeline {
VkDescriptorSetLayout *desc_layout;
VkDescriptorPool desc_pool;
VkDescriptorSet *desc_set;
+#if VK_USE_64_BIT_PTR_DEFINES == 1
void **desc_staging;
+#else
+ uint64_t *desc_staging;
+#endif
VkDescriptorSetLayoutBinding **desc_binding;
VkDescriptorUpdateTemplate *desc_template;
int *desc_set_initialized;
--
2.34.1
......@@ -226,6 +226,8 @@ ffmpeg: ffmpeg-$(FFMPEG_VERSION).tar.xz .sum-ffmpeg
$(APPLY) $(SRC)/ffmpeg/0002-avcodec-mpeg12dec-don-t-end-a-slice-without-first_sl.patch
$(APPLY) $(SRC)/ffmpeg/0001-fix-mf_utils-compilation-with-mingw64.patch
$(APPLY) $(SRC)/ffmpeg/0001-ffmpeg-add-target_os-support-for-emscripten.patch
$(APPLY) $(SRC)/ffmpeg/0001-vulkan-Fix-win-i386-calling-convention.patch
$(APPLY) $(SRC)/ffmpeg/0002-lavu-vulkan-fix-handle-type-for-32-bit-targets.patch
$(MOVE)
.ffmpeg: ffmpeg
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment