summaryrefslogtreecommitdiffstats
diff options
authorPeter Varga <pvarga@inf.u-szeged.hu>2025-04-03 14:25:11 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2025-05-07 09:01:36 +0000
commita4b729fe555f92a0708bc5131f0396b9648ed932 (patch)
tree0039134bdc13926ef2bb51165daf6f093434471c
parent7c01d710dbfc7441077d9c0fecb6acc674715307 (diff)
NativeSkiaOutputDeviceVulkan: Fix Vulkan rendering with AMD GPU on Linux6.9.16.9
gbm_bo_get_modifier() may return invalid DRM format modifier for AMD driver. In this case, create VkImage without DRM format modifier and fallback tiling to VK_IMAGE_TILING_OPTIMAL instead of VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT. Pick-to: 6.8 Fixes: QTBUG-123607 Change-Id: Iacf4fc514ab42fa9ab712f5d9fde2d20000f599d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 0af1b2b24955d77815642e005a3e528b2c0151d0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/core/compositor/native_skia_output_device_vulkan.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/core/compositor/native_skia_output_device_vulkan.cpp b/src/core/compositor/native_skia_output_device_vulkan.cpp
index 924cc951b..5f410621b 100644
--- a/src/core/compositor/native_skia_output_device_vulkan.cpp
+++ b/src/core/compositor/native_skia_output_device_vulkan.cpp
@@ -136,17 +136,23 @@ QSGTexture *NativeSkiaOutputDeviceVulkan::texture(QQuickWindow *win, uint32_t te
.pPlaneLayouts = &planeLayout,
};
+ bool usingDrmModifier = false;
if (nativePixmap) {
qCDebug(lcWebEngineCompositor, "VULKAN: Importing NativePixmap into VkImage.");
gfx::NativePixmapHandle nativePixmapHandle = nativePixmap->ExportHandle();
- if (nativePixmapHandle.planes.size() != 1)
- qFatal("VULKAN: Multiple planes are not supported.");
+ qCDebug(lcWebEngineCompositor, " DRM Format Modifier: 0x%lx", nativePixmapHandle.modifier);
- planeLayout.offset = nativePixmapHandle.planes[0].offset;
- planeLayout.rowPitch = nativePixmapHandle.planes[0].stride;
- modifierInfo.drmFormatModifier = nativePixmapHandle.modifier;
+ if (nativePixmapHandle.modifier != gfx::NativePixmapHandle::kNoModifier) {
+ usingDrmModifier = true;
+ if (nativePixmapHandle.planes.size() != 1)
+ qFatal("VULKAN: Multiple planes are not supported.");
- externalMemoryImageCreateInfo.pNext = &modifierInfo;
+ planeLayout.offset = nativePixmapHandle.planes[0].offset;
+ planeLayout.rowPitch = nativePixmapHandle.planes[0].stride;
+ modifierInfo.drmFormatModifier = nativePixmapHandle.modifier;
+
+ externalMemoryImageCreateInfo.pNext = &modifierInfo;
+ }
externalMemoryImageCreateInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT;
scopedFd = std::move(nativePixmapHandle.planes[0].fd);
@@ -225,9 +231,9 @@ QSGTexture *NativeSkiaOutputDeviceVulkan::texture(QQuickWindow *win, uint32_t te
};
#if BUILDFLAG(IS_OZONE)
- if (nativePixmap)
+ if (usingDrmModifier)
importedImageCreateInfo.tiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
- else
+ else if (vkImageInfo.fAlloc.fMemory != VK_NULL_HANDLE)
importedImageCreateInfo.tiling = vkImageInfo.fImageTiling;
#endif