Drop startup/input/frame tracing from the desktop shell and window server, including the one-shot diagnostic counters.
54 lines
1.5 KiB
Plaintext
54 lines
1.5 KiB
Plaintext
import vpsdk.devfs as devfs
|
|
import vpsdk.desk as desk
|
|
import vpsdk.process as process
|
|
from stdint import *
|
|
import desk_server
|
|
|
|
|
|
@__attribute__(section(".text.startup"), aligned(16))
|
|
export def _start() -> int:
|
|
# 1) 打开 framebuffer 设备,问几何,再映射成线性地址
|
|
fb_fd: int = devfs.fb_open()
|
|
if fb_fd < 0:
|
|
process.exit(1)
|
|
return 0
|
|
|
|
# fb_get_info returns the geometry through an out parameter and a status code.
|
|
info: devfs.FbInfo
|
|
_fb_ret: int = devfs.fb_get_info(fb_fd, &info)
|
|
if _fb_ret != 0:
|
|
process.exit(1)
|
|
return 0
|
|
|
|
if info.pitch == 0 or info.size == 0:
|
|
process.exit(1)
|
|
return 0
|
|
|
|
fb_va: uint64 = devfs.fb_map(fb_fd, info.size)
|
|
if fb_va == 0:
|
|
process.exit(1)
|
|
return 0
|
|
|
|
fb: uint32* = uint32*(fb_va)
|
|
|
|
# Input devices are reachable once they can be opened.
|
|
kfd: int = devfs.kbd_open()
|
|
mfd: int = devfs.mouse_open()
|
|
|
|
# Attach and format the /dev/desk shared area used by the window server.
|
|
desk_fd: int = desk.desk_open()
|
|
if desk_fd < 0:
|
|
process.exit(1)
|
|
return 0
|
|
shm: uint64 = desk.desk_map(desk_fd)
|
|
if shm == 0:
|
|
process.exit(1)
|
|
return 0
|
|
desk.desk_format(shm, info.width, info.height, info.pitch)
|
|
|
|
# Enter the window server loop: request ring, input and composition.
|
|
srv: desk_server.DeskServer = desk_server.DeskServer()
|
|
srv.init(fb, int(info.width), int(info.height), int(info.pitch), info.format, shm, kfd, mfd, fb_fd)
|
|
srv.serve()
|
|
return 0
|