Stabilize DRM core contracts: fix latent panics, add diagnostics and tests

Production code fixes:
- scheme.rs: replace unwrap() after checked_mul with match binding,
  eliminating a latent panic if code is reordered
- main.rs: log request context_id (PID) on request handling failure
  instead of silently discarding the error
- drivers/amd/display.rs: split silent EDID read fallback into
  separate match arms with log::warn diagnostics for short reads
  and read failures, including byte count and connector index

Test coverage:
- gem.rs: add 4 basic tests for GemManager (create+verify,
  close+verify removal, double-close error, invalid handle error)
This commit is contained in:
2026-04-25 19:52:21 +01:00
parent 4e27bee9bf
commit e62acb2ebb
4 changed files with 72 additions and 13 deletions
@@ -338,7 +338,22 @@ impl DisplayCore {
match self.read_edid_block(connector_index, 0x00) {
Ok(edid) if edid.len() >= 128 => edid,
Ok(_) | Err(_) => Vec::new(),
Ok(short) => {
log::warn!(
"redox-drm: short EDID ({} bytes) from AMD connector {}",
short.len(),
connector_index
);
Vec::new()
}
Err(e) => {
log::warn!(
"redox-drm: EDID read failed for AMD connector {}: {}",
connector_index,
e
);
Vec::new()
}
}
}