mirror of
https://github.com/YaLTeR/niri.git
synced 2024-09-11 20:37:25 +03:00
Merge 67d3d93942
into 1da99f4003
This commit is contained in:
commit
9dbcf9a448
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -3355,7 +3355,7 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
||||
[[package]]
|
||||
name = "smithay"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/Smithay/smithay.git#234586dbea6bc084cb72a32f164997e47ea36b2b"
|
||||
source = "git+https://github.com/Smithay/smithay.git?rev=f04e7c22f91b56177cb2c6a2b1e4e71056ce0c2f#f04e7c22f91b56177cb2c6a2b1e4e71056ce0c2f"
|
||||
dependencies = [
|
||||
"appendlist",
|
||||
"bitflags 2.5.0",
|
||||
@ -3429,7 +3429,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "smithay-drm-extras"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/Smithay/smithay.git#234586dbea6bc084cb72a32f164997e47ea36b2b"
|
||||
source = "git+https://github.com/Smithay/smithay.git?rev=f04e7c22f91b56177cb2c6a2b1e4e71056ce0c2f#f04e7c22f91b56177cb2c6a2b1e4e71056ce0c2f"
|
||||
dependencies = [
|
||||
"drm",
|
||||
"edid-rs",
|
||||
|
@ -21,11 +21,13 @@ tracy-client = { version = "0.17.0", default-features = false }
|
||||
|
||||
[workspace.dependencies.smithay]
|
||||
git = "https://github.com/Smithay/smithay.git"
|
||||
rev = "f04e7c22f91b56177cb2c6a2b1e4e71056ce0c2f"
|
||||
# path = "../smithay"
|
||||
default-features = false
|
||||
|
||||
[workspace.dependencies.smithay-drm-extras]
|
||||
git = "https://github.com/Smithay/smithay.git"
|
||||
rev = "f04e7c22f91b56177cb2c6a2b1e4e71056ce0c2f"
|
||||
# path = "../smithay/smithay-drm-extras"
|
||||
|
||||
[package]
|
||||
|
@ -1242,8 +1242,6 @@ pub struct DebugConfig {
|
||||
#[knuffel(child)]
|
||||
pub wait_for_frame_completion_before_queueing: bool,
|
||||
#[knuffel(child)]
|
||||
pub enable_color_transformations_capability: bool,
|
||||
#[knuffel(child)]
|
||||
pub enable_overlay_planes: bool,
|
||||
#[knuffel(child)]
|
||||
pub disable_cursor_plane: bool,
|
||||
|
@ -24,9 +24,9 @@ use smithay::backend::drm::{
|
||||
DrmDevice, DrmDeviceFd, DrmEvent, DrmEventMetadata, DrmEventTime, DrmNode, NodeType,
|
||||
};
|
||||
use smithay::backend::egl::context::ContextPriority;
|
||||
use smithay::backend::egl::{EGLContext, EGLDevice, EGLDisplay};
|
||||
use smithay::backend::egl::{EGLDevice, EGLDisplay};
|
||||
use smithay::backend::libinput::{LibinputInputBackend, LibinputSessionInterface};
|
||||
use smithay::backend::renderer::gles::{Capability, GlesRenderer};
|
||||
use smithay::backend::renderer::gles::GlesRenderer;
|
||||
use smithay::backend::renderer::multigpu::gbm::GbmGlesBackend;
|
||||
use smithay::backend::renderer::multigpu::{GpuManager, MultiFrame, MultiRenderer};
|
||||
use smithay::backend::renderer::{DebugFlags, ImportDma, ImportEgl, Renderer};
|
||||
@ -148,7 +148,16 @@ impl OutputDevice {
|
||||
builder.add_connector(connector);
|
||||
builder.add_crtc(*crtc);
|
||||
let planes = self.drm.planes(crtc).map_err(LeaseRejected::with_cause)?;
|
||||
builder.add_plane(planes.primary.handle);
|
||||
let (primary_plane, primary_plane_claim) = planes
|
||||
.primary
|
||||
.iter()
|
||||
.find_map(|plane| {
|
||||
self.drm
|
||||
.claim_plane(plane.handle, *crtc)
|
||||
.map(|claim| (plane, claim))
|
||||
})
|
||||
.ok_or_else(LeaseRejected::default)?;
|
||||
builder.add_plane(primary_plane.handle, primary_plane_claim);
|
||||
}
|
||||
Ok(builder)
|
||||
}
|
||||
@ -239,25 +248,7 @@ impl Tty {
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
let config_ = config.clone();
|
||||
let create_renderer = move |display: &EGLDisplay| {
|
||||
let color_transforms = config_
|
||||
.borrow()
|
||||
.debug
|
||||
.enable_color_transformations_capability;
|
||||
|
||||
let egl_context = EGLContext::new_with_priority(display, ContextPriority::High)?;
|
||||
let gles = if color_transforms {
|
||||
unsafe { GlesRenderer::new(egl_context)? }
|
||||
} else {
|
||||
let capabilities = unsafe { GlesRenderer::supported_capabilities(&egl_context) }?
|
||||
.into_iter()
|
||||
.filter(|c| *c != Capability::ColorTransformations);
|
||||
unsafe { GlesRenderer::with_capabilities(egl_context, capabilities)? }
|
||||
};
|
||||
Ok(gles)
|
||||
};
|
||||
let api = GbmGlesBackend::with_factory(Box::new(create_renderer));
|
||||
let api = GbmGlesBackend::with_context_priority(ContextPriority::High);
|
||||
let gpu_manager = GpuManager::new(api).context("error creating the GPU manager")?;
|
||||
|
||||
let (primary_node, primary_render_node) = primary_node_from_config(&config.borrow())
|
||||
@ -1987,8 +1978,8 @@ fn surface_dmabuf_feedback(
|
||||
let surface = compositor.surface();
|
||||
let planes = surface.planes();
|
||||
|
||||
let plane_formats = planes
|
||||
.primary
|
||||
let plane_formats = surface
|
||||
.plane_info()
|
||||
.formats
|
||||
.iter()
|
||||
.chain(planes.overlay.iter().flat_map(|p| p.formats.iter()))
|
||||
|
@ -48,9 +48,9 @@ impl CompositorHandler for State {
|
||||
fn new_surface(&mut self, surface: &WlSurface) {
|
||||
add_pre_commit_hook::<Self, _>(surface, move |state, _dh, surface| {
|
||||
let maybe_dmabuf = with_states(surface, |surface_data| {
|
||||
surface_data
|
||||
.cached_state
|
||||
.pending::<SurfaceAttributes>()
|
||||
let mut guard = surface_data.cached_state.get::<SurfaceAttributes>();
|
||||
guard
|
||||
.pending()
|
||||
.buffer
|
||||
.as_ref()
|
||||
.and_then(|assignment| match assignment {
|
||||
|
@ -1000,8 +1000,10 @@ pub fn add_mapped_toplevel_pre_commit_hook(toplevel: &ToplevelSurface) -> HookId
|
||||
};
|
||||
|
||||
let (got_unmapped, commit_serial) = with_states(surface, |states| {
|
||||
let attrs = states.cached_state.pending::<SurfaceAttributes>();
|
||||
let got_unmapped = matches!(attrs.buffer, Some(BufferAssignment::Removed));
|
||||
let got_unmapped = {
|
||||
let mut guard = states.cached_state.get::<SurfaceAttributes>();
|
||||
matches!(guard.pending().buffer, Some(BufferAssignment::Removed))
|
||||
};
|
||||
|
||||
let role = states
|
||||
.data_map
|
||||
|
@ -17,7 +17,7 @@ pub trait NiriRenderer:
|
||||
+ AsGlesRenderer
|
||||
{
|
||||
// Associated types to work around the instability of associated type bounds.
|
||||
type NiriTextureId: Texture + Clone + 'static;
|
||||
type NiriTextureId: Texture + Clone + Send + 'static;
|
||||
type NiriError: std::error::Error
|
||||
+ Send
|
||||
+ Sync
|
||||
@ -28,7 +28,7 @@ pub trait NiriRenderer:
|
||||
impl<R> NiriRenderer for R
|
||||
where
|
||||
R: ImportAll + ImportMem + ExportMem + Bind<Dmabuf> + Offscreen<GlesTexture> + AsGlesRenderer,
|
||||
R::TextureId: Texture + Clone + 'static,
|
||||
R::TextureId: Texture + Clone + Send + 'static,
|
||||
R::Error: std::error::Error + Send + Sync + From<<GlesRenderer as Renderer>::Error> + 'static,
|
||||
{
|
||||
type NiriTextureId = R::TextureId;
|
||||
|
@ -25,7 +25,7 @@ pub fn render_snapshot_from_surface_tree(
|
||||
let data = states.data_map.get::<RendererSurfaceStateUserData>();
|
||||
|
||||
if let Some(data) = data {
|
||||
let data = &*data.borrow();
|
||||
let data = &*data.lock().unwrap();
|
||||
|
||||
if let Some(view) = data.view() {
|
||||
location += view.offset.to_f64();
|
||||
@ -42,19 +42,17 @@ pub fn render_snapshot_from_surface_tree(
|
||||
let data = states.data_map.get::<RendererSurfaceStateUserData>();
|
||||
|
||||
if let Some(data) = data {
|
||||
if let Some(view) = data.borrow().view() {
|
||||
location += view.offset.to_f64();
|
||||
} else {
|
||||
let Some(view) = data.lock().unwrap().view() else {
|
||||
return;
|
||||
}
|
||||
};
|
||||
location += view.offset.to_f64();
|
||||
|
||||
if let Err(err) = import_surface(renderer, states) {
|
||||
warn!("failed to import surface: {err:?}");
|
||||
return;
|
||||
}
|
||||
|
||||
let data = data.borrow();
|
||||
let view = data.view().unwrap();
|
||||
let data = data.lock().unwrap();
|
||||
let Some(texture) = data.texture::<GlesRenderer>(renderer.id()) else {
|
||||
return;
|
||||
};
|
||||
|
@ -461,8 +461,8 @@ impl LayoutElement for Mapped {
|
||||
|
||||
fn min_size(&self) -> Size<i32, Logical> {
|
||||
let mut size = with_states(self.toplevel().wl_surface(), |state| {
|
||||
let curr = state.cached_state.current::<SurfaceCachedState>();
|
||||
curr.min_size
|
||||
let mut guard = state.cached_state.get::<SurfaceCachedState>();
|
||||
guard.current().min_size
|
||||
});
|
||||
|
||||
if let Some(x) = self.rules.min_width {
|
||||
@ -477,8 +477,8 @@ impl LayoutElement for Mapped {
|
||||
|
||||
fn max_size(&self) -> Size<i32, Logical> {
|
||||
let mut size = with_states(self.toplevel().wl_surface(), |state| {
|
||||
let curr = state.cached_state.current::<SurfaceCachedState>();
|
||||
curr.max_size
|
||||
let mut guard = state.cached_state.get::<SurfaceCachedState>();
|
||||
guard.current().max_size
|
||||
});
|
||||
|
||||
if let Some(x) = self.rules.max_width {
|
||||
|
Loading…
Reference in New Issue
Block a user