Update Smithay

This commit is contained in:
Ivan Molodetskikh 2024-04-09 19:06:13 +04:00
parent e448cfb0ef
commit 7e0d3d31f7
11 changed files with 32 additions and 35 deletions

4
Cargo.lock generated
View File

@ -3115,7 +3115,7 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "smithay"
version = "0.3.0"
source = "git+https://github.com/Smithay/smithay.git#e5f006818df7ebb92d206985f45e713ba1e9c1c9"
source = "git+https://github.com/Smithay/smithay.git#e237b077bd922e17849eff91ba05853c7a68f958"
dependencies = [
"appendlist",
"bitflags 2.5.0",
@ -3187,7 +3187,7 @@ dependencies = [
[[package]]
name = "smithay-drm-extras"
version = "0.1.0"
source = "git+https://github.com/Smithay/smithay.git#e5f006818df7ebb92d206985f45e713ba1e9c1c9"
source = "git+https://github.com/Smithay/smithay.git#e237b077bd922e17849eff91ba05853c7a68f958"
dependencies = [
"drm",
"edid-rs",

View File

@ -1197,7 +1197,9 @@ impl Tty {
{
if let PrimaryPlaneElement::Swapchain(element) = res.primary_element {
let _span = tracy_client::span!("wait for completion");
element.sync.wait();
if let Err(err) = element.sync.wait() {
warn!("error waiting for frame completion: {err:?}");
}
}
}

View File

@ -176,10 +176,12 @@ impl Winit {
.wait_for_frame_completion_before_queueing
{
let _span = tracy_client::span!("wait for completion");
res.sync.wait();
if let Err(err) = res.sync.wait() {
warn!("error waiting for frame completion: {err:?}");
}
}
self.backend.submit(Some(&damage)).unwrap();
self.backend.submit(Some(damage)).unwrap();
let mut presentation_feedbacks = niri.take_presentation_feedbacks(output, &res.states);
let mode = output.current_mode().unwrap();

View File

@ -10,6 +10,7 @@ use std::thread;
use smithay::backend::allocator::dmabuf::Dmabuf;
use smithay::backend::drm::DrmNode;
use smithay::backend::input::TabletToolDescriptor;
use smithay::desktop::{PopupKind, PopupManager};
use smithay::input::pointer::{CursorIcon, CursorImageStatus, PointerHandle};
use smithay::input::{keyboard, Seat, SeatHandler, SeatState};
@ -45,6 +46,7 @@ use smithay::wayland::selection::{SelectionHandler, SelectionTarget};
use smithay::wayland::session_lock::{
LockSurface, SessionLockHandler, SessionLockManagerState, SessionLocker,
};
use smithay::wayland::tablet_manager::TabletSeatHandler;
use smithay::{
delegate_cursor_shape, delegate_data_control, delegate_data_device, delegate_dmabuf,
delegate_drm_lease, delegate_idle_inhibit, delegate_idle_notify, delegate_input_method_manager,
@ -105,11 +107,20 @@ impl SeatHandler for State {
}
delegate_seat!(State);
delegate_cursor_shape!(State);
delegate_tablet_manager!(State);
delegate_pointer_gestures!(State);
delegate_relative_pointer!(State);
delegate_text_input_manager!(State);
impl TabletSeatHandler for State {
fn tablet_tool_image(&mut self, _tool: &TabletToolDescriptor, image: CursorImageStatus) {
// FIXME: tablet tools should have their own cursors.
self.niri.cursor_manager.set_cursor_image(image);
// FIXME: granular.
self.niri.queue_redraw_all();
}
}
delegate_tablet_manager!(State);
impl PointerConstraintsHandler for State {
fn new_constraint(&mut self, _surface: &WlSurface, pointer: &PointerHandle<Self>) {
self.niri.maybe_activate_pointer_constraint(

View File

@ -82,7 +82,7 @@ use smithay::wayland::shell::xdg::decoration::XdgDecorationState;
use smithay::wayland::shell::xdg::XdgShellState;
use smithay::wayland::shm::ShmState;
use smithay::wayland::socket::ListeningSocketSource;
use smithay::wayland::tablet_manager::{TabletManagerState, TabletSeatTrait};
use smithay::wayland::tablet_manager::TabletManagerState;
use smithay::wayland::text_input::TextInputManagerState;
use smithay::wayland::viewporter::ViewporterState;
use smithay::wayland::virtual_keyboard::VirtualKeyboardManagerState;
@ -1232,23 +1232,6 @@ impl Niri {
let mods_with_finger_scroll_binds =
mods_with_finger_scroll_binds(backend.mod_key(), &config_.binds);
let (tx, rx) = calloop::channel::channel();
event_loop
.insert_source(rx, move |event, _, state| {
if let calloop::channel::Event::Msg(image) = event {
state.niri.cursor_manager.set_cursor_image(image);
// FIXME: granular.
state.niri.queue_redraw_all();
}
})
.unwrap();
seat.tablet_seat()
.on_cursor_surface(move |_tool, new_image| {
if let Err(err) = tx.send(new_image) {
warn!("error sending new tablet cursor image: {err:?}");
};
});
let screenshot_ui = ScreenshotUi::new();
let config_error_notification = ConfigErrorNotification::new(config.clone());

View File

@ -2,7 +2,7 @@ use glam::Vec2;
use smithay::backend::renderer::element::{Element, Id, Kind, RenderElement, UnderlyingStorage};
use smithay::backend::renderer::gles::element::PixelShaderElement;
use smithay::backend::renderer::gles::{GlesError, GlesFrame, GlesRenderer, Uniform};
use smithay::backend::renderer::utils::CommitCounter;
use smithay::backend::renderer::utils::{CommitCounter, DamageSet};
use smithay::utils::{Buffer, Logical, Physical, Rectangle, Scale, Transform};
use super::primary_gpu_pixel_shader::PrimaryGpuPixelShaderRenderElement;
@ -85,7 +85,7 @@ impl Element for GradientRenderElement {
&self,
scale: Scale<f64>,
commit: Option<CommitCounter>,
) -> Vec<Rectangle<i32, Physical>> {
) -> DamageSet<i32, Physical> {
self.0.damage_since(scale, commit)
}

View File

@ -64,8 +64,7 @@ pub fn render_and_download(
) -> anyhow::Result<GlesMapping> {
let _span = tracy_client::span!();
let (_, sync_point) = render_to_texture(renderer, size, scale, transform, fourcc, elements)?;
sync_point.wait();
let (_, _) = render_to_texture(renderer, size, scale, transform, fourcc, elements)?;
let buffer_size = size.to_logical(1).to_buffer(1, Transform::Normal);
let mapping = renderer

View File

@ -4,7 +4,7 @@ use smithay::backend::renderer::element::texture::{TextureBuffer, TextureRenderE
use smithay::backend::renderer::element::utils::{Relocate, RelocateRenderElement};
use smithay::backend::renderer::element::{Element, Id, Kind, RenderElement, UnderlyingStorage};
use smithay::backend::renderer::gles::{GlesError, GlesFrame, GlesRenderer};
use smithay::backend::renderer::utils::CommitCounter;
use smithay::backend::renderer::utils::{CommitCounter, DamageSet};
use smithay::utils::{Buffer, Physical, Rectangle, Scale, Transform};
use super::primary_gpu_texture::PrimaryGpuTextureRenderElement;
@ -130,7 +130,7 @@ impl Element for OffscreenRenderElement {
&self,
scale: Scale<f64>,
commit: Option<CommitCounter>,
) -> Vec<Rectangle<i32, Physical>> {
) -> DamageSet<i32, Physical> {
if let Some(texture) = &self.texture {
texture.damage_since(scale, commit)
} else {

View File

@ -1,7 +1,7 @@
use smithay::backend::renderer::element::{Element, Id, Kind, RenderElement, UnderlyingStorage};
use smithay::backend::renderer::gles::element::PixelShaderElement;
use smithay::backend::renderer::gles::{GlesError, GlesFrame, GlesRenderer};
use smithay::backend::renderer::utils::CommitCounter;
use smithay::backend::renderer::utils::{CommitCounter, DamageSet};
use smithay::utils::{Buffer, Physical, Rectangle, Scale, Transform};
use super::renderer::AsGlesFrame;
@ -36,7 +36,7 @@ impl Element for PrimaryGpuPixelShaderRenderElement {
&self,
scale: Scale<f64>,
commit: Option<CommitCounter>,
) -> Vec<Rectangle<i32, Physical>> {
) -> DamageSet<i32, Physical> {
self.0.damage_since(scale, commit)
}

View File

@ -1,7 +1,7 @@
use smithay::backend::renderer::element::texture::TextureRenderElement;
use smithay::backend::renderer::element::{Element, Id, Kind, RenderElement, UnderlyingStorage};
use smithay::backend::renderer::gles::{GlesError, GlesFrame, GlesRenderer, GlesTexture};
use smithay::backend::renderer::utils::CommitCounter;
use smithay::backend::renderer::utils::{CommitCounter, DamageSet};
use smithay::utils::{Buffer, Physical, Rectangle, Scale, Transform};
use super::renderer::AsGlesFrame;
@ -36,7 +36,7 @@ impl Element for PrimaryGpuTextureRenderElement {
&self,
scale: Scale<f64>,
commit: Option<CommitCounter>,
) -> Vec<Rectangle<i32, Physical>> {
) -> DamageSet<i32, Physical> {
self.0.damage_since(scale, commit)
}

View File

@ -69,7 +69,7 @@ macro_rules! niri_render_elements {
&self,
scale: smithay::utils::Scale<f64>,
commit: Option<smithay::backend::renderer::utils::CommitCounter>,
) -> Vec<smithay::utils::Rectangle<i32, smithay::utils::Physical>> {
) -> smithay::backend::renderer::utils::DamageSet<i32, smithay::utils::Physical> {
match self {
$($name::$variant(elem) => elem.damage_since(scale, commit)),+
}