drivers/graphics: Remove unnecessary graphic-ipc dependencies

And other unnecessary dependencies. Also move all graphics-ipc contents
to the top of the crate.
This commit is contained in:
bjorn3
2026-03-17 20:26:18 +01:00
parent 09a23a3c4a
commit cdb4ec4575
15 changed files with 58 additions and 76 deletions
Generated
+1 -9
View File
@@ -593,10 +593,10 @@ dependencies = [
"common",
"drm-sys",
"edid",
"graphics-ipc",
"inputd",
"libredox",
"log",
"redox-ioctl",
"redox-scheme",
"redox_syscall 0.7.3",
]
@@ -932,12 +932,7 @@ dependencies = [
name = "graphics-ipc"
version = "0.1.0"
dependencies = [
"common",
"drm",
"libredox",
"log",
"plain",
"redox-ioctl",
]
[[package]]
@@ -1087,7 +1082,6 @@ dependencies = [
"drm-sys",
"edid",
"embedded-hal",
"graphics-ipc",
"libredox",
"log",
"nb 1.1.0",
@@ -2513,7 +2507,6 @@ dependencies = [
"daemon",
"driver-graphics",
"drm-sys",
"graphics-ipc",
"libredox",
"orbclient",
"ransid",
@@ -2568,7 +2561,6 @@ dependencies = [
"driver-graphics",
"drm-sys",
"futures",
"graphics-ipc",
"libredox",
"log",
"orbclient",
+1 -1
View File
@@ -7,7 +7,7 @@ use std::{cmp, io, mem, ptr};
use drm::buffer::{Buffer, DrmFourcc};
use drm::control::dumbbuffer::{DumbBuffer, DumbMapping};
use drm::control::{framebuffer, ClipRect, Device};
use graphics_ipc::v2::V2GraphicsHandle;
use graphics_ipc::V2GraphicsHandle;
use orbclient::FONT;
#[derive(Debug, Copy, Clone)]
+1 -1
View File
@@ -9,12 +9,12 @@ drm-sys.workspace = true
#TODO: edid is abandoned, fork it an maintain?
edid = "0.3.0"
log.workspace = true
redox-ioctl.workspace = true
redox-scheme.workspace = true
redox_syscall.workspace = true
libredox.workspace = true
common = { path = "../../common" }
graphics-ipc = { path = "../graphics-ipc" }
inputd = { path = "../../inputd" }
[lints]
+1 -1
View File
@@ -472,7 +472,7 @@ impl<T: GraphicsAdapter> SchemeSync for GraphicsSchemeInner<T> {
metadata: &[u64],
_ctx: &CallerCtx,
) -> Result<usize> {
use graphics_ipc::v2::ipc;
use redox_ioctl::drm as ipc;
const DRM_FORMAT_ARGB8888: u32 = 0x34325241; // 'AR24' fourcc code, for ARGB8888
+1 -1
View File
@@ -4,7 +4,7 @@ use std::collections::VecDeque;
use console_draw::{Damage, TextScreen, V2DisplayMap};
use drm::buffer::Buffer;
use drm::control::Device;
use graphics_ipc::v2::V2GraphicsHandle;
use graphics_ipc::V2GraphicsHandle;
use inputd::ConsumerHandle;
use orbclient::{Event, EventOption};
use redox_scheme::scheme::SchemeSync;
+1 -1
View File
@@ -1,7 +1,7 @@
use console_draw::{Damage, TextScreen, V2DisplayMap};
use drm::buffer::Buffer;
use drm::control::Device;
use graphics_ipc::v2::V2GraphicsHandle;
use graphics_ipc::V2GraphicsHandle;
use inputd::ConsumerHandle;
use std::io;
-6
View File
@@ -6,12 +6,6 @@ edition = "2021"
[dependencies]
drm.workspace = true
log.workspace = true
libredox.workspace = true
plain = "0.2"
redox-ioctl.workspace = true
common = { path = "../../common" }
[lints]
workspace = true
+42 -1
View File
@@ -1 +1,42 @@
pub mod v2;
use std::fs::File;
use std::io;
use std::os::fd::{AsFd, BorrowedFd};
use drm::control::connector::{self, State};
use drm::control::Device as _;
use drm::{Device as _, DriverCapability};
/// A graphics handle using the v2 graphics API.
///
/// The v2 graphics API allows creating framebuffers on the fly, using them for page flipping and
/// handles all displays using a single fd. This is basically a subset of the Linux DRM interface
/// with a couple of custom ioctls in the place of the KMS ioctls that are missing.
pub struct V2GraphicsHandle {
file: File,
}
impl AsFd for V2GraphicsHandle {
fn as_fd(&self) -> BorrowedFd<'_> {
self.file.as_fd()
}
}
impl drm::Device for V2GraphicsHandle {}
impl drm::control::Device for V2GraphicsHandle {}
impl V2GraphicsHandle {
pub fn from_file(file: File) -> io::Result<Self> {
let handle = V2GraphicsHandle { file };
assert!(handle.get_driver_capability(DriverCapability::DumbBuffer)? == 1);
Ok(handle)
}
pub fn first_display(&self) -> io::Result<connector::Handle> {
for &connector in self.resource_handles().unwrap().connectors() {
if self.get_connector(connector, true)?.state() == State::Connected {
return Ok(connector);
}
}
Err(io::Error::other("no connected display"))
}
}
-46
View File
@@ -1,46 +0,0 @@
use std::fs::File;
use std::io;
use std::os::fd::{AsFd, BorrowedFd};
use drm::control::connector::{self, State};
use drm::control::Device as _;
use drm::{Device as _, DriverCapability};
/// A graphics handle using the v2 graphics API.
///
/// The v2 graphics API allows creating framebuffers on the fly, using them for page flipping and
/// handles all displays using a single fd. This is basically a subset of the Linux DRM interface
/// with a couple of custom ioctls in the place of the KMS ioctls that are missing.
pub struct V2GraphicsHandle {
file: File,
}
impl AsFd for V2GraphicsHandle {
fn as_fd(&self) -> BorrowedFd<'_> {
self.file.as_fd()
}
}
impl drm::Device for V2GraphicsHandle {}
impl drm::control::Device for V2GraphicsHandle {}
impl V2GraphicsHandle {
pub fn from_file(file: File) -> io::Result<Self> {
let handle = V2GraphicsHandle { file };
assert!(handle.get_driver_capability(DriverCapability::DumbBuffer)? == 1);
Ok(handle)
}
pub fn first_display(&self) -> io::Result<connector::Handle> {
for &connector in self.resource_handles().unwrap().connectors() {
if self.get_connector(connector, true)?.state() == State::Connected {
return Ok(connector);
}
}
Err(io::Error::other("no connected display"))
}
}
pub mod ipc {
pub use redox_ioctl::drm::*;
}
-1
View File
@@ -20,7 +20,6 @@ void = "1.0"
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
driver-graphics = { path = "../driver-graphics" }
graphics-ipc = { path = "../graphics-ipc" }
pcid = { path = "../../pcid" }
libredox.workspace = true
+3 -2
View File
@@ -9,8 +9,9 @@ use driver_graphics::kms::connector::KmsConnectorStatus;
use driver_graphics::kms::objects::{self, KmsCrtc, KmsObjectId, KmsObjects};
use driver_graphics::kms::properties::DPMS;
use driver_graphics::{Buffer, CursorPlane, Damage, GraphicsAdapter};
use drm_sys::{drm_mode_modeinfo, DRM_MODE_DPMS_ON};
use graphics_ipc::v2::ipc::{DRM_CAP_DUMB_BUFFER, DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT};
use drm_sys::{
drm_mode_modeinfo, DRM_CAP_DUMB_BUFFER, DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT, DRM_MODE_DPMS_ON,
};
use syscall::{error::EINVAL, PAGE_SIZE};
use super::Device;
-1
View File
@@ -14,7 +14,6 @@ redox_event.workspace = true
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
driver-graphics = { path = "../driver-graphics" }
graphics-ipc = { path = "../graphics-ipc" }
libredox.workspace = true
[features]
+3 -2
View File
@@ -7,8 +7,9 @@ use driver_graphics::kms::connector::KmsConnectorStatus;
use driver_graphics::kms::objects::{self, KmsCrtc, KmsObjectId, KmsObjects};
use driver_graphics::kms::properties::DPMS;
use driver_graphics::{Buffer, CursorPlane, Damage, GraphicsAdapter};
use drm_sys::{drm_mode_modeinfo, DRM_MODE_DPMS_ON};
use graphics_ipc::v2::ipc::{DRM_CAP_DUMB_BUFFER, DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT};
use drm_sys::{
drm_mode_modeinfo, DRM_CAP_DUMB_BUFFER, DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT, DRM_MODE_DPMS_ON,
};
use syscall::{EINVAL, PAGE_SIZE};
#[derive(Debug)]
-1
View File
@@ -15,7 +15,6 @@ anyhow.workspace = true
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
driver-graphics = { path = "../driver-graphics" }
graphics-ipc = { path = "../graphics-ipc" }
virtio-core = { path = "../../virtio-core" }
pcid = { path = "../../pcid" }
+4 -2
View File
@@ -6,8 +6,10 @@ use driver_graphics::kms::connector::KmsConnectorStatus;
use driver_graphics::kms::objects::{self, KmsCrtc, KmsObjectId, KmsObjects};
use driver_graphics::kms::properties::{DPMS, EDID};
use driver_graphics::{Buffer as DrmBuffer, CursorPlane, Damage, GraphicsAdapter, GraphicsScheme};
use drm_sys::{drm_mode_modeinfo, DRM_CAP_CURSOR_HEIGHT, DRM_CAP_CURSOR_WIDTH, DRM_MODE_DPMS_ON};
use graphics_ipc::v2::ipc::{DRM_CAP_DUMB_BUFFER, DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT};
use drm_sys::{
drm_mode_modeinfo, DRM_CAP_CURSOR_HEIGHT, DRM_CAP_CURSOR_WIDTH, DRM_CAP_DUMB_BUFFER,
DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT, DRM_MODE_DPMS_ON,
};
use syscall::{EINVAL, PAGE_SIZE};