bump smithay
Browse files at this commit570bf1cb3c1f9ffc847359009c6061e062c72871Parent: 6ec9c729 changed files +36 -51
- Cargo.lock +2 -2
- niri-config/src/lib.rs +0 -2
- niri-visual-tests/src/smithay_view.rs +2 -7
- src/backend/tty.rs +15 -24
- src/handlers/compositor.rs +2 -1
- src/handlers/xdg_shell.rs +4 -2
- src/render_helpers/renderer.rs +2 -2
- src/render_helpers/surface.rs +5 -7
- src/window/mapped.rs +4 -4
Cargo.lockmodified+2 -2
| @@ -3355,7 +3355,7 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" | ||
| 3355 | 3355 | [[package]] |
| 3356 | 3356 | name = "smithay" |
| 3357 | 3357 | version = "0.3.0" |
| 3358 | -source = "git+https://github.com/Smithay/smithay.git#234586dbea6bc084cb72a32f164997e47ea36b2b" | |
| 3358 | +source = "git+https://github.com/Smithay/smithay.git#f208cd758416e4495e9eb8b27a96c523e92817a6" | |
| 3359 | 3359 | dependencies = [ |
| 3360 | 3360 | "appendlist", |
| 3361 | 3361 | "bitflags 2.5.0", |
| @@ -3429,7 +3429,7 @@ dependencies = [ | ||
| 3429 | 3429 | [[package]] |
| 3430 | 3430 | name = "smithay-drm-extras" |
| 3431 | 3431 | version = "0.1.0" |
| 3432 | -source = "git+https://github.com/Smithay/smithay.git#234586dbea6bc084cb72a32f164997e47ea36b2b" | |
| 3432 | +source = "git+https://github.com/Smithay/smithay.git#f208cd758416e4495e9eb8b27a96c523e92817a6" | |
| 3433 | 3433 | dependencies = [ |
| 3434 | 3434 | "drm", |
| 3435 | 3435 | "edid-rs", |
niri-config/src/lib.rsmodified+0 -2
| @@ -1244,8 +1244,6 @@ pub struct DebugConfig { | ||
| 1244 | 1244 | #[knuffel(child)] |
| 1245 | 1245 | pub wait_for_frame_completion_before_queueing: bool, |
| 1246 | 1246 | #[knuffel(child)] |
| 1247 | - pub enable_color_transformations_capability: bool, | |
| 1248 | - #[knuffel(child)] | |
| 1249 | 1247 | pub enable_overlay_planes: bool, |
| 1250 | 1248 | #[knuffel(child)] |
| 1251 | 1249 | pub disable_cursor_plane: bool, |
niri-visual-tests/src/smithay_view.rsmodified+2 -7
| @@ -15,7 +15,7 @@ mod imp { | ||
| 15 | 15 | use niri::utils::get_monotonic_time; |
| 16 | 16 | use smithay::backend::egl::ffi::egl; |
| 17 | 17 | use smithay::backend::egl::EGLContext; |
| 18 | - use smithay::backend::renderer::gles::{Capability, GlesRenderer}; | |
| 18 | + use smithay::backend::renderer::gles::GlesRenderer; | |
| 19 | 19 | use smithay::backend::renderer::{Frame, Renderer, Unbind}; |
| 20 | 20 | use smithay::utils::{Physical, Rectangle, Scale, Transform}; |
| 21 | 21 | |
| @@ -186,13 +186,8 @@ mod imp { | ||
| 186 | 186 | |
| 187 | 187 | let egl_context = EGLContext::from_raw(egl_display, egl_config_id as *const _, egl_context) |
| 188 | 188 | .context("error creating EGL context")?; |
| 189 | - let capabilities = GlesRenderer::supported_capabilities(&egl_context) | |
| 190 | - .context("error getting supported renderer capabilities")? | |
| 191 | - .into_iter() | |
| 192 | - .filter(|c| *c != Capability::ColorTransformations); | |
| 193 | 189 | |
| 194 | - let mut renderer = GlesRenderer::with_capabilities(egl_context, capabilities) | |
| 195 | - .context("error creating GlesRenderer")?; | |
| 190 | + let mut renderer = GlesRenderer::new(egl_context).context("error creating GlesRenderer")?; | |
| 196 | 191 | |
| 197 | 192 | resources::init(&mut renderer); |
| 198 | 193 | shaders::init(&mut renderer); |
src/backend/tty.rsmodified+15 -24
| @@ -24,9 +24,9 @@ use smithay::backend::drm::{ | ||
| 24 | 24 | DrmDevice, DrmDeviceFd, DrmEvent, DrmEventMetadata, DrmEventTime, DrmNode, NodeType, |
| 25 | 25 | }; |
| 26 | 26 | use smithay::backend::egl::context::ContextPriority; |
| 27 | -use smithay::backend::egl::{EGLContext, EGLDevice, EGLDisplay}; | |
| 27 | +use smithay::backend::egl::{EGLDevice, EGLDisplay}; | |
| 28 | 28 | use smithay::backend::libinput::{LibinputInputBackend, LibinputSessionInterface}; |
| 29 | -use smithay::backend::renderer::gles::{Capability, GlesRenderer}; | |
| 29 | +use smithay::backend::renderer::gles::GlesRenderer; | |
| 30 | 30 | use smithay::backend::renderer::multigpu::gbm::GbmGlesBackend; |
| 31 | 31 | use smithay::backend::renderer::multigpu::{GpuManager, MultiFrame, MultiRenderer}; |
| 32 | 32 | use smithay::backend::renderer::{DebugFlags, ImportDma, ImportEgl, Renderer}; |
| @@ -148,7 +148,16 @@ impl OutputDevice { | ||
| 148 | 148 | builder.add_connector(connector); |
| 149 | 149 | builder.add_crtc(*crtc); |
| 150 | 150 | let planes = self.drm.planes(crtc).map_err(LeaseRejected::with_cause)?; |
| 151 | - builder.add_plane(planes.primary.handle); | |
| 151 | + let (primary_plane, primary_plane_claim) = planes | |
| 152 | + .primary | |
| 153 | + .iter() | |
| 154 | + .find_map(|plane| { | |
| 155 | + self.drm | |
| 156 | + .claim_plane(plane.handle, *crtc) | |
| 157 | + .map(|claim| (plane, claim)) | |
| 158 | + }) | |
| 159 | + .ok_or_else(LeaseRejected::default)?; | |
| 160 | + builder.add_plane(primary_plane.handle, primary_plane_claim); | |
| 152 | 161 | } |
| 153 | 162 | Ok(builder) |
| 154 | 163 | } |
| @@ -239,25 +248,7 @@ impl Tty { | ||
| 239 | 248 | }) |
| 240 | 249 | .unwrap(); |
| 241 | 250 | |
| 242 | - let config_ = config.clone(); | |
| 243 | - let create_renderer = move |display: &EGLDisplay| { | |
| 244 | - let color_transforms = config_ | |
| 245 | - .borrow() | |
| 246 | - .debug | |
| 247 | - .enable_color_transformations_capability; | |
| 248 | - | |
| 249 | - let egl_context = EGLContext::new_with_priority(display, ContextPriority::High)?; | |
| 250 | - let gles = if color_transforms { | |
| 251 | - unsafe { GlesRenderer::new(egl_context)? } | |
| 252 | - } else { | |
| 253 | - let capabilities = unsafe { GlesRenderer::supported_capabilities(&egl_context) }? | |
| 254 | - .into_iter() | |
| 255 | - .filter(|c| *c != Capability::ColorTransformations); | |
| 256 | - unsafe { GlesRenderer::with_capabilities(egl_context, capabilities)? } | |
| 257 | - }; | |
| 258 | - Ok(gles) | |
| 259 | - }; | |
| 260 | - let api = GbmGlesBackend::with_factory(Box::new(create_renderer)); | |
| 251 | + let api = GbmGlesBackend::with_context_priority(ContextPriority::High); | |
| 261 | 252 | let gpu_manager = GpuManager::new(api).context("error creating the GPU manager")?; |
| 262 | 253 | |
| 263 | 254 | let (primary_node, primary_render_node) = primary_node_from_config(&config.borrow()) |
| @@ -1987,8 +1978,8 @@ fn surface_dmabuf_feedback( | ||
| 1987 | 1978 | let surface = compositor.surface(); |
| 1988 | 1979 | let planes = surface.planes(); |
| 1989 | 1980 | |
| 1990 | - let plane_formats = planes | |
| 1991 | - .primary | |
| 1981 | + let plane_formats = surface | |
| 1982 | + .plane_info() | |
| 1992 | 1983 | .formats |
| 1993 | 1984 | .iter() |
| 1994 | 1985 | .chain(planes.overlay.iter().flat_map(|p| p.formats.iter())) |
src/handlers/compositor.rsmodified+2 -1
| @@ -50,7 +50,8 @@ impl CompositorHandler for State { | ||
| 50 | 50 | let maybe_dmabuf = with_states(surface, |surface_data| { |
| 51 | 51 | surface_data |
| 52 | 52 | .cached_state |
| 53 | - .pending::<SurfaceAttributes>() | |
| 53 | + .get::<SurfaceAttributes>() | |
| 54 | + .pending() | |
| 54 | 55 | .buffer |
| 55 | 56 | .as_ref() |
| 56 | 57 | .and_then(|assignment| match assignment { |
src/handlers/xdg_shell.rsmodified+4 -2
| @@ -1006,8 +1006,10 @@ pub fn add_mapped_toplevel_pre_commit_hook(toplevel: &ToplevelSurface) -> HookId | ||
| 1006 | 1006 | }; |
| 1007 | 1007 | |
| 1008 | 1008 | let (got_unmapped, commit_serial) = with_states(surface, |states| { |
| 1009 | - let attrs = states.cached_state.pending::<SurfaceAttributes>(); | |
| 1010 | - let got_unmapped = matches!(attrs.buffer, Some(BufferAssignment::Removed)); | |
| 1009 | + let got_unmapped = { | |
| 1010 | + let mut guard = states.cached_state.get::<SurfaceAttributes>(); | |
| 1011 | + matches!(guard.pending().buffer, Some(BufferAssignment::Removed)) | |
| 1012 | + }; | |
| 1011 | 1013 | |
| 1012 | 1014 | let role = states |
| 1013 | 1015 | .data_map |
src/render_helpers/renderer.rsmodified+2 -2
| @@ -17,7 +17,7 @@ pub trait NiriRenderer: | ||
| 17 | 17 | + AsGlesRenderer |
| 18 | 18 | { |
| 19 | 19 | // Associated types to work around the instability of associated type bounds. |
| 20 | - type NiriTextureId: Texture + Clone + 'static; | |
| 20 | + type NiriTextureId: Texture + Clone + Send + 'static; | |
| 21 | 21 | type NiriError: std::error::Error |
| 22 | 22 | + Send |
| 23 | 23 | + Sync |
| @@ -28,7 +28,7 @@ pub trait NiriRenderer: | ||
| 28 | 28 | impl<R> NiriRenderer for R |
| 29 | 29 | where |
| 30 | 30 | R: ImportAll + ImportMem + ExportMem + Bind<Dmabuf> + Offscreen<GlesTexture> + AsGlesRenderer, |
| 31 | - R::TextureId: Texture + Clone + 'static, | |
| 31 | + R::TextureId: Texture + Clone + Send + 'static, | |
| 32 | 32 | R::Error: std::error::Error + Send + Sync + From<<GlesRenderer as Renderer>::Error> + 'static, |
| 33 | 33 | { |
| 34 | 34 | type NiriTextureId = R::TextureId; |
src/render_helpers/surface.rsmodified+5 -7
| @@ -25,7 +25,7 @@ pub fn render_snapshot_from_surface_tree( | ||
| 25 | 25 | let data = states.data_map.get::<RendererSurfaceStateUserData>(); |
| 26 | 26 | |
| 27 | 27 | if let Some(data) = data { |
| 28 | - let data = &*data.borrow(); | |
| 28 | + let data = &*data.lock().unwrap(); | |
| 29 | 29 | |
| 30 | 30 | if let Some(view) = data.view() { |
| 31 | 31 | location += view.offset.to_f64(); |
| @@ -42,19 +42,17 @@ pub fn render_snapshot_from_surface_tree( | ||
| 42 | 42 | let data = states.data_map.get::<RendererSurfaceStateUserData>(); |
| 43 | 43 | |
| 44 | 44 | if let Some(data) = data { |
| 45 | - if let Some(view) = data.borrow().view() { | |
| 46 | - location += view.offset.to_f64(); | |
| 47 | - } else { | |
| 45 | + let Some(view) = data.lock().unwrap().view() else { | |
| 48 | 46 | return; |
| 49 | - } | |
| 47 | + }; | |
| 48 | + location += view.offset.to_f64(); | |
| 50 | 49 | |
| 51 | 50 | if let Err(err) = import_surface(renderer, states) { |
| 52 | 51 | warn!("failed to import surface: {err:?}"); |
| 53 | 52 | return; |
| 54 | 53 | } |
| 55 | 54 | |
| 56 | - let data = data.borrow(); | |
| 57 | - let view = data.view().unwrap(); | |
| 55 | + let data = data.lock().unwrap(); | |
| 58 | 56 | let Some(texture) = data.texture::<GlesRenderer>(renderer.id()) else { |
| 59 | 57 | return; |
| 60 | 58 | }; |
src/window/mapped.rsmodified+4 -4
| @@ -461,8 +461,8 @@ impl LayoutElement for Mapped { | ||
| 461 | 461 | |
| 462 | 462 | fn min_size(&self) -> Size<i32, Logical> { |
| 463 | 463 | let mut size = with_states(self.toplevel().wl_surface(), |state| { |
| 464 | - let curr = state.cached_state.current::<SurfaceCachedState>(); | |
| 465 | - curr.min_size | |
| 464 | + let mut guard = state.cached_state.get::<SurfaceCachedState>(); | |
| 465 | + guard.current().min_size | |
| 466 | 466 | }); |
| 467 | 467 | |
| 468 | 468 | if let Some(x) = self.rules.min_width { |
| @@ -477,8 +477,8 @@ impl LayoutElement for Mapped { | ||
| 477 | 477 | |
| 478 | 478 | fn max_size(&self) -> Size<i32, Logical> { |
| 479 | 479 | let mut size = with_states(self.toplevel().wl_surface(), |state| { |
| 480 | - let curr = state.cached_state.current::<SurfaceCachedState>(); | |
| 481 | - curr.max_size | |
| 480 | + let mut guard = state.cached_state.get::<SurfaceCachedState>(); | |
| 481 | + guard.current().max_size | |
| 482 | 482 | }); |
| 483 | 483 | |
| 484 | 484 | if let Some(x) = self.rules.max_width { |