[Treeland] From Android's Path to Treeland: I will Taking DDE All-In on Vulkan
deepin 25 29 views · 0 replies ·
mozixun
Moderator
12 hours ago
Author
From Android's Path to Treeland: I will Taking DDE All-In on Vulkan
I'm mozixun, and this is the project I've been spending my time on: moving Treeland — the Wayland compositor behind DDE — onto Vulkan as its rendering backend. It runs. DDE now draws the whole screen through a Vulkan stack, and the builds are in the deepin enhanced repo(Better Deepin Repo): one environment variable and you boot into it.
https://github.com/orgs/Better-Deepin-Repo
WARNING: Better Deepin REPO's treeland will be de outdated because deepin v25 still use Qt 6.8 now, and I will focus on treeland Vulkan Renderer optimization on Fedora 45 with Qt 6.11, if you want to try the newest DDE you should try this: https://github.com/Fedora-Remix-DDE/ISO-Build/actions/runs/46826120560
Treeland draws everything you see in DDE — windows, the dock, background blur, animations, transitions. Until now it drew them through OpenGL ES. What I've been doing is switching that to Vulkan: not one application at a time, but the whole screen, on every frame.
It started with a comparison that bothered me. Android has run its compositor on Vulkan since AOSP 10. On the Linux desktop, most compositors still render through OpenGL ES, and the ones that don't are largely experiments. I wanted to know whether that gap was technical or just inertia, and the only way to find out was to build the thing.
Three things worth knowing up front
Every frame changes, not one app: a compositor is not just a window arranger. It is a renderer that runs the entire time the screen is on — dock, blur, animations, window transitions, all of it drawn by the compositor.
Restrained but complete: I did not rewrite wlroots. Some internal APIs were opened, the QML canvas was made to hand over to the Vulkan RHI, and the compositor itself goes fully Vulkan — while the GLES2 path and upstream sync stay intact.
A complete delivery: branches, performance fixes and repo packages form one chain. After updating, a single environment variable gets you booting into it.
⚠ A word of caution: this is a community preview build I maintain. Do not deploy it on production systems or primary work machines. Exploration begins with protecting your data.
01 Switching the compositor's backend changes every frame on screen
"Apps can already render with Vulkan. Does it still matter which graphics API the compositor uses?"
This is the question I get asked most often, and it deserves a proper answer.
In the Wayland architecture, each app renders its own surface and submits it to the compositor, which assembles them into one complete frame and hands that frame to the GPU through the corresponding API. But the compositor's job goes well beyond assembling windows: the dock and panels, background blur, window animations and transition effects are all drawn by the compositor. It is itself a renderer that has to keep running as long as the screen is on.
So whether the compositor uses OpenGL ES or Vulkan does not change whether a given app can run. It changes the composition path and the presentation path of every frame on the whole screen — and the API through which desktop effects are drawn.
What Vulkan changes at the core is explicit synchronisation and explicit resource management, with state turned into objects and no runtime validation. The driver no longer infers "when to wait, when to submit" on the caller's behalf; the caller declares it. This model removes the driver's guesswork and, at the same time, makes the stack far more debuggable: enable the Vulkan validation layers and an error in the renderer can be located directly and completely, instead of surfacing as random corruption or dropped frames. That last point is what convinced me the switch was worth the effort — a compositor is exactly the kind of code where you want the error to point at the call site.
Dimension
OpenGL ES backend
Vulkan backend
Sync model
Driver infers when to wait and submit
Caller declares dependencies explicitly
Resource management
Driver owns memory and lifetime
App manages memory and lifetime
Debugging
Vendor tools; sync bugs are easily masked
Validation layers point at the call site
Multithreaded submission
Limited by the context model
Native multi-queue parallel recording
Scope
Whole-screen composition path, every frame
Whole-screen composition path, every frame
02 Android (AOSP) is most of the way there; the GNU/Linux desktop is just starting
The first thing I did was look at how Android had handled it, because it had already committed to the direction. Since AOSP 10, the compositor has been pushed to run directly on Vulkan; on the app side, OpenGL ES began to be translated into Vulkan calls through ANGLE, steadily reducing — and eventually removing — dependence on native GLES drivers. In other words, Android treats "one Vulkan stack end to end" as a long-term direction rather than an optional optimisation.
The Linux desktop has been more conservative. Neither GNOME's mutter nor KDE's kwin has taken an equally aggressive line: KWin has proposals and has begun to act, but it is still a long way from the maturity of wlroots offering its Vulkan backend as a default; apart from Treeland, only a few projects such as i3wm have implemented a Vulkan rendering backend.
The gap alone would not have been enough. What made the attempt realistic rather than reckless was timing: the wlroots Vulkan backend and Qt's Vulkan RHI reached stable one after the other, and those two, taken together, are the whole foundation a compositor like Treeland needs.
03 Why Treeland could switch relatively quickly
I picked Treeland because its technical foundation happened to be complete, not because it was an easier target.
Treeland is built on Qt QML (which renders animations and effects and produces the final frame for presentation) and wlroots (which submits that frame to the GPU): the wlroots Vulkan backend has been stable since 0.20, and the Qt QML Vulkan RHI backend is stable as well. More helpfully, QML already abstracts the graphics API gap between OpenGL and Vulkan through its RHI backend. Treeland composites windows in QML and draws DDE's animations and effects in QML, so as long as the handshake between QML and wlroots is handled properly, the implementation period for switching backends is manageable.
On the app side there is one further step that "bypasses the native OpenGL driver": setting the environment variable MESA_LOADER_DRIVER_OVERRIDE=zink (in /etc/environment is recommended) replaces the OpenGL / OpenGL ES driver with the Zink translator plus the matching Vulkan driver. Everything in the chain then lands on Vulkan at the hardware level, while a large body of existing GL applications needs no code changes at all.
Inside Treeland itself, I made no architectural changes to wlroots. I did three things: have wlroots open some internal APIs, add the pieces needed to hand over to QML, and enable the wlroots Vulkan rendering backend and the QML Vulkan RHI backend to work together safely and efficiently.
This "minimal intrusion" approach matters more than it sounds: it completes the backend switch while leaving plenty of room to keep syncing with later wlroots work, and the existing GLES2 rendering path is unaffected.
Long-term maintenance cost is therefore contained, and the project is not locked into a separate branch that would be hard to merge upstream. Pushing technology forward does not mean starting a second stack; it means finding an implementation path, between upstream's pace and the project's own needs, that can be verified and continued. That was the constraint I set myself before writing any code, and most of the design decisions above follow from it.
04 The delivery chain: not a demo, but a path you can install
I concentrated the code-level work in two repositories:
treeland-fix: input-method fixes, Xwayland application stacking fixes, and full Vulkan Renderer support, merged ahead of upstream.
Mesa's perf/wsi branch: one key fix merged early — the severe performance drop when discrete GPUs run Xwayland + Vsync applications on the Zink driver.
Why invest in Zink as well? There are two reasons.
First, to line up with where the graphics stack is heading: OpenGL / OpenGL ES calls landing on Vulkan through translation is a clear trend. Second, NVIDIA's upcoming Nova kernel driver supports only Mesa's NVK userspace Vulkan driver, which means every OpenGL implementation will have to be translated through Zink. Filling in the potholes on the Zink route now is preparation for the next generation of driver models.
All of this converges into one installable artefact: builds of Mesa and Treeland have entered the Better Deepin Repo. Trying it is simple — add export WLR_RENDERER=vulkan as the second-to-last line of /bin/treeland.sh, reboot, and you boot into a Vulkan-rendered Treeland.
I also run Zink (RADV) with the Vulkan-backed Treeland for my own daily office work, and play OpenGL and Vulkan games on it to test reliability. The value of this chain is not in showing some local effect; it is in joining the compositor backend, driver compatibility and an installable user experience into one piece — giving the approach a genuinely reproducible, verifiable footing. A demo can be arranged to look good once. A package either boots or it does not.
Closing: what this is, and what it isn't
To be clear about scope: this is a backend switch, not a new desktop. DDE looks the same, because changing how it looks was never the point — changing what draws it was. What changes is underneath: one graphics API for the whole stack, from the compositor down to the driver, and a rendering path where an error points at the call site instead of showing up as a flicker you cannot reproduce.
I would rather this be judged by whether someone else can build on it than by a screenshot. The branches are public, the builds are installable, and the switch is one line in /bin/treeland.sh. If it breaks on your hardware, that is useful information too, and it belongs in the same place as everything else.
From Android's Path to Treeland: I will Taking DDE All-In on Vulkan
WARNING: Better Deepin REPO's treeland will be de outdated because deepin v25 still use Qt 6.8 now, and I will focus on treeland Vulkan Renderer optimization on Fedora 45 with Qt 6.11, if you want to try the newest DDE you should try this: https://github.com/Fedora-Remix-DDE/ISO-Build/actions/runs/46826120560
Treeland draws everything you see in DDE — windows, the dock, background blur, animations, transitions. Until now it drew them through OpenGL ES. What I've been doing is switching that to Vulkan: not one application at a time, but the whole screen, on every frame.
It started with a comparison that bothered me. Android has run its compositor on Vulkan since AOSP 10. On the Linux desktop, most compositors still render through OpenGL ES, and the ones that don't are largely experiments. I wanted to know whether that gap was technical or just inertia, and the only way to find out was to build the thing.
Three things worth knowing up front
⚠ A word of caution: this is a community preview build I maintain. Do not deploy it on production systems or primary work machines. Exploration begins with protecting your data.
01 Switching the compositor's backend changes every frame on screen
In the Wayland architecture, each app renders its own surface and submits it to the compositor, which assembles them into one complete frame and hands that frame to the GPU through the corresponding API. But the compositor's job goes well beyond assembling windows: the dock and panels, background blur, window animations and transition effects are all drawn by the compositor. It is itself a renderer that has to keep running as long as the screen is on.
So whether the compositor uses OpenGL ES or Vulkan does not change whether a given app can run. It changes the composition path and the presentation path of every frame on the whole screen — and the API through which desktop effects are drawn.
What Vulkan changes at the core is explicit synchronisation and explicit resource management, with state turned into objects and no runtime validation. The driver no longer infers "when to wait, when to submit" on the caller's behalf; the caller declares it. This model removes the driver's guesswork and, at the same time, makes the stack far more debuggable: enable the Vulkan validation layers and an error in the renderer can be located directly and completely, instead of surfacing as random corruption or dropped frames. That last point is what convinced me the switch was worth the effort — a compositor is exactly the kind of code where you want the error to point at the call site.
02 Android (AOSP) is most of the way there; the GNU/Linux desktop is just starting
The first thing I did was look at how Android had handled it, because it had already committed to the direction. Since AOSP 10, the compositor has been pushed to run directly on Vulkan; on the app side, OpenGL ES began to be translated into Vulkan calls through ANGLE, steadily reducing — and eventually removing — dependence on native GLES drivers. In other words, Android treats "one Vulkan stack end to end" as a long-term direction rather than an optional optimisation.
The Linux desktop has been more conservative. Neither GNOME's mutter nor KDE's kwin has taken an equally aggressive line: KWin has proposals and has begun to act, but it is still a long way from the maturity of wlroots offering its Vulkan backend as a default; apart from Treeland, only a few projects such as i3wm have implemented a Vulkan rendering backend.
The gap alone would not have been enough. What made the attempt realistic rather than reckless was timing: the wlroots Vulkan backend and Qt's Vulkan RHI reached stable one after the other, and those two, taken together, are the whole foundation a compositor like Treeland needs.
03 Why Treeland could switch relatively quickly
I picked Treeland because its technical foundation happened to be complete, not because it was an easier target.
Treeland is built on Qt QML (which renders animations and effects and produces the final frame for presentation) and wlroots (which submits that frame to the GPU): the wlroots Vulkan backend has been stable since 0.20, and the Qt QML Vulkan RHI backend is stable as well. More helpfully, QML already abstracts the graphics API gap between OpenGL and Vulkan through its RHI backend. Treeland composites windows in QML and draws DDE's animations and effects in QML, so as long as the handshake between QML and wlroots is handled properly, the implementation period for switching backends is manageable.
On the app side there is one further step that "bypasses the native OpenGL driver": setting the environment variable
MESA_LOADER_DRIVER_OVERRIDE=zink(in/etc/environmentis recommended) replaces the OpenGL / OpenGL ES driver with the Zink translator plus the matching Vulkan driver. Everything in the chain then lands on Vulkan at the hardware level, while a large body of existing GL applications needs no code changes at all.Inside Treeland itself, I made no architectural changes to wlroots. I did three things: have wlroots open some internal APIs, add the pieces needed to hand over to QML, and enable the wlroots Vulkan rendering backend and the QML Vulkan RHI backend to work together safely and efficiently.
This "minimal intrusion" approach matters more than it sounds: it completes the backend switch while leaving plenty of room to keep syncing with later wlroots work, and the existing GLES2 rendering path is unaffected.
Long-term maintenance cost is therefore contained, and the project is not locked into a separate branch that would be hard to merge upstream. Pushing technology forward does not mean starting a second stack; it means finding an implementation path, between upstream's pace and the project's own needs, that can be verified and continued. That was the constraint I set myself before writing any code, and most of the design decisions above follow from it.
04 The delivery chain: not a demo, but a path you can install
I concentrated the code-level work in two repositories:
treeland-fix: input-method fixes, Xwayland application stacking fixes, and full Vulkan Renderer support, merged ahead of upstream.perf/wsibranch: one key fix merged early — the severe performance drop when discrete GPUs run Xwayland + Vsync applications on the Zink driver.Why invest in Zink as well? There are two reasons.
First, to line up with where the graphics stack is heading: OpenGL / OpenGL ES calls landing on Vulkan through translation is a clear trend. Second, NVIDIA's upcoming Nova kernel driver supports only Mesa's NVK userspace Vulkan driver, which means every OpenGL implementation will have to be translated through Zink. Filling in the potholes on the Zink route now is preparation for the next generation of driver models.
All of this converges into one installable artefact: builds of Mesa and Treeland have entered the Better Deepin Repo. Trying it is simple — add
export WLR_RENDERER=vulkanas the second-to-last line of/bin/treeland.sh, reboot, and you boot into a Vulkan-rendered Treeland.I also run Zink (RADV) with the Vulkan-backed Treeland for my own daily office work, and play OpenGL and Vulkan games on it to test reliability. The value of this chain is not in showing some local effect; it is in joining the compositor backend, driver compatibility and an installable user experience into one piece — giving the approach a genuinely reproducible, verifiable footing. A demo can be arranged to look good once. A package either boots or it does not.
Closing: what this is, and what it isn't
To be clear about scope: this is a backend switch, not a new desktop. DDE looks the same, because changing how it looks was never the point — changing what draws it was. What changes is underneath: one graphics API for the whole stack, from the compositor down to the driver, and a rendering path where an error points at the call site instead of showing up as a flicker you cannot reproduce.
I would rather this be judged by whether someone else can build on it than by a screenshot. The branches are public, the builds are installable, and the switch is one line in
/bin/treeland.sh. If it breaks on your hardware, that is useful information too, and it belongs in the same place as everything else.