diff --git a/local/recipes/gpu/redox-drm/source/Cargo.toml b/local/recipes/gpu/redox-drm/source/Cargo.toml index b1054ae75f..a84d936fbe 100644 --- a/local/recipes/gpu/redox-drm/source/Cargo.toml +++ b/local/recipes/gpu/redox-drm/source/Cargo.toml @@ -11,13 +11,13 @@ linux-kpi = { version = "0.3", path = "../../../drivers/linux-kpi/source" } # here would collide with daemon's workspace resolution path # (recipes/core/base/libredox symlink). The redox-drm source does not # use libredox directly — it's only needed as a transitive dependency. -redox_syscall = { path = "../../../../../recipes/core/base/syscall", features = ["std"] } +redox_syscall = { path = "../../../../../local/sources/syscall", features = ["std"] } syscall04 = { package = "redox_syscall", version = "0.4" } # Use the recipe-location symlink path to match daemon's workspace # resolution, avoiding lockfile collision between # local/sources/redox-scheme and recipes/core/base/redox-scheme -redox-scheme = { path = "../../../../../recipes/core/base/redox-scheme" } -daemon = { path = "../../../../../recipes/core/base/source/daemon" } +redox-scheme = { path = "../../../../../local/sources/redox-scheme" } +daemon = { path = "../../../../../local/sources/base/daemon" } log = "0.4" thiserror = "2" bitflags = "2" @@ -27,5 +27,5 @@ getrandom = "0.2" redox-driver-sys = { path = "../../../drivers/redox-driver-sys/source" } linux-kpi = { path = "../../../drivers/linux-kpi/source" } # libredox omitted — resolved through daemon workspace transitive dep -redox-scheme = { path = "../../../../../recipes/core/base/redox-scheme" } -redox_syscall = { path = "../../../../../recipes/core/base/syscall" } +redox-scheme = { path = "../../../../../local/sources/redox-scheme" } +redox_syscall = { path = "../../../../../local/sources/syscall" } diff --git a/local/recipes/gpu/redox-drm/source/src/drivers/intel/display.rs b/local/recipes/gpu/redox-drm/source/src/drivers/intel/display.rs index dfc0f4cc72..5574210220 100644 --- a/local/recipes/gpu/redox-drm/source/src/drivers/intel/display.rs +++ b/local/recipes/gpu/redox-drm/source/src/drivers/intel/display.rs @@ -219,7 +219,7 @@ impl IntelDisplay { | ((slave_addr as u32) << GMBUS1_SLAVE_ADDR_SHIFT); self.write32(GMBUS1, cmd)?; // Wait for hardware ready - let mut timeout = 100_000; + let mut timeout: u32 = 100_000; loop { let status = self.read32(GMBUS2)?; if status & GMBUS2_HW_RDY != 0 { diff --git a/local/recipes/gpu/redox-drm/source/src/drivers/virtio/mod.rs b/local/recipes/gpu/redox-drm/source/src/drivers/virtio/mod.rs index 488ef49435..9eca0c168d 100644 --- a/local/recipes/gpu/redox-drm/source/src/drivers/virtio/mod.rs +++ b/local/recipes/gpu/redox-drm/source/src/drivers/virtio/mod.rs @@ -13,39 +13,9 @@ use crate::kms::connector::{synthetic_edid, Connector}; use crate::kms::crtc::Crtc; use crate::kms::{ConnectorInfo, ConnectorStatus, ConnectorType, ModeInfo}; -// VirtIO MMIO transport register offsets (VirtIO spec v1.2 §4.2.2). -const VIRTIO_MMIO_MAGIC: usize = 0x000; -const VIRTIO_MMIO_VERSION: usize = 0x004; -const VIRTIO_MMIO_DEVICE_ID: usize = 0x008; -const VIRTIO_MMIO_DEVICE_FEATURES: usize = 0x010; -const VIRTIO_MMIO_DEVICE_FEATURES_SEL: usize = 0x014; -const VIRTIO_MMIO_DRIVER_FEATURES: usize = 0x020; -const VIRTIO_MMIO_DRIVER_FEATURES_SEL: usize = 0x024; -const VIRTIO_MMIO_GUEST_PAGE_SIZE: usize = 0x028; -const VIRTIO_MMIO_STATUS: usize = 0x070; -const VIRTIO_MMIO_CONFIG_GENERATION: usize = 0x0FC; - -// VirtIO GPU config space offsets (after virtio MMIO transport). -// The GPU config region starts at offset 0x100 from the BAR base. -const VIRTIO_GPU_CONFIG_OFFSET: usize = 0x100; -const VIRTIO_GPU_NUM_SCANOUTS: usize = 0x00; -const VIRTIO_GPU_SCANOUT_WIDTH: usize = 0x04; -const VIRTIO_GPU_SCANOUT_HEIGHT: usize = 0x08; -const VIRTIO_GPU_SCANOUT_ENABLED: usize = 0x0C; - -// VirtIO device status bits (§2.1). -const VIRTIO_STATUS_ACKNOWLEDGE: u32 = 1; -const VIRTIO_STATUS_DRIVER: u32 = 2; -const VIRTIO_STATUS_DRIVER_OK: u32 = 4; -const VIRTIO_STATUS_FEATURES_OK: u32 = 8; - -// VirtIO GPU feature bits. -const VIRTIO_GPU_F_VIRGL: u32 = 1 << 0; -const VIRTIO_GPU_F_EDID: u32 = 1 << 1; - pub struct VirtioDriver { info: PciDeviceInfo, - mmio: MmioRegion, + _mmio: MmioRegion, irq_handle: Mutex>, width: u32, height: u32, @@ -83,7 +53,7 @@ impl VirtioDriver { } let fb_bar = find_fb_bar(&info)?; - let mmio = map_bar(&fb_bar, "VirtIO FB BAR")?; + let _mmio = map_bar(&fb_bar, "VirtIO FB BAR")?; info!( "redox-drm: VirtIO GPU at {}: {} MiB BAR at {:#x}", @@ -92,49 +62,12 @@ impl VirtioDriver { fb_bar.addr, ); - // Negotiate VirtIO features: ACKNOWLEDGE → DRIVER → FEATURES_OK → DRIVER_OK - mmio.write32(VIRTIO_MMIO_STATUS, VIRTIO_STATUS_ACKNOWLEDGE); - mmio.write32(VIRTIO_MMIO_STATUS, VIRTIO_STATUS_DRIVER); - - // Read device features and acknowledge Virgl + EDID support. - mmio.write32(VIRTIO_MMIO_DEVICE_FEATURES_SEL, 0); - let dev_features = mmio.read32(VIRTIO_MMIO_DEVICE_FEATURES); - let driver_features = dev_features & (VIRTIO_GPU_F_VIRGL | VIRTIO_GPU_F_EDID); - mmio.write32(VIRTIO_MMIO_DRIVER_FEATURES_SEL, 0); - mmio.write32(VIRTIO_MMIO_DRIVER_FEATURES, driver_features); - mmio.write32(VIRTIO_MMIO_STATUS, VIRTIO_STATUS_FEATURES_OK); - - // Read the device status back to confirm negotiation. - let status = mmio.read32(VIRTIO_MMIO_STATUS); - if status & VIRTIO_STATUS_FEATURES_OK == 0 { - warn!("redox-drm: VirtIO GPU feature negotiation failed (status={:#x})", status); - } - mmio.write32(VIRTIO_MMIO_STATUS, VIRTIO_STATUS_DRIVER_OK); - - // Read display dimensions from the VirtIO GPU config space. - let gpu_config = VIRTIO_GPU_CONFIG_OFFSET; - let num_scanouts = mmio.read32(gpu_config + VIRTIO_GPU_NUM_SCANOUTS); - let (width, height) = if num_scanouts > 0 { - let enabled = mmio.read32(gpu_config + VIRTIO_GPU_SCANOUT_ENABLED); - if enabled != 0 { - let w = mmio.read32(gpu_config + VIRTIO_GPU_SCANOUT_WIDTH); - let h = mmio.read32(gpu_config + VIRTIO_GPU_SCANOUT_HEIGHT); - info!("redox-drm: VirtIO GPU scanout 0: {}x{} ({} scanouts, enabled={})", - w, h, num_scanouts, enabled); - (w.max(640), h.max(480)) - } else { - (1280, 720) - } - } else { - (1280, 720) - }; - Ok(Self { info, - mmio, + _mmio, irq_handle: Mutex::new(None), - width, - height, + width: 1280, + height: 720, gem: Mutex::new(GemManager::new()), connectors: Mutex::new(Vec::new()), crtcs: Mutex::new(Vec::new()), diff --git a/local/sources/base b/local/sources/base index 0eae5a8420..ad1cf5e7ed 160000 --- a/local/sources/base +++ b/local/sources/base @@ -1 +1 @@ -Subproject commit 0eae5a84208865bf5f5b9d37eb9b0367cc06d7d8 +Subproject commit ad1cf5e7edb639a82cba4a0de5a69e7727f77703