text stringlengths 0 1.47k |
|---|
// The first pan after the geometry is set is the one the driver may ignore (no_update in mtkfb.c), |
// and it is the one that puts the offset where the loop below assumes it already is. Done here so |
// that it is not counted as an unusually fast frame. |
fillPage(mem[:pageBytes], a, v) |
v.Xoffset, v.Yoffset = 0, 0 |
if err := ioctl(f.Fd(), fbioPanDisplay, unsafe.Pointer(&v)); err != nil { |
return fmt.Errorf("FBIOPAN_DISPLAY (warm-up): %w", err) |
} |
start := time.Now() |
var fills, pans []time.Duration |
late := 0 |
for n := 0; ; n++ { |
if iters > 0 && n >= iters { |
break |
} |
if forDur > 0 && time.Since(start) >= forDur { |
break |
} |
page := n % pages |
c := a |
if n%2 == 1 { |
c = b |
} |
t0 := time.Now() |
fillPage(mem[page*pageBytes:(page+1)*pageBytes], c, v) |
t1 := time.Now() |
v.Xoffset, v.Yoffset = 0, uint32(page*panelH) |
err := ioctl(f.Fd(), fbioPanDisplay, unsafe.Pointer(&v)) |
t2 := time.Now() |
if err != nil { |
return fmt.Errorf("FBIOPAN_DISPLAY: %w", err) |
} |
fills = append(fills, t1.Sub(t0)) |
pans = append(pans, t2.Sub(t1)) |
if each { |
fmt.Printf(" frame %5d page %d fill %v pan %v\n", n, page, |
t1.Sub(t0).Round(time.Microsecond), t2.Sub(t1).Round(time.Microsecond)) |
} |
if pace > 0 { |
if wait := start.Add(time.Duration(n+1) * pace).Sub(time.Now()); wait > 0 { |
time.Sleep(wait) |
} else { |
late++ |
} |
} |
} |
elapsed := time.Since(start) |
n := len(pans) |
fmt.Printf("\n%d frames in %v: %.1f frames/s\n", |
n, elapsed.Round(time.Millisecond), float64(n)/elapsed.Seconds()) |
if n > 0 { |
_, f50, _, fmax := spread(fills) |
mn, p50, p95, mx := spread(pans) |
fmt.Printf("fill p50 %v, max %v\n", f50.Round(time.Microsecond), fmax.Round(time.Microsecond)) |
fmt.Printf("pan min %v, p50 %v, p95 %v, max %v\n", |
mn.Round(time.Microsecond), p50.Round(time.Microsecond), p95.Round(time.Microsecond), mx.Round(time.Microsecond)) |
fmt.Printf("%s\n", verdict(p50, pace, late)) |
} |
return nil |
} |
func fatal(format string, a ...any) { |
fmt.Fprintf(os.Stderr, "fbprobe: "+format+"\n", a...) |
os.Exit(1) |
} |
# ===== file: cmd/rebootto/main.go ===== |
//go:build linux |
// rebootto reboots with a MediaTek boot-mode argument, the way Android's |
// `reboot bootloader` / `reboot recovery` do: the kernel's arch_reset marks |
// the target mode in the RTC spare register so LK boots into it. |
// |
// rebootto bootloader # fastboot |
// rebootto recovery |
// rebootto # plain reboot |
package main |
import ( |
"fmt" |
"os" |
"syscall" |
"unsafe" |
) |
const restart2 = 0xA1B2C3D4 // LINUX_REBOOT_CMD_RESTART2 |
func main() { |
arg := "" |
if len(os.Args) > 1 { |
arg = os.Args[1] |
} |
syscall.Sync() |
if arg == "" { |
if err := syscall.Reboot(syscall.LINUX_REBOOT_CMD_RESTART); err != nil { |
fmt.Fprintln(os.Stderr, "reboot:", err) |
os.Exit(1) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.