* [FFmpeg-devel] [PATCH] vulkan: Fix win/i386 calling convention and pointer/int conversion error
@ 2023-03-05 21:39 Martin Storsjö
2023-03-06 8:58 ` Martin Storsjö
0 siblings, 1 reply; 2+ messages in thread
From: Martin Storsjö @ 2023-03-05 21:39 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Martin Storsjö
This fixes the following two errors 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,
^~~~~~~~~~~~~~~
src/libavutil/hwcontext_vulkan.c:1152:15: error: incompatible pointer to integer conversion assigning to 'VkCommandPool' (aka 'unsigned long long') from 'void *' [-Wint-conversion]
cmd->pool = NULL;
^ ~~~~
2 errors generated.
The calling convention mismatch is an issue only on Windows/i386,
while the latter is a hard error by default in modern Clang whenever
pointers are smaller than unsigned long long.
Signed-off-by: Martin Storsjö <martin@martin.st>
---
libavutil/hwcontext_vulkan.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 2a9b5f4aac..2ae469283d 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;
@@ -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 = 0;
}
static VkCommandBuffer get_buf_exec_ctx(AVHWFramesContext *hwfc, VulkanExecCtx *cmd)
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [FFmpeg-devel] [PATCH] vulkan: Fix win/i386 calling convention and pointer/int conversion error
2023-03-05 21:39 [FFmpeg-devel] [PATCH] vulkan: Fix win/i386 calling convention and pointer/int conversion error Martin Storsjö
@ 2023-03-06 8:58 ` Martin Storsjö
0 siblings, 0 replies; 2+ messages in thread
From: Martin Storsjö @ 2023-03-06 8:58 UTC (permalink / raw)
To: ffmpeg-devel
On Sun, 5 Mar 2023, Martin Storsjö wrote:
> This fixes the following two errors 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,
> ^~~~~~~~~~~~~~~
> src/libavutil/hwcontext_vulkan.c:1152:15: error: incompatible pointer to integer conversion assigning to 'VkCommandPool' (aka 'unsigned long long') from 'void *' [-Wint-conversion]
> cmd->pool = NULL;
> ^ ~~~~
> 2 errors generated.
>
> The calling convention mismatch is an issue only on Windows/i386,
> while the latter is a hard error by default in modern Clang whenever
> pointers are smaller than unsigned long long.
>
> Signed-off-by: Martin Storsjö <martin@martin.st>
> ---
> libavutil/hwcontext_vulkan.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
> index 2a9b5f4aac..2ae469283d 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;
> @@ -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 = 0;
> }
>
> static VkCommandBuffer get_buf_exec_ctx(AVHWFramesContext *hwfc, VulkanExecCtx *cmd)
> --
> 2.34.1
OK'd by Lynne on irc. She also noted that the latter code gets removed by
her pending patchsets - but I think it's good to have a fix for the
existing code forms, for backporting.
I was pointed to an existing patch by Kacper Michajłow that also fixes the
other issue in a better way, so I'll refrain from pushing that part of my
fix.
// Martin
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-06 8:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-05 21:39 [FFmpeg-devel] [PATCH] vulkan: Fix win/i386 calling convention and pointer/int conversion error Martin Storsjö
2023-03-06 8:58 ` Martin Storsjö
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git