nvk: Disable compression for image import/export

Reviewed-by: Mohamed Ahmed <mohamedahmedegypt2001@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36450>
This commit is contained in:
Mel Henning 2025-12-16 18:46:43 -05:00
parent cabfdb4404
commit 0df735a619
2 changed files with 14 additions and 5 deletions

View file

@ -157,6 +157,7 @@ nvk_AllocateMemory(VkDevice device,
if (fd_info != NULL)
handle_types |= fd_info->handleType;
const bool not_shared = handle_types == 0;
bool pinned_to_vram = false;
/* Align to os page size (typically 4K) as a start as this works for
@ -179,10 +180,16 @@ nvk_AllocateMemory(VkDevice device,
alignment = MAX2(alignment, image->planes[0].nil.align_B);
pte_kind = image->planes[0].nil.pte_kind;
tile_mode = image->planes[0].nil.tile_mode;
} else if (image->can_compress) {
/* If it's a dedicated alloc and it's not modifiers, then it's marked
* for compression and larger pages, so we set the pinned bit and up
* the alignment.
} else if (image->can_compress && not_shared) {
/* If it's a dedicated alloc and it's not modifiers or shared, then
* it's marked for compression and larger pages, so we set the pinned
* bit and up the alignment.
*
* Disabling compression for export/import is a bit nicer to apps.
* Eg. QtWebEngine likes to export/import buffers with
* VK_IMAGE_TILING_OPTIMAL and renders incorrectly if we remove
* the not_shared check.
* https://qt-project.atlassian.net/browse/QTBUG-141866
*/
pinned_to_vram = true;
pte_kind = image->planes[0].nil.compressed_pte_kind;

View file

@ -1547,8 +1547,10 @@ nvk_image_plane_bind(struct nvk_device *dev,
&plane_size_B, &plane_align_B);
*offset_B = align64(*offset_B, plane_align_B);
const bool not_shared = !(mem->mem->flags & NVKMD_MEM_SHARED);
if (plane->nil.pte_kind != 0) {
if (mem->dedicated_image == image && image->can_compress) {
if (mem->dedicated_image == image && image->can_compress && not_shared) {
image->is_compressed = true;
plane->addr = mem->mem->va->addr + *offset_B;
} else {