Merge branch 'gpu_drm36' into 'main'

drivers/graphics: Avoid unnecessary force probes

See merge request redox-os/base!258
This commit is contained in:
Jeremy Soller
2026-05-09 06:21:08 -06:00
5 changed files with 19 additions and 14 deletions
+11 -6
View File
@@ -1,7 +1,7 @@
extern crate ransid;
use std::collections::VecDeque;
use std::convert::{TryFrom, TryInto};
use std::convert::TryFrom;
use std::{cmp, io, mem, ptr};
use drm::buffer::{Buffer, DrmFourcc};
@@ -51,7 +51,7 @@ impl Damage {
pub struct V2DisplayMap {
pub display_handle: V2GraphicsHandle,
connector: connector::Handle,
pub connector: connector::Handle,
crtc: crtc::Handle,
fb: framebuffer::Handle,
pub buffer: CpuBackedBuffer,
@@ -59,8 +59,7 @@ pub struct V2DisplayMap {
impl V2DisplayMap {
pub fn new(display_handle: V2GraphicsHandle) -> io::Result<Self> {
let connector = display_handle.first_display().unwrap();
let connector_info = display_handle.get_connector(connector, true).unwrap();
let connector_info = display_handle.first_display().unwrap();
let mode = connector_info.modes()[0];
let (width, height) = mode.size();
@@ -81,11 +80,17 @@ impl V2DisplayMap {
)?;
let fb = display_handle.add_framebuffer(buffer.buffer(), 32, 32)?;
display_handle.set_crtc(crtc, Some(fb), (0, 0), &[connector], Some(mode))?;
display_handle.set_crtc(
crtc,
Some(fb),
(0, 0),
&[connector_info.handle()],
Some(mode),
)?;
Ok(Self {
display_handle,
connector,
connector: connector_info.handle(),
crtc,
fb,
buffer,
+2 -2
View File
@@ -146,8 +146,8 @@ impl FbbootlogScheme {
fn handle_resize(map: &mut V2DisplayMap, text_screen: &mut TextScreen) {
let mode = match map
.display_handle
.first_display()
.and_then(|handle| Ok(map.display_handle.get_connector(handle, true)?.modes()[0]))
.get_connector(map.connector, false)
.map(|info| info.modes()[0])
{
Ok(mode) => mode,
Err(err) => {
+2 -2
View File
@@ -54,8 +54,8 @@ impl Display {
pub fn handle_resize(map: &mut V2DisplayMap, text_screen: &mut TextScreen) {
let mode = match map
.display_handle
.first_display()
.and_then(|handle| Ok(map.display_handle.get_connector(handle, true)?.modes()[0]))
.get_connector(map.connector, false)
.map(|info| info.modes()[0])
{
Ok(mode) => mode,
Err(err) => {
+4 -3
View File
@@ -33,10 +33,11 @@ impl V2GraphicsHandle {
Ok(handle)
}
pub fn first_display(&self) -> io::Result<connector::Handle> {
pub fn first_display(&self) -> io::Result<connector::Info> {
for &connector in self.resource_handles().unwrap().connectors() {
if self.get_connector(connector, true)?.state() == State::Connected {
return Ok(connector);
let info = self.get_connector(connector, true)?;
if info.state() == State::Connected {
return Ok(info);
}
}
Err(io::Error::other("no connected display"))
-1
View File
@@ -458,7 +458,6 @@ impl Device {
pub fn init_inner(&mut self, objects: &mut KmsObjects<Self>) {
// Discover current framebuffers
self.alloc_buffers.reset();
for pipe in self.pipes.iter() {
for plane in pipe.planes.iter() {
if plane.ctl.readf(PLANE_CTL_ENABLE) {