History

hwcontext_vulkan: fix issues with importing a device

The previous fix just used a local variable for the memory properties, which did not fix this issue.

Lynne committed 1 year ago

Commit bd75fad1 parent f7445841 file · +9 −7Browse files

Unified · Split

libavutil/hwcontext_vulkan.c+9−7
@@ -1666,16 +1666,12 @@ static void vulkan_device_uninit(AVHWDeviceContext *ctx) · 1665 unmodified lines
1666static int vulkan_device_has_rebar(AVHWDeviceContext *ctx)1666static int vulkan_device_has_rebar(AVHWDeviceContext *ctx)
1667{1667{
1668 VulkanDevicePriv *p = ctx->hwctx;1668 VulkanDevicePriv *p = ctx->hwctx;
1669 AVVulkanDeviceContext *hwctx = &p->p;
1670 FFVulkanFunctions *vk = &p->vkctx.vkfn;
1671 VkPhysicalDeviceMemoryProperties mprops;
1672 VkDeviceSize max_vram = 0, max_visible_vram = 0;1669 VkDeviceSize max_vram = 0, max_visible_vram = 0;
1673 1670
1674 /* Get device memory properties */1671 /* Get device memory properties */
1675 vk->GetPhysicalDeviceMemoryProperties(hwctx->phys_dev, &mprops);1672 for (int i = 0; i < p->mprops.memoryTypeCount; i++) {
1676 for (int i = 0; i < mprops.memoryTypeCount; i++) {1673 const VkMemoryType type = p->mprops.memoryTypes[i];
1677 const VkMemoryType type = mprops.memoryTypes[i];1674 const VkMemoryHeap heap = p->mprops.memoryHeaps[type.heapIndex];
1678 const VkMemoryHeap heap = mprops.memoryHeaps[type.heapIndex];
1679 if (!(type.propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT))1675 if (!(type.propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT))
1680 continue;1676 continue;
1681 max_vram = FFMAX(max_vram, heap.size);1677 max_vram = FFMAX(max_vram, heap.size);
@@ -2019,6 +2015,9 @@ FF_ENABLE_DEPRECATION_WARNINGS · 337 unmodified lines
2019 if (!hwctx->unlock_queue)2015 if (!hwctx->unlock_queue)
2020 hwctx->unlock_queue = unlock_queue;2016 hwctx->unlock_queue = unlock_queue;
2021 2017
2018 /* Re-query device capabilities, in case the device was created externally */
2019 vk->GetPhysicalDeviceMemoryProperties(hwctx->phys_dev, &p->mprops);
2020
2022 p->vkctx.device = ctx;2021 p->vkctx.device = ctx;
2023 p->vkctx.hwctx = hwctx;2022 p->vkctx.hwctx = hwctx;
2024 2023
@@ -2026,6 +2025,9 @@ FF_ENABLE_DEPRECATION_WARNINGS · 1 unmodified line
2026 p->compute_qf = ff_vk_qf_find(&p->vkctx, VK_QUEUE_COMPUTE_BIT, 0);2025 p->compute_qf = ff_vk_qf_find(&p->vkctx, VK_QUEUE_COMPUTE_BIT, 0);
2027 p->transfer_qf = ff_vk_qf_find(&p->vkctx, VK_QUEUE_TRANSFER_BIT, 0);2026 p->transfer_qf = ff_vk_qf_find(&p->vkctx, VK_QUEUE_TRANSFER_BIT, 0);
2028 2027
2028 /* Re-query device capabilities, in case the device was created externally */
2029 vk->GetPhysicalDeviceMemoryProperties(hwctx->phys_dev, &p->mprops);
2030
2029 /* Only use host image transfers if ReBAR is enabled */2031 /* Only use host image transfers if ReBAR is enabled */
2030 p->disable_host_transfer = !vulkan_device_has_rebar(ctx);2032 p->disable_host_transfer = !vulkan_device_has_rebar(ctx);
2031 2033

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t