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
16661666 static int vulkan_device_has_rebar(AVHWDeviceContext *ctx)
16671667 {
16681668 VulkanDevicePriv *p = ctx->hwctx;
1669− AVVulkanDeviceContext *hwctx = &p->p;
1670− FFVulkanFunctions *vk = &p->vkctx.vkfn;
1671− VkPhysicalDeviceMemoryProperties mprops;
16721669 VkDeviceSize max_vram = 0, max_visible_vram = 0;
16731670
16741671 /* Get device memory properties */
1675− vk->GetPhysicalDeviceMemoryProperties(hwctx->phys_dev, &mprops);
1676− for (int i = 0; i < mprops.memoryTypeCount; i++) {
1677− const VkMemoryType type = mprops.memoryTypes[i];
1678− const VkMemoryHeap heap = mprops.memoryHeaps[type.heapIndex];
1672+ for (int i = 0; i < p->mprops.memoryTypeCount; i++) {
1673+ const VkMemoryType type = p->mprops.memoryTypes[i];
1674+ const VkMemoryHeap heap = p->mprops.memoryHeaps[type.heapIndex];
16791675 if (!(type.propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT))
16801676 continue;
16811677 max_vram = FFMAX(max_vram, heap.size);
@@ -2019,6 +2015,9 @@ FF_ENABLE_DEPRECATION_WARNINGS · 337 unmodified lines
20192015 if (!hwctx->unlock_queue)
20202016 hwctx->unlock_queue = unlock_queue;
20212017
2018+ /* Re-query device capabilities, in case the device was created externally */
2019+ vk->GetPhysicalDeviceMemoryProperties(hwctx->phys_dev, &p->mprops);
2020+
20222021 p->vkctx.device = ctx;
20232022 p->vkctx.hwctx = hwctx;
20242023
@@ -2026,6 +2025,9 @@ FF_ENABLE_DEPRECATION_WARNINGS · 1 unmodified line
20262025 p->compute_qf = ff_vk_qf_find(&p->vkctx, VK_QUEUE_COMPUTE_BIT, 0);
20272026 p->transfer_qf = ff_vk_qf_find(&p->vkctx, VK_QUEUE_TRANSFER_BIT, 0);
20282027
2028+ /* Re-query device capabilities, in case the device was created externally */
2029+ vk->GetPhysicalDeviceMemoryProperties(hwctx->phys_dev, &p->mprops);
2030+
20292031 /* Only use host image transfers if ReBAR is enabled */
20302032 p->disable_host_transfer = !vulkan_device_has_rebar(ctx);
20312033

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