-
Notifications
You must be signed in to change notification settings - Fork 6
Disable external compression #155
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
base: main
Are you sure you want to change the base?
Conversation
fba9eda to
abd053c
Compare
abd053c to
0af559d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick first pass just to align on coding standard. Some bits I comment on first occurrence only, so check for later occurrences too.
| VKAPI_ATTR VkResult VKAPI_CALL layer_vkCreateSwapchainKHR<user_tag>(VkDevice device, | ||
| const VkSwapchainCreateInfoKHR* pCreateInfo, | ||
| const VkAllocationCallbacks* pAllocator, | ||
| VkSwapchainKHR* pSwapchain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closing brace on same line as last parameter to keep clang=tidy happy. Ditto below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reformatted everywhere, I hope. Do we have something to check that all the formatting is compliant?
layer_gpu_support/source/layer_device_functions_allocate_memory.cpp
Outdated
Show resolved
Hide resolved
| if (ci->arrayLayers != 1) return false; // Might introduce false negative, stereo images are excluded | ||
|
|
||
| // Prefer common present-ish color formats. | ||
| switch (ci->format) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brace on new line for coding style. (Ditto in all the files, not tracking per instance).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed, see comment #155 (comment)
| // -------------------------------------------- | ||
| // Heuristic + external export intent detection | ||
| // -------------------------------------------- | ||
| const bool present_like = heuristic_is_present_like_image(pCreateInfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we know which images came from the swapchain via vkGetSwapchainImagesKHR()? Can't we just track those, and avoid the heuristic based on format alone?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The need for this heuristic arose from a Vulkan application (specifically, gfxreconstruct) that was replaying a trace originally captured on an Android device using an AHB for presentation. When replayed on a Linux platform, no swapchain was created, and the AHB was ignored, resulting in no presentation at all.
We’ve since developed a patch in gfxreconstruct to address this issue: a valid swapchain is now created when this situation occurs. However, this change has not yet been merged into either the downstream or upstream official releases.
I suspect there may be other scenarios where such a heuristic could also prove useful. Please share your thoughts on whether we should keep it or remove it.
| VkImageCompressionControlEXT* compressionControl = &newCompressionControl; | ||
| auto append = [&](VkBaseOutStructure* n){ | ||
| n->pNext = nullptr; | ||
| if (!rebuilt_head) rebuilt_head = rebuilt_tail = n; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coding style follows MISRA for bracing (if/else should always use braces, and body should be on different line to the condition). It's a lot more readable than long one-liners.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fixed now, see comment #155 (comment)
layer_gpu_support/source/layer_instance_functions_get_physical_properties.cpp
Outdated
Show resolved
Hide resolved
520cf16 to
cdcf94c
Compare
cdcf94c to
93221b9
Compare
This PR allows to disable only external compression, while leaving internal compression untouched, it also include an heuristic in case there is no swapchain creation / presentation that acts on vkCreateImage. Presentations case handled: WSI Swapchain, DMA-buf import/export, AHB import/export. For DMA-buf and AHB import, an error is returned as it is not possible to control external compression with a Vulkan layer.