Cut the drm package comments back to what is not evident from the code
This commit is contained in:
+5
-11
@@ -1,7 +1,4 @@
|
|||||||
// Package drm is the kernel mode-setting ABI, shared by the panel this draws on
|
// Package drm is the kernel mode-setting ABI.
|
||||||
// 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
|
package drm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -93,9 +90,8 @@ type ModeCrtcPageFlip struct {
|
|||||||
UserData uint64
|
UserData uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
// WaitVblank has only Type and Sequence ever set, and those sit at the same
|
// WaitVblank is larger than the kernel union it mirrors, so WaitVblankIO
|
||||||
// offsets in both arms of the kernel's union. The request below carries the
|
// carries the union's size and only Type and Sequence are at valid offsets.
|
||||||
// union's own size rather than this struct's, which is larger.
|
|
||||||
type WaitVblank struct {
|
type WaitVblank struct {
|
||||||
Type uint32
|
Type uint32
|
||||||
Sequence uint32
|
Sequence uint32
|
||||||
@@ -122,7 +118,6 @@ var (
|
|||||||
MapDumb = IOWR(0xb3, unsafe.Sizeof(ModeMapDumb{}))
|
MapDumb = IOWR(0xb3, unsafe.Sizeof(ModeMapDumb{}))
|
||||||
)
|
)
|
||||||
|
|
||||||
// What ADDFB means by 32 bits per pixel and 24 bits of colour.
|
|
||||||
const (
|
const (
|
||||||
redShift = 16
|
redShift = 16
|
||||||
greenShift = 8
|
greenShift = 8
|
||||||
@@ -137,9 +132,8 @@ func Unpack(v uint32) (r, g, b uint8) {
|
|||||||
return uint8(v >> redShift), uint8(v >> greenShift), uint8(v >> blueShift)
|
return uint8(v >> redShift), uint8(v >> greenShift), uint8(v >> blueShift)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Offset turns the quarter turn between the portrait canvas and the landscape
|
// Offset maps the portrait canvas onto the landscape panel, a quarter turn that
|
||||||
// panel, putting logical top on the panel's right edge. Drawing and reading
|
// puts logical top on the panel's right edge.
|
||||||
// back have to agree on this exactly.
|
|
||||||
func Offset(x, y, stride, panelW int) int {
|
func Offset(x, y, stride, panelW int) int {
|
||||||
return x*stride + (panelW-1-y)*4
|
return x*stride + (panelW-1-y)*4
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user