chore: Update smithay
This commit is contained in:
parent
c787cbdbbd
commit
d16b752030
4 changed files with 48 additions and 48 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -3145,7 +3145,7 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
|
|||
[[package]]
|
||||
name = "smithay"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/pop-os/smithay?rev=6276454e856#6276454e8565f386722da0a516c7a6e9e60ba3d7"
|
||||
source = "git+https://github.com/pop-os/smithay?rev=19f7c9aad6#19f7c9aad6e164ad78e0913e4371585441a14702"
|
||||
dependencies = [
|
||||
"appendlist",
|
||||
"ash",
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ tracing = "0.1.37"
|
|||
[dependencies.smithay]
|
||||
version = "0.3"
|
||||
git = "https://github.com/smithay/smithay.git"
|
||||
branch = "30dc3abb57"
|
||||
rev = "30dc3abb57"
|
||||
default-features = false
|
||||
features = ["backend_drm", "backend_gbm", "backend_egl", "backend_libinput", "backend_session_libseat", "backend_udev", "backend_winit", "backend_vulkan", "backend_x11", "desktop", "use_system_lib", "renderer_glow", "renderer_multi", "wayland_frontend", "xwayland"]
|
||||
|
||||
|
|
@ -68,4 +68,4 @@ debug = true
|
|||
lto = "fat"
|
||||
|
||||
[patch."https://github.com/Smithay/smithay.git"]
|
||||
smithay = { git = "https://github.com/pop-os/smithay", rev = "6276454e856" }
|
||||
smithay = { git = "https://github.com/pop-os/smithay", rev = "19f7c9aad6" }
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ pub struct KmsState {
|
|||
pub struct Device {
|
||||
render_node: DrmNode,
|
||||
surfaces: HashMap<crtc::Handle, Surface>,
|
||||
drm: Dispatcher<'static, DrmDevice, Data>,
|
||||
drm: DrmDevice,
|
||||
gbm: GbmDevice<DrmDeviceFd>,
|
||||
allocator: Box<dyn Allocator<Buffer = Dmabuf, Error = AnyError>>,
|
||||
formats: HashSet<Format>,
|
||||
|
|
@ -223,7 +223,7 @@ pub fn init_backend(
|
|||
error!(?err, "Failed to resume libinput context.");
|
||||
}
|
||||
for device in data.state.backend.kms().devices.values() {
|
||||
device.drm.as_source_ref().activate();
|
||||
device.drm.activate();
|
||||
}
|
||||
let dispatcher = dispatcher.clone();
|
||||
handle.insert_idle(move |data| {
|
||||
|
|
@ -294,7 +294,7 @@ pub fn init_backend(
|
|||
SessionEvent::PauseSession => {
|
||||
libinput_context.suspend();
|
||||
for device in data.state.backend.kms().devices.values() {
|
||||
device.drm.as_source_ref().pause();
|
||||
device.drm.pause();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -369,7 +369,7 @@ impl State {
|
|||
})?,
|
||||
)
|
||||
});
|
||||
let drm = DrmDevice::new(fd.clone(), false)
|
||||
let (drm, notifier) = DrmDevice::new(fd.clone(), false)
|
||||
.with_context(|| format!("Failed to initialize drm device for: {}", path.display()))?;
|
||||
let drm_node = DrmNode::from_dev_id(dev)?;
|
||||
let supports_atomic = drm.is_atomic();
|
||||
|
|
@ -401,11 +401,16 @@ impl State {
|
|||
// otherwise the EGLDisplay created below might share the same GBM context
|
||||
};
|
||||
|
||||
let dispatcher =
|
||||
Dispatcher::new(drm, move |event, metadata, data: &mut Data| match event {
|
||||
DrmEvent::VBlank(crtc) => {
|
||||
let rescheduled =
|
||||
if let Some(device) = data.state.backend.kms().devices.get_mut(&drm_node) {
|
||||
let token = self
|
||||
.common
|
||||
.event_loop_handle
|
||||
.insert_source(
|
||||
notifier,
|
||||
move |event, metadata, data: &mut Data| match event {
|
||||
DrmEvent::VBlank(crtc) => {
|
||||
let rescheduled = if let Some(device) =
|
||||
data.state.backend.kms().devices.get_mut(&drm_node)
|
||||
{
|
||||
if let Some(surface) = device.surfaces.get_mut(&crtc) {
|
||||
#[cfg(feature = "debug")]
|
||||
surface.fps.displayed();
|
||||
|
|
@ -467,35 +472,32 @@ impl State {
|
|||
None
|
||||
};
|
||||
|
||||
if let Some((output, avg_rendertime)) = rescheduled {
|
||||
let mut scheduled_sessions =
|
||||
data.state.workspace_session_for_output(&output);
|
||||
let mut output_sessions = output.pending_buffers().peekable();
|
||||
if output_sessions.peek().is_some() {
|
||||
scheduled_sessions
|
||||
.get_or_insert_with(Vec::new)
|
||||
.extend(output_sessions);
|
||||
}
|
||||
if let Some((output, avg_rendertime)) = rescheduled {
|
||||
let mut scheduled_sessions =
|
||||
data.state.workspace_session_for_output(&output);
|
||||
let mut output_sessions = output.pending_buffers().peekable();
|
||||
if output_sessions.peek().is_some() {
|
||||
scheduled_sessions
|
||||
.get_or_insert_with(Vec::new)
|
||||
.extend(output_sessions);
|
||||
}
|
||||
|
||||
let repaint_delay = std::cmp::max(avg_rendertime, MIN_RENDER_TIME);
|
||||
if let Err(err) = data.state.backend.kms().schedule_render(
|
||||
&data.state.common.event_loop_handle,
|
||||
&output,
|
||||
Some(repaint_delay),
|
||||
scheduled_sessions,
|
||||
) {
|
||||
warn!(?err, "Failed to schedule render.");
|
||||
let repaint_delay = std::cmp::max(avg_rendertime, MIN_RENDER_TIME);
|
||||
if let Err(err) = data.state.backend.kms().schedule_render(
|
||||
&data.state.common.event_loop_handle,
|
||||
&output,
|
||||
Some(repaint_delay),
|
||||
scheduled_sessions,
|
||||
) {
|
||||
warn!(?err, "Failed to schedule render.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DrmEvent::Error(err) => {
|
||||
warn!(?err, "Failed to read events of device {:?}.", dev);
|
||||
}
|
||||
});
|
||||
let token = self
|
||||
.common
|
||||
.event_loop_handle
|
||||
.register_dispatcher(dispatcher.clone())
|
||||
DrmEvent::Error(err) => {
|
||||
warn!(?err, "Failed to read events of device {:?}.", dev);
|
||||
}
|
||||
},
|
||||
)
|
||||
.with_context(|| format!("Failed to add drm device to event loop: {}", dev))?;
|
||||
|
||||
let socket = match self.create_socket(dh, render_node, formats.clone().into_iter()) {
|
||||
|
|
@ -518,7 +520,7 @@ impl State {
|
|||
surfaces: HashMap::new(),
|
||||
gbm: gbm.clone(),
|
||||
allocator,
|
||||
drm: dispatcher,
|
||||
drm,
|
||||
formats,
|
||||
supports_atomic,
|
||||
event_token: Some(token),
|
||||
|
|
@ -754,10 +756,8 @@ pub struct OutputChanges {
|
|||
|
||||
impl Device {
|
||||
pub fn enumerate_surfaces(&mut self) -> Result<OutputChanges> {
|
||||
let drm = &mut *self.drm.as_source_mut();
|
||||
|
||||
// enumerate our outputs
|
||||
let config = drm_helpers::display_configuration(drm, self.supports_atomic)?;
|
||||
let config = drm_helpers::display_configuration(&mut self.drm, self.supports_atomic)?;
|
||||
|
||||
let surfaces = self
|
||||
.surfaces
|
||||
|
|
@ -787,7 +787,7 @@ impl Device {
|
|||
position: (i32, i32),
|
||||
renderer: &mut GlMultiRenderer<'_, '_>,
|
||||
) -> Result<Output> {
|
||||
let drm = &mut *self.drm.as_source_mut();
|
||||
let drm = &mut self.drm;
|
||||
let crtc_info = drm.get_crtc(crtc)?;
|
||||
let conn_info = drm.get_connector(conn, false)?;
|
||||
let vrr = drm_helpers::set_vrr(drm, crtc, conn, true).unwrap_or(false);
|
||||
|
|
@ -1011,7 +1011,7 @@ impl KmsState {
|
|||
}
|
||||
false
|
||||
} else {
|
||||
let drm = &mut *device.drm.as_source_mut();
|
||||
let drm = &mut device.drm;
|
||||
let conn = surface.connector;
|
||||
let conn_info = drm.get_connector(conn, false)?;
|
||||
let mode = conn_info
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ impl ScreencopyHandler for State {
|
|||
}
|
||||
|
||||
if let Some(BufferType::Shm) = buffer_type(¶ms.buffer) {
|
||||
if with_buffer_contents(¶ms.buffer, |_, info| {
|
||||
if with_buffer_contents(¶ms.buffer, |_, _, info| {
|
||||
info.format != ShmFormat::Abgr8888 && info.format != ShmFormat::Xbgr8888
|
||||
})
|
||||
.unwrap()
|
||||
|
|
@ -502,7 +502,7 @@ where
|
|||
{
|
||||
if matches!(buffer_type(buffer), Some(BufferType::Shm)) {
|
||||
let buffer_size = buffer_dimensions(buffer).unwrap();
|
||||
with_buffer_contents_mut(buffer, |slice, data| {
|
||||
with_buffer_contents_mut(buffer, |ptr, len, data| {
|
||||
let offset = data.offset as i32;
|
||||
let width = data.width as i32;
|
||||
let height = data.height as i32;
|
||||
|
|
@ -513,7 +513,7 @@ where
|
|||
let pixelsize = 4i32;
|
||||
|
||||
// ensure consistency, the SHM handler of smithay should ensure this
|
||||
assert!((offset + (height - 1) * stride + width * pixelsize) as usize <= slice.len());
|
||||
assert!((offset + (height - 1) * stride + width * pixelsize) as usize <= len);
|
||||
|
||||
let mapping =
|
||||
renderer.copy_framebuffer(Rectangle::from_loc_and_size((0, 0), buffer_size))?;
|
||||
|
|
@ -524,7 +524,7 @@ where
|
|||
unsafe {
|
||||
std::ptr::copy_nonoverlapping::<u8>(
|
||||
gl_data.as_ptr().offset((width * pixelsize * i) as isize),
|
||||
slice.as_mut_ptr().offset((offset + stride * i) as isize),
|
||||
ptr.offset((offset + stride * i) as isize),
|
||||
(width * pixelsize) as usize,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue