aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/hwcontext_vulkan.c
Commit message (Collapse)AuthorAgeFilesLines
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-311-1/+1
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* vulkan_av1: port to the new stable APILynne2024-03-251-1/+1
| | | | Co-Authored-by: Dave Airlie <airlied@redhat.com>
* lavu/hwcontext_vulkan: check PCI ID if possibleHaihao Xiang2024-03-191-7/+23
| | | | | | | | Otherwise the derived device and the source device might have different PCI ID in a multiple-device system. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* avutil/hwcontext: Allocate AVHWFramesCtx jointly with its internalsAndreas Rheinhardt2024-03-071-4/+4
| | | | | | | | | | | This is possible because the lifetime of these structures coincide. It has the advantage of allowing to remove AVHWFramesInternal from the public header; given that AVHWFramesInternal.priv is no more, most accesses to AVHWFramesInternal are no more; indeed, the only field accessed of it outside of hwcontext.c is the internal frame pool, making this commit very simple. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_vulkan: Allocate pub and priv frames hwctx togetherAndreas Rheinhardt2024-03-011-13/+17
| | | | | | | | | This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to VulkanFramesPriv as one no longer has to go through AVHWFramesInternal. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_vulkan: Allocate public and priv device hwctx togetherAndreas Rheinhardt2024-03-011-53/+56
| | | | | | | | | This is possible because the lifetime of both coincide. Besides reducing the number of allocations this also simplifies access to VulkanDevicePriv as one no longer has to go through AVHWDeviceInternal. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_vulkan: Fix memleaks when transfer to vulkanZhao Zhili2024-03-011-3/+1
| | | | | | | | | | Without ff_vk_exec_discard_deps which is called by ff_vk_exec_wait, the reference count of hwframe context cannot reach zero due to circular reference created by ff_vk_exec_add_dep_frame. Fix #10873 Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avutil/hwcontext_vulkan: Fix leaks in map_from_drmZhao Zhili2024-03-011-9/+3
| | | | | | Also simplify error handing. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avutil/hwcontext_vulkan: Fix leaks when semaphore creation failsZhao Zhili2024-03-011-10/+17
| | | | Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* hwcontext_vulkan: guard unistd.h includeBenjamin Cheng2023-12-111-1/+1
| | | | | | win32 typically doesn't have unistd.h, so always including it will break MSVC builds. The usage of those POSIX functions are already guarded by _WIN32, so use that to guard unistd.h include as well.
* apply spelling fixesDiederik de Haas via ffmpeg-devel2023-11-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Fix spelling issue as reported by Debian's lintian tool: accomodate -> accommodate addtional -> additional auxillary -> auxiliary bellow -> below betweeen -> between Calulate -> Calculate coefficents -> coefficients Defalt -> Default defaul -> default higer -> higher neccesary -> necessary orignal -> original ouput -> output precison -> precision processsing -> processing substract -> subtract Transfered -> Transferred upto -> up to Also add several of them to the 'common typos' check in patcheck. Signed-off-by: Diederik de Haas <didi.debian@cknow.org>
* avutil/hwcontext_vulkan: get VkFormatFeatureFlagBits2Víctor Manuel Jáquez Leal2023-11-091-4/+6
| | | | | | Rather than the VkFormatFeatureFlagBits enum Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
* avutil/hwcontext_vulkan: fix run on macOSZhao Zhili2023-11-091-1/+10
| | | | | | | | VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME is required on macOS, and VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR flag should be set. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avutil/hwcontext_vulkan: cuda doesn't belong to valid_sw_formatsZhao Zhili2023-10-291-12/+13
| | | | | | Move it to transfer_get_formats. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avutil/hwcontext_vulkan: fix memleak when device_create is skippedZhao Zhili2023-10-291-3/+14
| | | | Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* hwcontext_vulkan: improve queue family init codeLynne2023-10-241-7/+7
| | | | | | | | When users zero-init'd the struct, or left it as-is, the encode queue family matched the graphics queue family, which led it to be incorrectly logged as being used for encode. This just improves the logging so this isn't printed anymore.
* hwcontext_vulkan: properly support STORAGE usage for mutliplane imagesLynne2023-10-051-12/+24
| | | | | | | | Fixes multiplane support on Nvidia. Also, remove the ENCODE usage, even if the driver signals it as supported. Currently, it's not used, and when it is used, it'll be gated behind two extension checks.
* avutil/hwcontext_vulkan: CosmeticsAndreas Rheinhardt2023-09-151-3/+4
| | | | | | | | | The alignment in vulkan_unmap_from_drm() (formerly the clone of vulkan_frame_free()) is nicer than the in vulkan_frame_free(), let's preserve it. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_vulkan: Deduplicate codeAndreas Rheinhardt2023-09-151-25/+1
| | | | | Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_vulkan: Improve type-safetyAndreas Rheinhardt2023-09-151-8/+11
| | | | | | | | | | | | | | | The AVBuffer API uses uint8_t as base type for buffers and therefore its free callbacks need to abide by this. Therefore vulkan_frame_free() used an inappropriate signature which caused casts whenever this function has been called manually. This commit changes this by making vulkan_frame_free() use the proper type and a vulkan_frame_free_cb() that is used as free callback for the AVBuffer API. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/hwcontext_vulkan: Remove redundant resettingAndreas Rheinhardt2023-09-151-2/+0
| | | | | | | | vulkan_free_internal() already resets the AVVkFrame.internal pointer. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* vulkan: enable VK_KHR_cooperative_matrixLynne2023-08-261-2/+12
| | | | | It's of interest to API users, and of interest to us, as a DCT/DST can be implemented via matrix multiplies.
* hwcontext_vulkan: always use create_pnext in vulkan_pool_allocChris Spencer2023-08-201-1/+2
| | | | | | | | | | | | | Currently, create_pnext is only used if an applicable external memory extension is enabled. This will usually the case when used from the command line, but may not be when the Vulkan context is created manually. For images used in video decoding, create_pnext contains the video profile list, which is mandatory.[1] This fixes a GPU crash when using RADV. [1] https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkImageCreateInfo.html#VUID-VkImageCreateInfo-usage-04815 Signed-off-by: Chris Spencer <spencercw@gmail.com>
* hwcontext_vulkan: hide Linux-only header after 571756bf2fe2Jan Beich2023-07-211-0/+2
| | | | | | | | major/minor are in <sys/types.h> on BSDs and <sys/mkdev.h> on Solaris-like. libavutil/hwcontext_vulkan.c:55:10: fatal error: 'sys/sysmacros.h' file not found #include <sys/sysmacros.h> ^~~~~~~~~~~~~~~~~
* hwcontext_vulkan: free temporary array once unneededLynne2023-06-151-2/+9
| | | | | Fixes a small memory leak. This also prevents leaks on malloc/mutex init errors.
* hwcontext_vulkan: call ff_vk_uninit() on device uninitLynne2023-06-151-0/+2
| | | | This fixes three memory leaks from ff_vk_load_props().
* hwcontext_vulkan: tune execution poolsLynne2023-06-071-3/+3
| | | | Having less in-flight resources is better in this case.
* avutil/hwcontext_vulkan: disable multiplane when deriving from cudaPhilip Langdale2023-06-031-7/+18
| | | | | | | | | | | | | | | | | | | | | Today, cuda is not able to import multiplane images, and cuda requires images to be imported whether you trying to import to cuda or export from cuda (in the later case, the image is imported and then copied into on the cuda side). So any interop between cuda and vulkan requires that multiplane be disabled. The existing option for this is not sufficient, because when deriving devices it is not possible to specify any options. And, it is necessary to derive the Vulkan device, because any pipeline that involves uploading from cuda to vulkan and then back to cuda must use the same cuda context on both sides, and the only way to propagate the cuda context all the way through is to derive the device at each stage. ie: -vf hwupload=derive_device=vulkan,<filters>,hwupload=derive_device=cuda
* vulkan: add support for the atomic float ops extensionLynne2023-05-291-1/+14
|
* av1dec: add Vulkan hwaccelLynne2023-05-291-0/+1
|
* avutil/hwcontext_vulkan: add libplacebo required featuresNiklas Haas2023-05-291-0/+3
| | | | For compatibility with vf_libplacebo
* hwcontext_vulkan: enable additional device propertiesLynne2023-05-291-1/+20
|
* hwcontext_vulkan: remove duplicate code, port to use generic vulkan utilsLynne2023-05-291-810/+195
| | | | | | | | | | | The temporary AVFrame on staack enables us to use the common dependency/dispatch code in prepare_frame(). The prepare_frame() function is used for both frame initialization and frame import/export queue family transfer operations. In the former case, no AVFrame exists yet, so, as this is purely libavutil code, we create a temporary frame on stack. Otherwise, we'd need to allocate multiple frames somewhere, one for each possible command buffer dispatch.
* hwcontext_vulkan: don't change properties if prepare_frame failsLynne2023-05-291-9/+10
|
* hwcontext_vulkan: remove linear+host_visible "fast" pathLynne2023-05-291-156/+2
| | | | | | | | | | | The idea was that it's faster to map linear images and copy them via regular memcpy. This is a very niche use, plus very inconsistently useful, as it would only really be faster on a few Intel GPUs. Even then, using the non-cached memcpy would've been better. Instead, scrap this code. Drivers are better at figuring out what copy to use, and if we're host-mapping, it should actually be just as fast, if not faster.
* hwcontext_vulkan: rewrite to support multiplane surfacesLynne2023-05-291-366/+425
| | | | | | This commit adds proper handling of multiplane images throughout all of the hwcontext code. To avoid breakage of individual components, the change is performed as a single commit.
* hwcontext_vulkan: enable GPU-assisted validation when debuggingLynne2023-05-291-0/+14
|
* hwcontext_vulkan: support PREP_MODE_DECODING in prepare_frame()Lynne2023-05-291-19/+48
|
* hwcontext_vulkan: add functions for video decodingLynne2023-05-291-0/+6
|
* hwcontext_vulkan: use VK_EXT_physical_device_drm to derive DRM to VulkanLynne2023-05-291-5/+53
| | | | Finally, a way to directly identify a Vulkan device from a DRM device!
* hwcontext_vulkan: do not require libdrm to map VAAPI devicesLynne2023-05-291-5/+8
| | | | VAAPI is sadly on the way of becoming multiplaform.
* hwcontext_vulkan: add support for descriptor buffersLynne2023-05-291-1/+12
|
* hwcontext_vulkan: report nonCoherentAtomSizeLynne2023-05-291-0/+2
|
* hwcontext_vulkan: fix minor type issue in VulkanQueueCtx.buf_deps_alloc_sizeLynne2023-05-291-1/+1
|
* hwcontext_vulkan: rename and expand vk_pixfmt_map to append VK_NULL_FORMATLynne2023-05-291-5/+5
|
* hwcontext_vulkan: remove contiguous memory path/modeLynne2023-05-291-12/+0
| | | | | | | | | | | | | | | | | The hack was added to enable exporting of vulkan images to DRM. On Intel hardware, specifically for DRM images, all planes must be allocated next to each other, due to hardware limitation, so the hack used a single large allocation and suballocated all planes from it. By natively supporting multiplane images, the driver is what decides the layout, so exporting just works. It's a hack because it conflicted heavily with image allocation, and with the whole ecosystem in general, before multiplane images were supported, which just made it redundant. This is also the commit which broke the hwcontext hardest and prompted the entire rewrite in the first place.
* hwcontext_vulkan: support threadsafe queue and frame operationsLynne2023-05-291-48/+143
|
* hwcontext_vulkan: use portability subset if availableLynne2023-05-291-1/+3
|
* hwcontext_vulkan: enable VK_KHR_synchronization2 if supportedLynne2023-05-291-4/+12
|
* hwcontext_vulkan: enable support for YCbCr samplersLynne2023-05-291-0/+1
|