drivers/graphics: Implement force probing of connectors in virtio-gpud

This commit is contained in:
bjorn3
2025-12-20 19:07:28 +01:00
parent 0e98a36495
commit 816d661c9d
6 changed files with 85 additions and 32 deletions
@@ -47,7 +47,7 @@ impl<T: GraphicsAdapter> DrmObjects<T> {
connector_id
}
pub fn connectors(&self) -> impl Iterator<Item = DrmObjectId> + use<'_, T> {
pub fn connector_ids(&self) -> impl Iterator<Item = DrmObjectId> + use<'_, T> {
self.objects
.iter()
.filter_map(|(&id, object)| match object.kind {
@@ -56,6 +56,24 @@ impl<T: GraphicsAdapter> DrmObjects<T> {
})
}
pub fn connectors(&self) -> impl Iterator<Item = &DrmConnector<T>> + use<'_, T> {
self.objects
.values()
.filter_map(|object| match &object.kind {
DrmObjectKind::Connector(connector) => Some(connector),
_ => None,
})
}
pub fn connectors_mut(&mut self) -> impl Iterator<Item = &mut DrmConnector<T>> + use<'_, T> {
self.objects
.values_mut()
.filter_map(|object| match &mut object.kind {
DrmObjectKind::Connector(connector) => Some(connector),
_ => None,
})
}
pub fn get_connector(&self, id: DrmObjectId) -> Result<&DrmConnector<T>> {
let object = self.objects.get(&id).ok_or(Error::new(EINVAL))?;
match &object.kind {
@@ -72,7 +90,7 @@ impl<T: GraphicsAdapter> DrmObjects<T> {
}
}
pub fn encoders(&self) -> impl Iterator<Item = DrmObjectId> + use<'_, T> {
pub fn encoder_ids(&self) -> impl Iterator<Item = DrmObjectId> + use<'_, T> {
self.objects
.iter()
.filter_map(|(&id, object)| match object.kind {