You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-11-23 21:54:53 +02:00
hwcontext_vulkan: rewrite upload/download
This commit was long overdue. The old transfer dubiously tried to merge as much code as possible, and had very little in the way of optimizations, apart from basic host-mapping. The new code uses buffer pools for any temporary bufflers, and handles falling back to buffer-based uploads if host-mapping fails. Roundtrip performance difference: ffmpeg -init_hw_device "vulkan=vk:0,debug=0,disable_multiplane=1" -f lavfi \ -i color=red:s=3840x2160 -vf hwupload,hwdownload,format=yuv420p -f null - 7900XTX: Before: 224fps After: 502fps Ada, with proprietary drivers: Before: 29fps After: 54fps Alder Lake: Before: 85fps After: 108fps With the host-mapping codepath disabled: Before: 32fps After: 51fps
This commit is contained in:
@@ -809,11 +809,8 @@ int ff_vk_alloc_mem(FFVulkanContext *s, VkMemoryRequirements *req,
|
||||
|
||||
ret = vk->AllocateMemory(s->hwctx->act_dev, &alloc_info,
|
||||
s->hwctx->alloc, mem);
|
||||
if (ret != VK_SUCCESS) {
|
||||
av_log(s, AV_LOG_ERROR, "Failed to allocate memory: %s\n",
|
||||
ff_vk_ret2str(ret));
|
||||
if (ret != VK_SUCCESS)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
if (mem_flags)
|
||||
*mem_flags |= s->mprops.memoryTypes[index].propertyFlags;
|
||||
|
||||
Reference in New Issue
Block a user