From 05e1958710b160ce697b3424e81b3b9bbf859158 Mon Sep 17 00:00:00 2001 From: flamingcow Date: Tue, 4 Aug 2026 13:23:41 -0700 Subject: [PATCH] Cut the drm package comments back to what is not evident from the code --- internal/drm/drm.go | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/internal/drm/drm.go b/internal/drm/drm.go index 4baddd7..9c428b6 100644 --- a/internal/drm/drm.go +++ b/internal/drm/drm.go @@ -1,7 +1,4 @@ -// Package drm is the kernel mode-setting ABI, shared by the panel this draws on -// and the grabber that reads it back out. These structs are a layout contract, -// so a field added or reordered in one copy and not the other would silently -// misread the kernel: there is deliberately only one copy. +// Package drm is the kernel mode-setting ABI. package drm import ( @@ -93,9 +90,8 @@ type ModeCrtcPageFlip struct { UserData uint64 } -// WaitVblank has only Type and Sequence ever set, and those sit at the same -// offsets in both arms of the kernel's union. The request below carries the -// union's own size rather than this struct's, which is larger. +// WaitVblank is larger than the kernel union it mirrors, so WaitVblankIO +// carries the union's size and only Type and Sequence are at valid offsets. type WaitVblank struct { Type uint32 Sequence uint32 @@ -122,7 +118,6 @@ var ( MapDumb = IOWR(0xb3, unsafe.Sizeof(ModeMapDumb{})) ) -// What ADDFB means by 32 bits per pixel and 24 bits of colour. const ( redShift = 16 greenShift = 8 @@ -137,9 +132,8 @@ func Unpack(v uint32) (r, g, b uint8) { return uint8(v >> redShift), uint8(v >> greenShift), uint8(v >> blueShift) } -// Offset turns the quarter turn between the portrait canvas and the landscape -// panel, putting logical top on the panel's right edge. Drawing and reading -// back have to agree on this exactly. +// Offset maps the portrait canvas onto the landscape panel, a quarter turn that +// puts logical top on the panel's right edge. func Offset(x, y, stride, panelW int) int { return x*stride + (panelW-1-y)*4 }