Expand redox-drm DRM scheme, amdgpu port, and update patches

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-04-18 17:58:44 +01:00
parent d4f6268854
commit 7904dc9b3d
13 changed files with 1271 additions and 1068 deletions
@@ -7,6 +7,8 @@ use crate::driver::{DriverError, Result};
pub type GemHandle = u32;
const MAX_GEM_BYTES: u64 = 256 * 1024 * 1024;
#[derive(Clone, Debug)]
pub struct GemObject {
#[allow(dead_code)]
@@ -43,6 +45,11 @@ impl GemManager {
"GEM create size must be non-zero",
));
}
if size > MAX_GEM_BYTES {
return Err(DriverError::InvalidArgument(
"GEM create size exceeds the trusted shared-core limit",
));
}
let handle = self.next_handle;
self.next_handle = self.next_handle.saturating_add(1);
@@ -113,13 +120,4 @@ impl GemManager {
pub fn gpu_addr(&self, handle: GemHandle) -> Result<Option<u64>> {
Ok(self.object(handle)?.gpu_addr)
}
#[allow(dead_code)]
pub fn object_mut_ptr(&mut self, handle: GemHandle) -> Result<usize> {
let allocation = self
.objects
.get_mut(&handle)
.ok_or_else(|| DriverError::NotFound(format!("unknown GEM handle {handle}")))?;
Ok(allocation.dma.as_mut_ptr() as usize)
}
}