Cut the comments back to the genuinely subtle ones

This commit is contained in:
flamingcow
2026-08-01 16:14:12 -07:00
parent 726c4c2445
commit 5eea6856fb
6 changed files with 63 additions and 127 deletions
+6 -9
View File
@@ -10,11 +10,10 @@ import (
"golang.org/x/sys/unix"
)
// Drawing lands in a plain memory buffer and is blitted to a scanout buffer the
// display is not reading, which is then swapped in whole at a vertical blank.
// Writing into the live scanout buffer instead, as the fbdev interface invites,
// races the beam: the blit takes a few hundred microseconds, and whatever the
// display reads during it is part of one frame and part of the next.
// Drawing lands in memory and is blitted to a buffer the display is not
// reading, then swapped in whole at a vertical blank. Writing into the live
// scanout buffer instead, as fbdev invites, races the beam: the blit takes a
// few hundred microseconds and the display reads half of each frame.
const (
drmIoctlBase = 0x64
@@ -239,7 +238,6 @@ func crtcFor(fd int, c drmModeGetConnector, crtcs []uint32) (uint32, error) {
return 0, fmt.Errorf("connector %d has no usable crtc", c.connectorID)
}
// The connector to drive and a crtc that can drive it.
func findDisplay(fd int) (connID, crtcID uint32, err error) {
crtcs, conns, err := cardResources(fd)
if err != nil {
@@ -507,9 +505,8 @@ func (fb *framebuffer) blend(x, y int, c rgb, cov uint8) {
fb.back[o+3] = byte(v >> 24)
}
// Copies into the scanout buffer furthest from being displayed and asks for it
// at the next blank. The copy cannot tear because nothing is displaying that
// buffer, and the swap cannot tear because the hardware does it between frames.
// The copy cannot tear because nothing is displaying that buffer, and the swap
// cannot tear because the hardware does it between frames.
func (fb *framebuffer) flush() error {
next := (fb.front + 1) % scanoutBuffers
copy(fb.bufs[next].mem, fb.back)