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