Skip to content

Commit bb7a6a7

Browse files
committed
chore: smithay update
1 parent 2112e02 commit bb7a6a7

File tree

7 files changed

+55
-61
lines changed

7 files changed

+55
-61
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,4 @@ cosmic-protocols = { git = "https://github.com/pop-os//cosmic-protocols", branch
124124
cosmic-client-toolkit = { git = "https://github.com/pop-os//cosmic-protocols", branch = "main" }
125125

126126
[patch.crates-io]
127-
smithay = { git = "https://github.com/smithay/smithay.git", rev = "aaa1966" }
127+
smithay = { git = "https://github.com/smithay/smithay.git", rev = "c03c373" }

src/backend/kms/device.rs

Lines changed: 44 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ impl State {
264264
gbm.clone(),
265265
GbmBufferFlags::RENDERING | GbmBufferFlags::SCANOUT,
266266
),
267-
GbmFramebufferExporter::new(gbm.clone(), Some(drm_node)),
267+
GbmFramebufferExporter::new(gbm.clone(), drm_node.into()),
268268
Some(gbm.clone()),
269269
[
270270
Fourcc::Abgr2101010,
@@ -692,38 +692,31 @@ impl Device {
692692
.map(|(crtc, surface)| (*crtc, surface.output.clone()))
693693
.collect::<HashMap<_, _>>();
694694

695-
self.drm.with_compositors::<Result<()>>(|map| {
696-
for (crtc, compositor) in map.iter() {
697-
let elements = match output_map.get(crtc) {
698-
Some(output) => output_elements(
699-
Some(&self.render_node),
700-
renderer,
701-
shell,
702-
now,
703-
&output,
704-
CursorMode::All,
705-
None,
706-
)
707-
.with_context(|| "Failed to render outputs")?,
708-
None => Vec::new(),
709-
};
710-
711-
let mut compositor = compositor.lock().unwrap();
712-
compositor.render_frame(
695+
let mut drm = self.drm.lock();
696+
let map = drm.compositors();
697+
for (crtc, compositor) in map.iter() {
698+
let elements = match output_map.get(crtc) {
699+
Some(output) => output_elements(
700+
Some(&self.render_node),
713701
renderer,
714-
&elements,
715-
CLEAR_COLOR,
716-
FrameFlags::empty(),
717-
)?;
718-
if let Err(err) = compositor.commit_frame() {
719-
if !matches!(err, FrameError::EmptyFrame) {
720-
return Err(err.into());
721-
}
702+
shell,
703+
now,
704+
&output,
705+
CursorMode::All,
706+
None,
707+
)
708+
.with_context(|| "Failed to render outputs")?,
709+
None => Vec::new(),
710+
};
711+
712+
let mut compositor = compositor.lock().unwrap();
713+
compositor.render_frame(renderer, &elements, CLEAR_COLOR, FrameFlags::empty())?;
714+
if let Err(err) = compositor.commit_frame() {
715+
if !matches!(err, FrameError::EmptyFrame) {
716+
return Err(err.into());
722717
}
723718
}
724-
725-
Ok(())
726-
})?;
719+
}
727720
}
728721

729722
Ok(())
@@ -760,27 +753,27 @@ impl Device {
760753
shell,
761754
)?;
762755

763-
self.drm.with_compositors(|comps| {
764-
for (crtc, comp) in comps {
765-
let Some(surface) = self.surfaces.get_mut(crtc) else {
766-
continue;
767-
};
768-
let comp = comp.lock().unwrap();
769-
surface.primary_plane_formats = if flag {
770-
comp.surface().plane_info().formats.clone()
771-
} else {
772-
// This certainly isn't perfect and might still miss the happy path,
773-
// but it is surprisingly difficult to hack an api into smithay,
774-
// to get the actual framebuffer format
775-
let code = comp.format();
776-
FormatSet::from_iter(comp.modifiers().iter().map(|mo| Format {
777-
code,
778-
modifier: *mo,
779-
}))
780-
};
781-
surface.feedback.clear();
782-
}
783-
});
756+
let mut drm = self.drm.lock();
757+
let maps = drm.compositors();
758+
for (crtc, comp) in maps {
759+
let Some(surface) = self.surfaces.get_mut(crtc) else {
760+
continue;
761+
};
762+
let comp = comp.lock().unwrap();
763+
surface.primary_plane_formats = if flag {
764+
comp.surface().plane_info().formats.clone()
765+
} else {
766+
// This certainly isn't perfect and might still miss the happy path,
767+
// but it is surprisingly difficult to hack an api into smithay,
768+
// to get the actual framebuffer format
769+
let code = comp.format();
770+
FormatSet::from_iter(comp.modifiers().iter().map(|mo| Format {
771+
code,
772+
modifier: *mo,
773+
}))
774+
};
775+
surface.feedback.clear();
776+
}
784777

785778
Ok(())
786779
}

src/backend/kms/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ impl State {
310310
}
311311
// active drm, resume leases
312312
for device in backend.drm_devices.values_mut() {
313-
if let Err(err) = device.drm.activate(true) {
313+
if let Err(err) = device.drm.lock().activate(true) {
314314
error!(?err, "Failed to resume drm device");
315315
}
316316
if let Some(lease_state) = device.leasing_global.as_mut() {
@@ -771,7 +771,7 @@ impl KmsState {
771771
for (crtc, surface) in device.surfaces.iter_mut() {
772772
let output_config = surface.output.config();
773773

774-
let drm = &mut device.drm;
774+
let drm = &mut device.drm.lock();
775775
let conn = surface.connector;
776776
let conn_info = drm.device().get_connector(conn, false)?;
777777
let mode = conn_info
@@ -956,6 +956,7 @@ impl KmsState {
956956

957957
if let Err(err) = device
958958
.drm
959+
.lock()
959960
.try_to_restore_modifiers(&mut renderer, &elements)
960961
{
961962
warn!(?err, "Failed to restore modifiers");

src/wayland/handlers/data_control.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use smithay::{
77
};
88

99
impl DataControlHandler for State {
10-
fn data_control_state(&self) -> &DataControlState {
11-
self.common.data_control_state.as_ref().unwrap()
10+
fn data_control_state(&mut self) -> &mut DataControlState {
11+
self.common.data_control_state.as_mut().unwrap()
1212
}
1313
}
1414

src/wayland/handlers/data_device.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ impl ClientDndGrabHandler for State {
103103
}
104104
impl ServerDndGrabHandler for State {}
105105
impl DataDeviceHandler for State {
106-
fn data_device_state(&self) -> &DataDeviceState {
107-
&self.common.data_device_state
106+
fn data_device_state(&mut self) -> &mut DataDeviceState {
107+
&mut self.common.data_device_state
108108
}
109109
}
110110

src/wayland/handlers/primary_selection.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use smithay::{
77
};
88

99
impl PrimarySelectionHandler for State {
10-
fn primary_selection_state(&self) -> &PrimarySelectionState {
11-
&self.common.primary_selection_state
10+
fn primary_selection_state(&mut self) -> &mut PrimarySelectionState {
11+
&mut self.common.primary_selection_state
1212
}
1313
}
1414

0 commit comments

Comments
 (0)