feat: unify system status codes

This commit is contained in:
daniel committed 2026-09-30 09:43:18 +02:00
1 parent 93894b8fe5
commit 8a3ffb2be1
46 files changed
+1499 -489

No files matched your search

+10 -5
View File
@@ -118,18 +118,18 @@ namespace montauk::abi {
if ((int64_t)index == -1) {
return GPU::FlipSupported() ? 1 : 0;
}
if (!GPU::FlipSupported()) return -1;
if (!GPU::FlipSupported()) return UnsupportedOp;
auto* proc = Sched::GetCurrentProcessPtr();
if ((int64_t)index == -2) {
return proc != nullptr ? GPU::AcquireFlip(proc->pid) : -1;
return proc != nullptr ? GPU::AcquireFlip(proc->pid) : GenericFailure;
}
if (proc == nullptr) return -1;
if (proc == nullptr) return GenericFailure;
return GPU::Flip((int)index, (flags & 1) != 0, proc->pid);
}
static int64_t Sys_DisplayInfo(DisplayInfo* out) {
return Drivers::Graphics::IntelGPU::GetDisplayInfo(out) ? 0 : -1;
return Drivers::Graphics::IntelGPU::GetDisplayInfo(out) ? Success : NoDevice;
}
static int64_t Sys_DisplayModes(DisplayModeInfo* out, int maxCount) {
@@ -137,7 +137,12 @@ namespace montauk::abi {
}
static int64_t Sys_DisplaySetMode(int modeIndex) {
return Drivers::Graphics::IntelGPU::SetDisplayMode(modeIndex);
// The driver answers -2 for a mode that would need link retraining
// and -3 for a modeset that failed and was rolled back.
int64_t rc = Drivers::Graphics::IntelGPU::SetDisplayMode(modeIndex);
if (rc == -2) return UnsupportedOp;
if (rc == -3) return IoFailure;
return rc;
}
static int64_t Sys_DisplayBrightness(int percent) {