add display subsystem and vmwaresvga driver, support absolute mouse and qemu tablet, map pci mmio to private virtual aperture, better smp panic handling, remove legacy io publish/match, add sys query display info and display command to native shell

This commit is contained in:
maksw committed 2026-06-15 09:58:12 +02:00
1 parent e41bf6e2c0
commit 6260de0085
38 files changed
+4011 -467

No files matched your search

@@ -89,6 +89,17 @@ static void printUInt64Width(uint64_t n, size_t width) {
printUInt64(n);
}
static void printHex32(uint32_t v) {
static const char hex[] = "0123456789abcdef";
char buf[9];
for (int i = 7; i >= 0; i--) {
buf[i] = hex[v & 0xFu];
v >>= 4;
}
buf[8] = '\0';
print(buf);
}
static void printDirTime(const SYS_SYSTEM_TIME* t) {
if (!t || !(t->Flags & SYS_TIME_FLAG_VALID)) {
print("---- -- -- --:-- ");
@@ -144,6 +155,7 @@ static void cmd_help() {
" help - Show this list\n"
" mem - Show memory usage\n"
" time - Show system wall-clock time\n"
" display - Show display provider and counters\n"
" stats - Show scheduler/CPU/PMM telemetry\n"
" ps - List processes\n"
" dir [path] - List directory contents\n"
@@ -278,6 +290,54 @@ static void cmd_time(void) {
print("\n");
}
static void printDisplayCaps(uint32_t caps) {
bool any = false;
if (caps & DISPLAY_CAP_FRAMEBUFFER) { print("framebuffer"); any = true; }
if (caps & DISPLAY_CAP_SOFTWARE_CURSOR) { if (any) print(","); print("software-cursor"); any = true; }
if (caps & DISPLAY_CAP_HARDWARE_CURSOR) { if (any) print(","); print("hardware-cursor"); any = true; }
if (caps & DISPLAY_CAP_ACCEL_FILL) { if (any) print(","); print("accel-fill"); any = true; }
if (caps & DISPLAY_CAP_ACCEL_COPY) { if (any) print(","); print("accel-copy"); any = true; }
if (caps & DISPLAY_CAP_PRESENT_SYNC) { if (any) print(","); print("present-sync"); any = true; }
if (caps & DISPLAY_CAP_VBLANK) { if (any) print(","); print("vblank"); any = true; }
if (caps & DISPLAY_CAP_3D) { if (any) print(","); print("3d"); any = true; }
if (!any) print("none");
}
static void printDisplayStats(const char* title, const DISPLAY_STATS* st) {
print(title); print(":\n");
print(" blit: "); printUInt64(st->BlitCount); print("\n");
print(" fill: "); printUInt64(st->FillRectCount); print("\n");
print(" copy: "); printUInt64(st->CopyRectCount); print("\n");
print(" read: "); printUInt64(st->ReadRectCount); print("\n");
print(" present: "); printUInt64(st->PresentCount); print(" rects="); printUInt64(st->PresentRectCount); print("\n");
print(" dirty: "); printUInt64(st->DirtyRectCount); print(" all="); printUInt64(st->DirtyAllCount); print("\n");
print(" bytes: "); printUInt64(st->BytesCopied); print("\n");
print(" sync: "); printUInt64(st->SyncCount); print("\n");
print(" cursor: move="); printUInt64(st->CursorMoveCount);
print(" show="); printUInt64(st->CursorShowCount);
print(" hide="); printUInt64(st->CursorHideCount); print("\n");
}
static void cmd_display(void) {
SYS_DISPLAY_INFO info;
uint32_t status = SysQueryDisplayInfo(&info);
if (status != 0) {
print("display: query failed: ");
printUInt(status);
print("\n");
return;
}
print("Display:\n");
print(" primary: "); print(info.PrimaryName[0] ? info.PrimaryName : "?"); print("\n");
print(" devices: "); printUInt(info.DeviceCount); print("\n");
print(" mode: "); printUInt(info.Mode.Width); print("x"); printUInt(info.Mode.Height);
print(" stride="); printUInt(info.Mode.Stride); print(" format="); printUInt((uint32_t)info.Mode.Format); print("\n");
print(" caps: 0x"); printHex32(info.Caps); print(" ["); printDisplayCaps(info.Caps); print("]\n");
printDisplayStats("Manager counters", &info.ManagerStats);
printDisplayStats("Provider counters", &info.DeviceStats);
}
static void cmd_mem(void) {
SYS_MEMORY_STATUS st;
if (SysGetMemoryStatus(&st) != 0) {
@@ -492,6 +552,7 @@ static int runCommand(const char* cmd) {
}
if (strcmp(cmd, "mem") == 0) { cmd_mem(); return 0; }
if (strcmp(cmd, "time") == 0 || strcmp(cmd, "date") == 0) { cmd_time(); return 0; }
if (strcmp(cmd, "display") == 0 || strcmp(cmd, "gpu") == 0) { cmd_display(); return 0; }
if (strcmp(cmd, "stats") == 0 || strcmp(cmd, "telemetry") == 0) { cmd_stats(); return 0; }
if (strcmp(cmd, "ps") == 0) { cmd_ps(); return 0; }
if (strcmp(cmd, "dir") == 0) { cmd_dir("."); return 0; }