Recently, the Mesa open-source graphics driver merged the Merge Request (MR) for the llvmpipe ORCJIT backend, adding support for the riscv64 architecture.

 

What is LLVMpipe?

LLVMpipe is a software renderer in the Mesa driver that does not use GPU hardware. Instead, it uses LLVM's JIT compiler to dynamically convert the graphics-related code to be rendered into rasterized data for display. It offers better performance compared to softpipe.

Closed-source drivers have long been a major obstacle to the desktop ecosystem of the riscv64 architecture, causing most riscv64 development boards' built-in GPUs to be partially or completely unusable. Consequently, desktop distributions had to use software rendering as a substitute.

For a long time, the JIT backend used by Mesa's LLVMpipe was the outdated MCJIT, which lacked architecture support, rather than the newer ORCJIT, which supports a broader range of architectures. Since MCJIT has been officially replaced by ORCJIT and no longer accepts new architecture updates, Mesa had to use the lower-performing softpipe for software rendering on architectures like riscv64. This rendered desktop environments almost unusable, devastating the desktop ecosystem.

As a result, the open-source community was eager to have a faster software renderer on the riscv64 architecture.

 

The First Attempt with ORCJIT

In July 2022, a developer named Alex Fan (@alexfanqi) submitted MR 17801, introducing a new ORCJIT backend to Mesa, along with support for riscv64. This made it possible to use LLVMpipe software rendering on riscv64.

 

The MR was not merged immediately because developers pointed out several issues: it lacked a switch to change the backend at compile time, the code needed optimization, and it lacked shader caching, among other things.

This marked the beginning of a two-year journey to merge the LLVMpipe ORCJIT backend.

In July 2022, the RISC-V SIG in the openEuler community discovered this PR and integrated it, publishing an article about its performance improvements.

However, just as the open-source desktop ecosystem on riscv64 was seeing the light, the rapid development of the Mesa branch caused the original Merge Request to fall behind due to lack of maintenance, leading to increasing differences and conflicts with the main branch. It was gradually forgotten.

 

The Community Relay: The Undying Spark of Open Source Software

In November 2023, a developer named Yukari Chiba (@YukariChiba) encountered the same issue while maintaining her distribution. Frustrated with mainstream distributions switching to softpipe when faced with this problem, she decided to address it.

The patch, long buried in the MR list, once again shone on the screen.

On November 1, @YukariChiba posted a screenshot in a group showing LLVMpipe running glxinfo with ORCJIT enabled on Phytium. The next day, she posted another screenshot showing LLVMpipe running glmark on PineTab-V.

On November 8, @YukariChiba resubmitted MR 26018 to the Mesa mainline with the same ID, aiming to provide a reference patch for the mainline version of Mesa while pushing for its merge.

Soon, distributions like deepin, ArchLinux RISC-V, and AOSC OS adopted this version of the MR patch, making the RISC-V mainline desktop experience usable again.

In April 2024, Icenowy Zheng (@icenowy) added shader caching and loongarch architecture support to the ORCJIT MR, meaning that once the ORCJIT backend is merged, all major desktop architectures will have high-performance LLVMpipe support.

As more developers took notice, the merge into the main branch became increasingly likely.

 

The Final Push and Merge of the MR

On June 19, a developer commented:

Is there anything outstanding that is preventing this from being merged into the main mesa branch?

This broke the silence in the MR comment section. In the following month, community contributors made dozens of suggestions for improvements. Dave Airlie (@airlied) submitted several preparatory changes and code structure optimizations to help ORCJIT land. MR submitter @YukariChiba modified the MR submission dozens of times based on the feedback and submitted the final version on June 28.

Finally, on July 16, Merge Request 26018 passed the final CI check and was merged into the Mesa mainline, marking the end of a two-year open-source marathon involving countless developers worldwide.

 

deepin's Continuous Tracking and Maintenance: Behind the Scenes

The developer with the ID @YukariChiba, who submitted the MR to Mesa, is also a deepin open-source community R&D engineer, a developer of the deepin-ports SIG, and one of the maintainers of the deepin RISC-V port.

In December 2023, deepin packaged and verified this updated patch internally and conducted real machine verification and performance testing on development boards such as VisionFive2, LicheePi4A, and SG2042 EVB.

The next day, deepin merged this MR patch into the Mesa mainline repository, enabling ORCJIT support by default for the riscv64 architecture and enabling it in all subsequent riscv64 device images.

From the initial patch in November 2023 to the final merge on July 16, 2024, deepin's Mesa version was upgraded from 23.1.2 to 24.1.0. During this process, the deepin-ports SIG actively adapted the new Mesa versions and refreshed the patches, ensuring their effectiveness throughout version iterations and supporting the feature's testing and maintenance. This community support objectively contributed to Mesa's upstream merge.

During this period, deepin also preemptively introduced unmerged patches for loongarch support and shader caching based on ORCJIT, providing higher-performance software rendering for the two major architectures riscv64 and loong64, enhancing deepin's desktop ecosystem.

In the future, deepin will continue to follow upstream updates and subsequent performance optimizations of open-source software like Mesa, striving to improve the open-source desktop experience across amd64, arm64, riscv64, and loong64 architectures.

 

Appendix:

(1)deepin All Versions(include deepin V15):https://distrowatch.com/index.php?distribution=deepin

(2)deepin RISC-V ISO(LicheePi 4A、VisionFive, etc.)https://www.deepin.org/en/download/

 

Content source: deepin community
Reprinted with attribution

Leave a Reply