-
Notifications
You must be signed in to change notification settings - Fork 120
Work around warping on nvidia with Atomic KMS + GBM KMS #4640
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?
Work around warping on nvidia with Atomic KMS + GBM KMS #4640
Conversation
…ating for cross-GPU transfers
Co-authored-by: Christopher James Halse Rogers <chris@cooperteam.net>
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.
Pull request overview
This PR implements a workaround for rendering issues on NVIDIA GPUs when using Atomic KMS with GBM KMS. The primary issue was a "warping sawtooth pattern" that occurred when resizing windows on NVIDIA-connected displays in a hybrid GPU setup.
Changes:
- Added a
BufferTransferStrategyenum to support CPU-based buffer transfers as an alternative to DMA transfers - Modified buffer allocation to handle NVIDIA's non-compliant GBM behavior when allocating with modifiers
- Added a driver quirk detection system to automatically apply the CPU transfer strategy for NVIDIA GPUs
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/platforms/renderer-generic-egl/rendering_platform.cpp | Added default CPU buffer transfer strategy for generic EGL renderer |
| src/platforms/renderer-generic-egl/buffer_allocator.cpp | Updated texture allocation to pass full Buffer instead of NativeBufferBase |
| src/platforms/gbm-kms/server/kms/quirks.h | Added BufferTransferStrategy enum and quirk tracking |
| src/platforms/gbm-kms/server/kms/quirks.cpp | Implemented quirk parsing and application for NVIDIA buffer transfer strategy |
| src/platforms/gbm-kms/server/kms/platform.cpp | Added fallback allocation paths and integrated quirks into buffer provider creation |
| src/platforms/gbm-kms/server/buffer_allocator.cpp | Updated texture allocation to pass full Buffer instead of NativeBufferBase |
| src/platform/graphics/linux_dmabuf.cpp | Implemented CPU transfer path, refactored DMA transfer logic, and added strategy selection |
| include/platform/mir/graphics/linux_dmabuf.h | Added BufferTransferStrategy enum and updated DMABufEGLProvider interface |
Co-authored-by: Christopher James Halse Rogers <chris@cooperteam.net>
fa2ee7d to
ee9a17e
Compare
These seem appropriate? |
RAOF
left a comment
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 quirk is pragmatic, but it would ideally take into account both GPUs - as far as I can tell, this bug only manifests when importing from Intel to NVIDIA (it imports fine from AMD to NVIDIA on my system).
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
`gbm_bo_with_modifiers_or_linear`
This reverts commit 8812f12125bd571b807e011d9f697f5de8ccaf99.
Fixes RGBA/BGRA issues.
Did not break the buffer import process because these variables were only used for logging
|
The more I work on this problem, the weirder it gets:
EDIT: Attaching a log. Opened qterminal, then firefox rendering on the iGPU and displaying on the dGPU. Then dragged the window to the iGPU's output and back. Closed firefox. Relaunched it without specifying GPUs (which usually renders on the dGPU). Repeated the roundtrip to the iGPU output and back. Shut down. |
410365a to
8372373
Compare
|
Looks like DMA transfers from nvidia to intel in the case where firefox is rendering on nvidia and should display on intel cause the intel compositing thread to completely freeze somewhere in the mesa stack in Edit: Forgot to add, checking dmesg logs shows no errors being thrown, mesa debugging symbols don't help too. I think I might have to build from source to investigate this further. But I think I've spent enough time on this issue as is. |
|
Well, this is awkward. I just tried running kgx rendering on the nvidia GPU and it still suffers from warping. Its colors are broken compared to KDE as well. Pluma and gedit work fine though. |
TICS Quality Gate❌ Failedmir
❌ Condition “No new Coding Standard Violations for level 1, 2, 3 with respect to Previous analysis” failed 2 times.
|
|||||||||||
| File | Issues | |
|---|---|---|
| 🪲 Total | ❌ Blocking | |
| 47 | +7 | |
| 3 | +2 | |
See the results in the TICS Viewer
The following files have been checked for this project
- include/platform/mir/graphics/linux_dmabuf.h
- include/platform/mir/graphics/quirk_common.h
- src/platform/graphics/linux_dmabuf.cpp
- src/platform/graphics/quirk_common.cpp
- src/platforms/atomic-kms/server/kms/quirks.cpp
- src/platforms/gbm-kms/server/buffer_allocator.cpp
- src/platforms/gbm-kms/server/kms/platform.cpp
- src/platforms/gbm-kms/server/kms/quirks.cpp
- src/platforms/gbm-kms/server/kms/quirks.h
- src/platforms/renderer-generic-egl/buffer_allocator.cpp
- src/platforms/renderer-generic-egl/rendering_platform.cpp
Closes #4035
What's new?
gbm_bo_with_modifiers_or_linearto account for nvidia non-complianceDMABufEGLProviderto copy buffers via the CPUDMABufEGLProviderHow to test
On a machine with an intel iGPU and an nvidia dGPU, with one output connected to each:
firefox,ghostty,gtk4-demoas follows--driver-quirks=gbm-buffer-transfer-strategy:nvidia:nvidia:cpuChecklist