refactor(wayland): continue implementing better buffer release

Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
Schmarni
2025-07-18 02:37:30 +02:00
parent eca5bb4bf2
commit 9466e97dd1
4 changed files with 46 additions and 24 deletions

View File

@@ -1,8 +1,5 @@
use super::buffer_params::BufferParams;
use crate::{
core::registry::Registry,
wayland::{MessageSink, RENDER_DEVICE, core::buffer::BufferUsage},
};
use crate::wayland::{MessageSink, RENDER_DEVICE};
use bevy::{
asset::{Assets, Handle},
image::Image,
@@ -18,9 +15,6 @@ use std::sync::{Arc, OnceLock};
use tracing::info;
use waynest::server::protocol::stable::linux_dmabuf_v1::zwp_linux_buffer_params_v1::Flags;
// clear this out on end frame, add to it whenever a commit with the surface with the buffer is present
const IN_USE_DMABUFS: Registry<BufferUsage> = Registry::new();
/// Parameters for a shared memory buffer
pub struct DmabufBacking {
message_sink: Option<MessageSink>,
@@ -88,9 +82,7 @@ impl DmabufBacking {
&self,
dmatexes: &ImportedDmatexs,
images: &mut Assets<Image>,
usage: Arc<BufferUsage>,
) -> Option<Handle<Image>> {
IN_USE_DMABUFS.add_raw(usage);
info!("updating dmabuf tex");
self.pending_imported_dmatex
.lock()