Merge pull request #160 from mahkoh/jorth/nvidia-in-fence-fd
metal: disable IN_FENCE_FD on nvidia driver
This commit is contained in:
commit
2cef936b12
10 changed files with 69 additions and 5 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -521,7 +521,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "jay-compositor"
|
||||
version = "1.0.2"
|
||||
version = "1.0.3"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"anyhow",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "jay-compositor"
|
||||
version = "1.0.2"
|
||||
version = "1.0.3"
|
||||
edition = "2021"
|
||||
build = "build/build.rs"
|
||||
license = "GPL-3.0-only"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,30 @@
|
|||
use {
|
||||
crate::open,
|
||||
std::{fmt::Write as _, io::Write as _, process::Command},
|
||||
};
|
||||
|
||||
pub fn main() -> anyhow::Result<()> {
|
||||
create_bridge()?;
|
||||
create_version()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn create_bridge() -> anyhow::Result<()> {
|
||||
println!("cargo:rerun-if-changed=src/bridge.c");
|
||||
cc::Build::new().file("src/bridge.c").compile("bridge");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn create_version() -> anyhow::Result<()> {
|
||||
let mut version_string = env!("CARGO_PKG_VERSION").to_string();
|
||||
if let Ok(output) = Command::new("git").arg("rev-parse").arg("HEAD").output() {
|
||||
if output.status.success() {
|
||||
if let Ok(commit) = std::str::from_utf8(&output.stdout) {
|
||||
write!(version_string, " ({})", commit.trim())?;
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut f = open("version.rs")?;
|
||||
writeln!(f, "pub const VERSION: &str = \"{}\";", version_string)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
# Unreleased
|
||||
|
||||
# 1.0.3
|
||||
|
||||
- Needs jay-compositor release.
|
||||
|
||||
# 1.0.2
|
||||
|
||||
- Needs jay-compositor release.
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
- Add support for wp-alpha-modifier.
|
||||
|
||||
# 1.0.3 (2024-04-11)
|
||||
|
||||
- Partially disable explicit sync on nvidia drivers.
|
||||
|
||||
# 1.0.2 (2024-04-10)
|
||||
|
||||
- Fixed a bug that caused the portal to fail.
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ pub struct MetalDrmDevice {
|
|||
pub ctx: CloneCell<Rc<MetalRenderContext>>,
|
||||
pub on_change: OnChange<crate::backend::DrmEvent>,
|
||||
pub direct_scanout_enabled: Cell<Option<bool>>,
|
||||
pub is_nvidia: bool,
|
||||
}
|
||||
|
||||
impl MetalDrmDevice {
|
||||
|
|
@ -633,7 +634,6 @@ impl MetalConnector {
|
|||
.perform_render_pass(pass)
|
||||
.map_err(MetalError::RenderFrame)?;
|
||||
sync_file = buffer.copy_to_dev(sf)?;
|
||||
self.next_buffer.fetch_add(1);
|
||||
output.perform_screencopies(&buffer.render_tex, !render_hw_cursor, 0, 0, None);
|
||||
fb = buffer.drm.clone();
|
||||
}
|
||||
|
|
@ -714,7 +714,9 @@ impl MetalConnector {
|
|||
c.change(plane.crtc_y.id, crtc_y as u64);
|
||||
c.change(plane.crtc_w.id, crtc_w as u64);
|
||||
c.change(plane.crtc_h.id, crtc_h as u64);
|
||||
c.change(plane.in_fence_fd, in_fence as u64);
|
||||
if !self.dev.is_nvidia {
|
||||
c.change(plane.in_fence_fd, in_fence as u64);
|
||||
}
|
||||
});
|
||||
new_fb = Some(fb);
|
||||
}
|
||||
|
|
@ -748,7 +750,9 @@ impl MetalConnector {
|
|||
c.change(plane.src_y.id, 0);
|
||||
c.change(plane.src_w.id, (width as u64) << 16);
|
||||
c.change(plane.src_h.id, (height as u64) << 16);
|
||||
c.change(plane.in_fence_fd, in_fence as u64);
|
||||
if !self.dev.is_nvidia {
|
||||
c.change(plane.in_fence_fd, in_fence as u64);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
changes.change_object(plane.id, |c| {
|
||||
|
|
@ -782,6 +786,9 @@ impl MetalConnector {
|
|||
Err(MetalError::Commit(e))
|
||||
} else {
|
||||
if let Some(fb) = new_fb {
|
||||
if fb.direct_scanout_data.is_none() {
|
||||
self.next_buffer.fetch_add(1);
|
||||
}
|
||||
self.next_framebuffer.set(Some(fb));
|
||||
}
|
||||
if cursor_swap_buffer {
|
||||
|
|
@ -1586,6 +1593,22 @@ impl MetalBackend {
|
|||
Err(e) => return Err(MetalError::GbmDevice(e)),
|
||||
};
|
||||
|
||||
let mut is_nvidia = false;
|
||||
match gbm.drm.version() {
|
||||
Ok(v) => {
|
||||
is_nvidia = v.name.contains_str("nvidia");
|
||||
if is_nvidia {
|
||||
log::warn!(
|
||||
"Device {} use the nvidia driver. IN_FENCE_FD will not be used.",
|
||||
pending.devnode.as_bytes().as_bstr(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
log::warn!("Could not fetch DRM version information: {}", ErrorFmt(e));
|
||||
}
|
||||
}
|
||||
|
||||
let dev = Rc::new(MetalDrmDevice {
|
||||
backend: self.clone(),
|
||||
id: pending.id,
|
||||
|
|
@ -1608,6 +1631,7 @@ impl MetalBackend {
|
|||
ctx: CloneCell::new(ctx),
|
||||
on_change: Default::default(),
|
||||
direct_scanout_enabled: Default::default(),
|
||||
is_nvidia,
|
||||
});
|
||||
|
||||
let (connectors, futures) = get_connectors(self, &dev, &resources.connectors)?;
|
||||
|
|
@ -2385,6 +2409,7 @@ impl MetalBackend {
|
|||
if let Some(old) = connector.buffers.set(Some(buffers)) {
|
||||
old_buffers.push(old);
|
||||
}
|
||||
connector.next_buffer.set(1);
|
||||
connector.primary_plane.set(Some(primary_plane.clone()));
|
||||
if let Some(cp) = &cursor_plane {
|
||||
cp.assigned.set(true);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ use {
|
|||
oserror::OsError, queue::AsyncQueue, refcounted::RefCounted, run_toplevel::RunToplevel,
|
||||
tri::Try,
|
||||
},
|
||||
version::VERSION,
|
||||
video::drm::wait_for_sync_obj::WaitForSyncObj,
|
||||
wheel::{Wheel, WheelError},
|
||||
xkbcommon::XkbContext,
|
||||
|
|
@ -122,6 +123,7 @@ fn start_compositor2(
|
|||
test_future: Option<TestFuture>,
|
||||
) -> Result<(), CompositorError> {
|
||||
log::info!("pid = {}", uapi::getpid());
|
||||
log::info!("version = {VERSION}");
|
||||
init_fd_limit();
|
||||
leaks::init();
|
||||
clientmem::init()?;
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ mod tree;
|
|||
mod udev;
|
||||
mod user_session;
|
||||
mod utils;
|
||||
mod version;
|
||||
mod video;
|
||||
mod wheel;
|
||||
mod wire;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ use {
|
|||
run_toplevel::RunToplevel,
|
||||
xrd::xrd,
|
||||
},
|
||||
version::VERSION,
|
||||
video::dmabuf::DmaBufIds,
|
||||
wheel::Wheel,
|
||||
wire_dbus::org,
|
||||
|
|
@ -226,6 +227,7 @@ async fn init_dbus_session(dbus: &Dbus, logger: Arc<Logger>) -> Rc<DbusSocket> {
|
|||
Ok(r) if r.get().rv == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER => {
|
||||
log::info!("Acquired unique name {}", UNIQUE_NAME);
|
||||
logger.redirect("portal");
|
||||
log::info!("version = {VERSION}");
|
||||
let fork = match fork_with_pidfd(false) {
|
||||
Ok(f) => f,
|
||||
Err(e) => fatal!("Could not fork: {}", ErrorFmt(e)),
|
||||
|
|
|
|||
1
src/version.rs
Normal file
1
src/version.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
include!(concat!(env!("OUT_DIR"), "/version.rs"));
|
||||
Loading…
Add table
Add a link
Reference in a new issue