Skip to content

Commit

Permalink
Merge pull request #266 from LGFae/nuke-sctk
Browse files Browse the repository at this point in the history
Nuke sctk
  • Loading branch information
LGFae committed Apr 7, 2024
2 parents c77cdff + 363fb76 commit 22dceb1
Show file tree
Hide file tree
Showing 7 changed files with 672 additions and 425 deletions.
67 changes: 3 additions & 64 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,4 @@ Fully automated, complete testing, for every option
This is annoying because it would involve changing the output scaling and
testing many things with different setups. Maybe we can script it somehow?

Nuke smithay-client-toolkit
- copy over their implementation of RawPool (see if we can improve it for
our purposes)
- manually implemented all the wayland handling code in daemon/src/main.rs
in a wayland.rs module
This will make it easier to include newer protocols later own. For example,
fractional scaling, presentation time, and HDR. It will also prevent huge rewrites
due to changes in sctk's api (like has happened before).
Change proc traversal code to just try pinging the daemon.
6 changes: 4 additions & 2 deletions daemon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ log = { version = "0.4", features = ["max_level_debug", "release_max_level_info"
simplelog = "0.12"

wayland-client = { version = "0.31", default-features = false, features = [ "log" ]}
smithay-client-toolkit = { version = "0.18", default-features = false }
wayland-protocols = { version = "0.31", default-features = false, features = [ "client" ]}
wayland-protocols-wlr = { version = "0.2", default-features = false, features = [ "client" ]}

# use specific git version for Duration implementation. We will do this until the next bitcode release
bitcode = { git = "https://github.com/SoftbearStudios/bitcode.git", rev = "5f25a59", default-features = false }
rustix = { version = "0.38", default-features = false, features = [ "event" ] }
rustix = { version = "0.38", default-features = false, features = [ "event", "shm", "mm" ] }
memmap2 = "0.9"
libc = "0.2"

keyframe = "1.1"
Expand Down
41 changes: 10 additions & 31 deletions daemon/src/bump_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ use std::sync::{
Arc,
};

use smithay_client_toolkit::shm::{raw::RawPool, Shm};
use wayland_client::{protocol::wl_buffer::WlBuffer, QueueHandle};
use crate::raw_pool::RawPool;
use wayland_client::{
protocol::{wl_buffer::WlBuffer, wl_shm::WlShm},
QueueHandle,
};

use crate::Daemon;

Expand Down Expand Up @@ -40,22 +43,10 @@ pub(crate) struct BumpPool {

impl BumpPool {
/// We assume `width` and `height` have already been multiplied by their scale factor
pub(crate) fn new(width: i32, height: i32, shm: &Shm, qh: &QueueHandle<Daemon>) -> Self {
pub(crate) fn new(width: i32, height: i32, shm: &WlShm) -> Self {
let len = width as usize * height as usize * crate::pixel_format().channels() as usize;
let mut pool = RawPool::new(len, shm).expect("failed to create RawPool");
let released = Arc::new(AtomicBool::new(true));
let buffers = vec![Buffer::new(
pool.create_buffer(
0,
width,
height,
width * crate::pixel_format().channels() as i32,
crate::wl_shm_format(),
released.clone(),
qh,
),
released,
)];
let pool = RawPool::new(len, shm);
let buffers = vec![];

Self {
pool,
Expand Down Expand Up @@ -150,23 +141,11 @@ impl BumpPool {
}

/// We assume `width` and `height` have already been multiplied by their scale factor
pub(crate) fn resize(&mut self, width: i32, height: i32, qh: &QueueHandle<Daemon>) {
#[inline]
pub(crate) fn resize(&mut self, width: i32, height: i32) {
self.width = width;
self.height = height;
self.last_used_buffer = None;
self.buffers.clear();
let released = Arc::new(AtomicBool::new(true));
self.buffers.push(Buffer::new(
self.pool.create_buffer(
0,
width,
height,
width * crate::pixel_format().channels() as i32,
crate::wl_shm_format(),
released.clone(),
qh,
),
released,
));
}
}
Loading

0 comments on commit 22dceb1

Please sign in to comment.