feat(wayland): set output refreshrate to i32::MAX and instrument a bunch of functions
Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
@@ -40,6 +40,7 @@ pub struct Buffer {
|
||||
}
|
||||
|
||||
impl Buffer {
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
pub fn new(client: &mut Client, id: ObjectId, backing: BufferBacking) -> Arc<Self> {
|
||||
let buffer = client.insert(
|
||||
id,
|
||||
@@ -55,6 +56,7 @@ impl Buffer {
|
||||
}
|
||||
|
||||
/// Returns the tex if it was updated
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
pub fn update_tex(
|
||||
&self,
|
||||
dmatexes: &ImportedDmatexs,
|
||||
|
||||
@@ -23,7 +23,7 @@ impl Output {
|
||||
)
|
||||
.await?;
|
||||
|
||||
self.mode(client, self.0, Mode::Current, 2048, 2048, 0)
|
||||
self.mode(client, self.0, Mode::Current, 2048, 2048, i32::MAX)
|
||||
.await?;
|
||||
|
||||
self.done(client, self.0).await
|
||||
|
||||
@@ -38,6 +38,7 @@ impl ShmBufferBacking {
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
pub fn update_tex(&self, images: &mut Assets<Image>) -> Option<Handle<Image>> {
|
||||
let mut image_handle = self.image.lock();
|
||||
images.remove(image_handle.id());
|
||||
|
||||
@@ -18,6 +18,7 @@ pub struct ShmPool {
|
||||
}
|
||||
|
||||
impl ShmPool {
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
pub fn new(fd: OwnedFd, size: i32) -> Result<Self> {
|
||||
let map = unsafe {
|
||||
MmapOptions::new()
|
||||
@@ -30,6 +31,7 @@ impl ShmPool {
|
||||
})
|
||||
}
|
||||
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
pub fn data_lock(&self) -> MappedMutexGuard<RawMutex, [u8]> {
|
||||
MutexGuard::map(self.inner.lock(), |i| i.as_mut())
|
||||
}
|
||||
@@ -37,6 +39,7 @@ impl ShmPool {
|
||||
|
||||
impl WlShmPool for ShmPool {
|
||||
/// https://wayland.app/protocols/wayland#wl_shm_pool:request:create_buffer
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
async fn create_buffer(
|
||||
&self,
|
||||
client: &mut Client,
|
||||
@@ -61,6 +64,7 @@ impl WlShmPool for ShmPool {
|
||||
}
|
||||
|
||||
/// https://wayland.app/protocols/wayland#wl_shm_pool:request:resize
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
async fn resize(&self, _client: &mut Client, _sender_id: ObjectId, size: i32) -> Result<()> {
|
||||
let mut inner = self.inner.lock();
|
||||
unsafe { inner.remap(size as usize, RemapOptions::new().may_move(true))? };
|
||||
@@ -68,6 +72,7 @@ impl WlShmPool for ShmPool {
|
||||
}
|
||||
|
||||
/// https://wayland.app/protocols/wayland#wl_shm_pool:request:destroy
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
async fn destroy(&self, _client: &mut Client, _sender_id: ObjectId) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ impl std::fmt::Debug for Surface {
|
||||
}
|
||||
}
|
||||
impl Surface {
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
pub fn new(client: &Client, id: ObjectId) -> Self {
|
||||
Surface {
|
||||
id,
|
||||
@@ -98,10 +99,12 @@ impl Surface {
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
pub fn pending_state(&self) -> parking_lot::MutexGuard<'_, DoubleBuffer<SurfaceState>> {
|
||||
self.state.lock()
|
||||
}
|
||||
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
pub fn add_commit_handler<F: Fn(&Surface, &SurfaceState) -> bool + Send + Sync + 'static>(
|
||||
&self,
|
||||
handler: F,
|
||||
@@ -110,6 +113,7 @@ impl Surface {
|
||||
handlers.push(Box::new(handler));
|
||||
}
|
||||
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
pub fn update_graphics(
|
||||
&self,
|
||||
dmatexes: &ImportedDmatexs,
|
||||
@@ -156,11 +160,13 @@ impl Surface {
|
||||
let _ = state_lock.current().clean_lock.set(());
|
||||
}
|
||||
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
pub fn apply_material(&self, model_part: &Arc<ModelPart>) {
|
||||
// tracing::info!("uwu applying material");
|
||||
self.pending_material_applications.add_raw(model_part)
|
||||
}
|
||||
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
fn apply_surface_materials(&self) {
|
||||
let Some(mat) = self.material.get() else {
|
||||
return;
|
||||
@@ -171,12 +177,15 @@ impl Surface {
|
||||
}
|
||||
self.pending_material_applications.clear();
|
||||
}
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
fn mark_dirty(&self) {
|
||||
self.state.lock().pending.clean_lock = Default::default();
|
||||
}
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
pub fn current_state(&self) -> SurfaceState {
|
||||
self.state.lock().current().clone()
|
||||
}
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
pub fn frame_event(&self) {
|
||||
if let Some(callback_obj) = self.frame_callback_object.lock().take() {
|
||||
let _ = self.message_sink.send(Message::Frame(callback_obj));
|
||||
@@ -213,6 +222,7 @@ impl Surface {
|
||||
}
|
||||
impl WlSurface for Surface {
|
||||
/// https://wayland.app/protocols/wayland#wl_surface:request:attach
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
async fn attach(
|
||||
&self,
|
||||
client: &mut Client,
|
||||
@@ -226,6 +236,7 @@ impl WlSurface for Surface {
|
||||
}
|
||||
|
||||
/// https://wayland.app/protocols/wayland#wl_surface:request:damage
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
async fn damage(
|
||||
&self,
|
||||
_client: &mut Client,
|
||||
@@ -241,6 +252,7 @@ impl WlSurface for Surface {
|
||||
}
|
||||
|
||||
/// https://wayland.app/protocols/wayland#wl_surface:request:frame
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
async fn frame(
|
||||
&self,
|
||||
client: &mut Client,
|
||||
@@ -253,6 +265,7 @@ impl WlSurface for Surface {
|
||||
}
|
||||
|
||||
/// https://wayland.app/protocols/wayland#wl_surface:request:set_opaque_region
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
async fn set_opaque_region(
|
||||
&self,
|
||||
_client: &mut Client,
|
||||
@@ -264,6 +277,7 @@ impl WlSurface for Surface {
|
||||
}
|
||||
|
||||
/// https://wayland.app/protocols/wayland#wl_surface:request:set_input_region
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
async fn set_input_region(
|
||||
&self,
|
||||
_client: &mut Client,
|
||||
@@ -275,6 +289,7 @@ impl WlSurface for Surface {
|
||||
}
|
||||
|
||||
/// https://wayland.app/protocols/wayland#wl_surface:request:commit
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
async fn commit(&self, _client: &mut Client, _sender_id: ObjectId) -> Result<()> {
|
||||
{
|
||||
let mut lock = self.state.lock();
|
||||
@@ -309,6 +324,7 @@ impl WlSurface for Surface {
|
||||
}
|
||||
|
||||
/// https://wayland.app/protocols/wayland#wl_surface:request:set_buffer_transform
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
async fn set_buffer_transform(
|
||||
&self,
|
||||
_client: &mut Client,
|
||||
@@ -320,6 +336,7 @@ impl WlSurface for Surface {
|
||||
}
|
||||
|
||||
/// https://wayland.app/protocols/wayland#wl_surface:request:set_buffer_scale
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
async fn set_buffer_scale(
|
||||
&self,
|
||||
_client: &mut Client,
|
||||
@@ -331,6 +348,7 @@ impl WlSurface for Surface {
|
||||
}
|
||||
|
||||
/// https://wayland.app/protocols/wayland#wl_surface:request:damage_buffer
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
async fn damage_buffer(
|
||||
&self,
|
||||
_client: &mut Client,
|
||||
@@ -346,6 +364,7 @@ impl WlSurface for Surface {
|
||||
}
|
||||
|
||||
/// https://wayland.app/protocols/wayland#wl_surface:request:offset
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
async fn offset(
|
||||
&self,
|
||||
_client: &mut Client,
|
||||
@@ -357,6 +376,7 @@ impl WlSurface for Surface {
|
||||
}
|
||||
|
||||
/// https://wayland.app/protocols/wayland#wl_surface:request:destroy
|
||||
#[tracing::instrument("debug", skip_all)]
|
||||
async fn destroy(&self, _client: &mut Client, _sender_id: ObjectId) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user