3 ms·
Xrender is hardware accelerated and cairo uses Xrender as a backend. Why is Xrender not "viable"?
by sprash 3y ago
Xrender is hardware accelerated and cairo uses Xrender as a backend. Why is Xrender not "viable"?
- pcwalton 3y agoHonestly I think XRENDER could be a viable API--the core idea is similar to WebRender, which Firefox uses to great effect--but the existing implementations of it are not well-optimized implementations and issue tons of draw calls using obsolete OpenGL APIs. They are slower than just drawing on CPU. You would essentially need a complete rewrite. The bigger issue is that there's little reason to farm vector graphics rendering out to the window server in the first place. The main reason would be to avoid a window blit on HiDPI displays. But the tradeoff is that the XRENDER API is all you get, and usually apps have more sophisticated needs than what it can provide. For instance, browsers can't really use XRENDER nowadays because there's no way to describe CSS 3D transforms in it. And if you use it you're at the mercy of the window server to implement it reasonably, which is not a safe assumption. (A lot of the reason Chrome on Linux was faster than Firefox in the early days is that Firefox used XRENDER, while Chrome rendered on CPU. I remember at least one engineer at Mozilla who was bitter about that, after putting in all the work to make Firefox use it only to have it be a net loss.) In any case, you can avoid the window blit by simply using scanout compositing, as detailed in my other reply, so there is really is no compelling reason to reinvent XRENDER.
- Jasper_ 3y agoXrender is hardware-accelerated on an increasingly small number of devices, and even SNA, the flagship hardware-accelerated implementation in the Intel driver fell back to software rasterization extremely frequently [0]. In practice it wasn't worth it, and it was extremely buggy, hence why it fell into disrepair. The semantics of Xrender simply don't match with what modern GPUs give you, even ones with 2D pipelines. [0] https://gitlab.freedesktop.org/search?search=sna_pixmap_move_to_cpu&nav_source=navbar&project_id=612&group_id=2215&search_code=true&repository_ref=master https://gitlab.freedesktop.org/search?search=sna_pixmap_move...