-
Notifications
You must be signed in to change notification settings - Fork 96
Add Vulkan patches and update Docker build process #671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ericcurtin
wants to merge
1
commit into
main
Choose a base branch
from
16k-patches
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+159
−3
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
scripts/0001-Revert-venus-filter-out-venus-incapable-physical-dev.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| diff --git a/src/virtio/vulkan/vn_physical_device.c b/src/virtio/vulkan/vn_physical_device.c | ||
| index 83477d2..00f5615 100644 | ||
| --- a/src/virtio/vulkan/vn_physical_device.c | ||
| +++ b/src/virtio/vulkan/vn_physical_device.c | ||
| @@ -1500,12 +1500,6 @@ vn_physical_device_init_renderer_extensions( | ||
|
|
||
| vk_free(alloc, exts); | ||
|
|
||
| - /* VK_KHR_external_memory_fd is required for venus memory mapping */ | ||
| - if (!physical_dev->renderer_extensions.KHR_external_memory_fd) { | ||
| - vk_free(alloc, physical_dev->extension_spec_versions); | ||
| - return VK_ERROR_INCOMPATIBLE_DRIVER; | ||
| - } | ||
| - | ||
| return VK_SUCCESS; | ||
| } | ||
|
|
||
| @@ -1631,6 +1625,10 @@ vn_physical_device_init(struct vn_physical_device *physical_dev) | ||
| const VkAllocationCallbacks *alloc = &instance->base.vk.alloc; | ||
| VkResult result; | ||
|
|
||
| + result = vn_physical_device_init_renderer_extensions(physical_dev); | ||
| + if (result != VK_SUCCESS) | ||
| + return result; | ||
| + | ||
| vn_physical_device_init_external_memory(physical_dev); | ||
| vn_physical_device_init_external_fence_handles(physical_dev); | ||
| vn_physical_device_init_external_semaphore_handles(physical_dev); | ||
| @@ -1662,6 +1660,7 @@ vn_physical_device_init(struct vn_physical_device *physical_dev) | ||
| return VK_SUCCESS; | ||
|
|
||
| fail: | ||
| + vk_free(alloc, physical_dev->extension_spec_versions); | ||
| vk_free(alloc, physical_dev->queue_family_properties); | ||
| return result; | ||
| } | ||
| @@ -1875,12 +1874,6 @@ filter_physical_devices(struct vn_physical_device *physical_devs, | ||
| continue; | ||
| } | ||
|
|
||
| - result = vn_physical_device_init_renderer_extensions(physical_dev); | ||
| - if (result != VK_SUCCESS) { | ||
| - vn_physical_device_base_fini(&physical_dev->base); | ||
| - continue; | ||
| - } | ||
| - | ||
| if (supported_count < i) | ||
| physical_devs[supported_count] = *physical_dev; | ||
| supported_count++; |
50 changes: 50 additions & 0 deletions
50
scripts/0001-virtio-vulkan-force-16k-alignment-for-allocations-HA.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| diff --git a/src/virtio/vulkan/vn_device_memory.c b/src/virtio/vulkan/vn_device_memory.c | ||
| index 19b4a91..cb0e72c 100644 | ||
| --- a/src/virtio/vulkan/vn_device_memory.c | ||
| +++ b/src/virtio/vulkan/vn_device_memory.c | ||
| @@ -31,6 +31,10 @@ vn_device_memory_alloc_simple(struct vn_device *dev, | ||
| { | ||
| VkDevice dev_handle = vn_device_to_handle(dev); | ||
| VkDeviceMemory mem_handle = vn_device_memory_to_handle(mem); | ||
| + | ||
| + ((VkMemoryAllocateInfo *)alloc_info)->allocationSize = | ||
| + align64(alloc_info->allocationSize, 16384); | ||
| + | ||
| if (VN_PERF(NO_ASYNC_MEM_ALLOC)) { | ||
| return vn_call_vkAllocateMemory(dev->primary_ring, dev_handle, | ||
| alloc_info, NULL, &mem_handle); | ||
| diff --git a/src/virtio/vulkan/vn_renderer_virtgpu.c b/src/virtio/vulkan/vn_renderer_virtgpu.c | ||
| index 5b199aa..4fe6ed8 100644 | ||
| --- a/src/virtio/vulkan/vn_renderer_virtgpu.c | ||
| +++ b/src/virtio/vulkan/vn_renderer_virtgpu.c | ||
| @@ -1245,6 +1245,8 @@ virtgpu_bo_create_from_device_memory( | ||
| const uint32_t blob_flags = | ||
| virtgpu_bo_blob_flags(gpu, flags, external_handles); | ||
|
|
||
| + size = align64(size, 16384); | ||
| + | ||
| uint32_t res_id; | ||
| uint32_t gem_handle = virtgpu_ioctl_resource_create_blob( | ||
| gpu, gpu->bo_blob_mem, blob_flags, size, mem_id, &res_id); | ||
| @@ -1295,6 +1297,8 @@ virtgpu_shmem_create(struct vn_renderer *renderer, size_t size) | ||
| { | ||
| struct virtgpu *gpu = (struct virtgpu *)renderer; | ||
|
|
||
| + size = align64(size, 16384); | ||
| + | ||
| struct vn_renderer_shmem *cached_shmem = | ||
| vn_renderer_shmem_cache_get(&gpu->shmem_cache, size); | ||
| if (cached_shmem) { | ||
| diff --git a/src/virtio/vulkan/vn_ring.c b/src/virtio/vulkan/vn_ring.c | ||
| index 2de4978..119a8f9 100644 | ||
| --- a/src/virtio/vulkan/vn_ring.c | ||
| +++ b/src/virtio/vulkan/vn_ring.c | ||
| @@ -264,7 +264,7 @@ vn_ring_get_layout(size_t buf_size, | ||
| layout->extra_offset = layout->buffer_offset + layout->buffer_size; | ||
| layout->extra_size = extra_size; | ||
|
|
||
| - layout->shmem_size = layout->extra_offset + layout->extra_size; | ||
| + layout->shmem_size = align64(layout->extra_offset + layout->extra_size, 16384); | ||
| } | ||
|
|
||
| struct vn_ring * | ||
15 changes: 15 additions & 0 deletions
15
scripts/0002-virtio-vulkan-silence-stuck-in-wait-message-HACK.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| diff --git a/src/virtio/vulkan/vn_common.c b/src/virtio/vulkan/vn_common.c | ||
| index 2d389a8..3020ad6 100644 | ||
| --- a/src/virtio/vulkan/vn_common.c | ||
| +++ b/src/virtio/vulkan/vn_common.c | ||
| @@ -269,8 +269,8 @@ vn_relax(struct vn_relax_state *state) | ||
|
|
||
| if (unlikely(*iter % (1 << warn_order) == 0)) { | ||
| struct vn_instance *instance = state->instance; | ||
| - vn_log(instance, "stuck in %s wait with iter at %d", state->reason_str, | ||
| - *iter); | ||
| + //vn_log(instance, "stuck in %s wait with iter at %d", state->reason_str, | ||
| + // *iter); | ||
ericcurtin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| struct vn_ring *ring = instance->ring.ring; | ||
| const uint32_t status = vn_ring_load_status(ring); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.