(发现)有人在 Emacs 使用 Skia 替代 Cairo

原帖来自 r/emacs


我尝试在 Emacs 中使用 Skia 替代 Cairo。webkitgtk 2.46 也用 Skia 替换了 Cairo,所以我觉得这是一个好主意,主要是因为 Cairo 已不再维护(Skia 被 Google 大量使用),并且在 2026 年 GPU 加速是很有用的。Skia 是高度 GPU 加速的。这在分数缩放和滚动时应该最为重要。免责声明:我大量使用了 LLM(Claude Opus 4.5)来完成这项工作。我对它取得的成就印象深刻。我怀疑一位真正的专家需要相当长的时间才能做到同样的事情?

GitHub - ArthurHeymans/emacs at Skia 是分支,emacs/EMACS_SKIA at Skia · ArthurHeymans/emacs · GitHub 是一个概述与 Cairo 后端差异的文档。最终结果似乎效果相当不错。我不确定接下来该怎么做,因为将 Emacs 代码推送到上游(upstream)完全超出了我通常的开发者舒适区(我主要是一名开源固件开发者),而且代码可能真的不符合标准。

2 个赞

Emacs-devel 上前段时间里有过 LLM 相关的讨论( LLM-coauthored contributions),目前基本还在等 RMS 咨询律师,但感觉最后大概率不行。

1 个赞

RMS 是 Emacs 的敌人!

何出此言呀

开玩笑的,不过从历史来说,我确实觉得他一些过度理想化和情怀的决策,对 Emacs 的发展造成了伤害。不过每个人的价值观不同,我只代表我自己的看法。

3 个赞

哎,人的局限性

人的兴趣总是倾向于一个未完的事业,所以只有未完的人才是有趣的人。

有任何来源表示Cairo不再维护了吗?官网和GitLab上都没有写,上一个版本发布日期是2025-03-08,上一个commit是一个月前,怎么看都不像是停止维护的样子。

最起码是有一个实例出来了,但是不知道运行情况怎么样,等编译一下看看

麻烦到原帖下向作者提问,我只负责转帖😂

这是起因:

看 commit 记录也就是仅维护的状态

I made an attempt to use skia as an alternative to cairo in emacs. webkitgtk 2.46 also replaced cairo with skia so I thought it would be a good idea, mainly because cairo is unmaintained (skia is heavily used by google) and gpu accelaration is nice in 2026. Skia is heavily gpu accelerated. This should matter most in fractional scaling and during scrolling.

从原 reddit 的语境来说,Cairo is unmaintained 虽然不妥当,但「不再开发」的意思是没问题的

不过仅维护并不十分糟糕,只是说 cairo 不是非常适用于需要高性能的地方了。

那篇 HN 关于 Webkit 的文章中提到了:

There was an attempt at making Cairo support GPU rendering, which did not work particularly well due to the library being designed around stateful operation based upon the PostScript model—resulting in a convenient and familiar API, great output quality, but hard to retarget and with some particularly slow corner cases. Meanwhile, other web engines have moved more work to the GPU, including 2D rendering, where many operations are considerably faster.

3 个赞

确实怎么编译都启用不了skia,不知道什么情况。

是在linux里用skia吧?macOS用原生的Core Graphics 2D图形库就可以了。有时间在Ubuntu里编译一下,试试skia的效果。

我挺想给emacs贡献源码, 但是过程太繁琐了, 如果支持github就好了(这个问题之前也被讨论过,不了了之)

Cairo 一直都在开发,什么时候说不在维护了?

Skia只有Google自己用

Linux下Cairo一直都是GTK的基石

2 个赞

“敌人”,他只是想确保GNU 的法律健全性。我无法看到这会阻碍Emacs 的发展。

2 个赞

有没有具体的benchmark数据?如果只有10%这种提升说实话未必值得

Skia只有Google自己用

这并不准确,现在挺多跨平台渲染的框架在使用Skia。