fix: import dmabuf as vulkan render target#1114
Conversation
There was a problem hiding this comment.
Sorry @deepin-wm, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: deepin-wm The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
abc87c5 to
ba161b6
Compare
|
大佬那DTK应用/DDE组件花屏的问题咋办( |
ba161b6 to
55b704c
Compare
那些组件呀?什么样的画屏,可以搞个图看看 |
- Replace WLR_LITTLE_ENDIAN with Qt's Q_BYTE_ORDER == Q_LITTLE_ENDIAN
- Remove per-format #ifdef DRM_FORMAT guards; define missing macros in CMake
- Fix DRM_FORMAT_XYUV -> DRM_FORMAT_XYUV8888 (correct macro name)
- Make isYCbCr constexpr
- Replace #pragma GCC diagnostic with QT_WARNING_PUSH/POP
- Add else { return {}; } when get_dmabuf fails in acquireRenderTarget
就是大佬说的DTK/DDE组件只能显示个轮廓, 具体原因我TG上放过,我这边是动了wlroots才解决的 |
|
还有大佬, wlroots 0.19版本的也顺便做一下呗 |
d6f8c3d to
50a2562
Compare
Per maintainer zccrs review on PR linuxdeepin#1114: replace the #ifndef fallback fourcc definitions with #if defined(DRM_FORMAT_xxx) per-entry guards. The 8 formats added in libdrm >= 2.4.129 (R16F, R32F, GR1616F, GR3232F, BGR161616, BGR161616F, BGR323232F, ABGR32323232F) are now each wrapped in #if defined(...)/#endif inside the verbatim wlroots 0.20 format table, so it compiles on older libdrm (CI uses 2.4.123) without locally redefining fourcc macros. isYCbCr is left untouched (all macros it references are defined); CMakeLists.txt is unchanged. Log: Switched DRM_FORMAT_* compatibility from #ifndef fallbacks to per-entry #if defined() guards Influence: 1. Vulkan render-target dmabuf import still compiles on CI's libdrm 2.4.123 2. On libdrm >= 2.4.129 the full wlroots 0.20 format table is used as-is 3. No runtime behavior change
1. Port wlroots 0.20 vulkan_import_dmabuf(for_render=true) to waylib 2. Replace wlr_texture-based VkImage in acquireRenderTarget with direct dmabuf import so the buffer is a valid render target 3. New VkImage gets VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT for valid render target usage instead of reusing a wlr_texture 4. Add VkDmabufImage lifecycle management in BufferData destructor 5. Fix BufferData memory leak in onBufferDestroy 6. Keep the verbatim wlroots 0.20 formats[] table; guard the 8 DRM_FORMAT_* entries added in libdrm >= 2.4.129 with #if defined() so it compiles on CI's older libdrm (2.4.123) 7. Use Q_BYTE_ORDER == Q_LITTLE_ENDIAN instead of a custom endian macro 8. Make isYCbCr, kVkFormats and vkFormatFromDrm constexpr 9. Use QT_WARNING_PUSH/POP instead of pragma GCC diagnostic 10. Return an empty target when get_dmabuf fails (else branch) Log: Fixed Vulkan render target to use a proper color-attachment VkImage Influence: 1. Test Vulkan rendering with various dmabuf formats 2. Verify render target creation without validation errors 3. Test buffer creation and destruction for memory leaks 4. Verify GL and pixman rendering paths are unaffected 5. Confirm the build passes on libdrm 2.4.123 and >= 2.4.129 fix: 使用 dmabuf 导入创建 vulkan 渲染目标 1. 将 wlroots 0.20 的 vulkan_import_dmabuf(for_render=true) 移植到 waylib 2. 在 acquireRenderTarget 中用直接 dmabuf 导入替代 wlr_texture 创建 VkImage,使缓冲可作为有效渲染目标 3. 新建 VkImage 带 VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,替代复用 wlr_texture 的做法,获得合法的渲染目标用途 4. 在 BufferData 析构中添加 VkDmabufImage 生命周期管理 5. 修复 onBufferDestroy 中 BufferData 的内存泄漏 6. 保留 wlroots 0.20 原始 formats[] 表;对 libdrm >= 2.4.129 新增的 8 个 DRM_FORMAT_* 条目用 #if defined() 守卫,使其在 CI 较旧的 libdrm (2.4.123) 上也能编译 7. 用 Q_BYTE_ORDER == Q_LITTLE_ENDIAN 替代自定义大小端宏 8. 将 isYCbCr、kVkFormats、vkFormatFromDrm 改为 constexpr 9. 用 QT_WARNING_PUSH/POP 替代 pragma GCC diagnostic 10. get_dmabuf 失败时返回空目标(else 分支) Log: 修复 Vulkan 渲染目标,使用合法的颜色附件 VkImage Influence: 1. 测试 Vulkan 渲染路径下各种 dmabuf 格式 2. 验证渲染目标创建成功,无 validation 错误 3. 测试 buffer 创建和销毁,确认无内存泄漏 4. 验证 GL 和 pixman 渲染路径不受影响 5. 确认在 libdrm 2.4.123 与 >= 2.4.129 上均能编译通过
24abc32 to
bae7a8a
Compare
Description
Replace
wlr_texture-based VkImage creation inWRenderHelper::acquireRenderTargetwith a direct dmabuf import usingvulkan_import_dmabuf(for_render=true)logic ported from wlroots 0.20.Problem
wlr_texture_from_buffercreates a VkImage withVK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT(noVK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT). Using this VkImage as a render target viaQRhiTextureRenderTargetviolates Vulkan's requirement that color attachment images haveCOLOR_ATTACHMENT_BITusage, causing render target creation failure or validation errors.Solution
Port wlroots 0.20's
vulkan_import_dmabuf(for_render=true)to waylib, creating a VkImage withVK_IMAGE_USAGE_COLOR_ATTACHMENT_BITdirectly from the dmabuf. The implementation uses only public Vulkan and wlroots APIs, with no dependency on wlroots' private renderer structs.Changes
waylib/src/server/qtquick/private/wvulkandmabufimport_p.h— DeclaresVkDmabufImagestruct and import/release functionswaylib/src/server/qtquick/private/wvulkandmabufimport.cpp— Ported from wlroots 0.20: DRM→VkFormat table, modifier query, memory fd import, disjoint/multi-plane handlingwaylib/src/server/qtquick/wrenderhelper.cpp— Vulkan branch uses direct dmabuf import; pixman/gles2 branches use scopedstd::unique_ptr<qw_texture>; fixBufferDatamemory leak inonBufferDestroywaylib/src/server/CMakeLists.txt— Register new source/header; add optional Vulkan pkg dependencyTesting
Multica Issue WM-76