gfx: identify wl_buffer by address during ctx change
This commit is contained in:
parent
882aa7bd24
commit
86a765718d
4 changed files with 10 additions and 11 deletions
|
|
@ -7,7 +7,6 @@ use {
|
|||
clm::{CL_CHANGED_DESTROYED, CL_CHANGED_NEW, ClMatcherChange},
|
||||
},
|
||||
ifs::{
|
||||
wl_buffer::WlBuffer,
|
||||
wl_display::WlDisplay,
|
||||
wl_registry::WlRegistry,
|
||||
wl_surface::{WlSurface, commit_timeline::CommitTimelines},
|
||||
|
|
@ -22,7 +21,6 @@ use {
|
|||
buffd::{MsgFormatter, MsgParser, MsgParserError, OutBufferSwapchain},
|
||||
copyhashmap::{CopyHashMap, Locked},
|
||||
errorfmt::ErrorFmt,
|
||||
event_listener::EventSource,
|
||||
numcell::NumCell,
|
||||
pending_serial::PendingSerial,
|
||||
pid_info::{PidInfo, get_pid_info, get_socket_creds},
|
||||
|
|
@ -196,7 +194,6 @@ impl Clients {
|
|||
changed_properties: Default::default(),
|
||||
destroyed: Default::default(),
|
||||
acceptor: acceptor.clone(),
|
||||
gfx_ctx_changed: Default::default(),
|
||||
});
|
||||
track!(data, data);
|
||||
global.update_capabilities(&data, bounding_caps, set_bounding_caps_for_children);
|
||||
|
|
@ -324,7 +321,6 @@ pub struct Client {
|
|||
pub changed_properties: Cell<ClMatcherChange>,
|
||||
pub destroyed: CopyHashMap<CritMatcherId, Weak<dyn CritDestroyListener<Rc<Self>>>>,
|
||||
pub acceptor: Rc<AcceptorMetadata>,
|
||||
pub gfx_ctx_changed: EventSource<WlBuffer>,
|
||||
}
|
||||
|
||||
pub const NUM_CACHED_SERIAL_RANGES: usize = 64;
|
||||
|
|
|
|||
|
|
@ -361,6 +361,7 @@ fn start_compositor2(
|
|||
workspace_display_order: Cell::new(WorkspaceDisplayOrder::Manual),
|
||||
outputs_without_hc: Default::default(),
|
||||
udmabuf: Default::default(),
|
||||
gfx_ctx_changed: Default::default(),
|
||||
});
|
||||
state.tracker.register(ClientId::from_raw(0));
|
||||
create_dummy_output(&state);
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ impl WlBuffer {
|
|||
color,
|
||||
gfx_ctx_changed: EventListener::new(slf.clone()),
|
||||
});
|
||||
slf.gfx_ctx_changed.attach(&client.gfx_ctx_changed);
|
||||
slf.gfx_ctx_changed.attach(&client.state.gfx_ctx_changed);
|
||||
slf
|
||||
}
|
||||
|
||||
|
|
|
|||
14
src/state.rs
14
src/state.rs
|
|
@ -52,6 +52,7 @@ use {
|
|||
jay_screencast::JayScreencast,
|
||||
jay_seat_events::JaySeatEvents,
|
||||
jay_workspace_watcher::JayWorkspaceWatcher,
|
||||
wl_buffer::WlBuffer,
|
||||
wl_drm::WlDrmGlobal,
|
||||
wl_output::{OutputGlobalOpt, OutputId, PersistentOutputState},
|
||||
wl_seat::{
|
||||
|
|
@ -290,6 +291,7 @@ pub struct State {
|
|||
pub workspace_display_order: Cell<WorkspaceDisplayOrder>,
|
||||
pub outputs_without_hc: NumCell<usize>,
|
||||
pub udmabuf: Rc<UdmabufHolder>,
|
||||
pub gfx_ctx_changed: EventSource<WlBuffer>,
|
||||
}
|
||||
|
||||
// impl Drop for State {
|
||||
|
|
@ -677,16 +679,16 @@ impl State {
|
|||
}
|
||||
Walker.visit_display(&self.root);
|
||||
let mut updated_buffers = AHashMap::new();
|
||||
for buffer in self.gfx_ctx_changed.iter() {
|
||||
let had_buffer_texture = buffer.handle_gfx_context_change();
|
||||
updated_buffers.insert(Rc::as_ptr(&buffer), had_buffer_texture);
|
||||
}
|
||||
for client in self.clients.clients.borrow_mut().values() {
|
||||
updated_buffers.clear();
|
||||
for buffer in client.data.gfx_ctx_changed.iter() {
|
||||
let had_buffer_texture = buffer.handle_gfx_context_change();
|
||||
updated_buffers.insert(buffer.id, had_buffer_texture);
|
||||
}
|
||||
for surface in client.data.objects.surfaces.lock().values() {
|
||||
let had_shm_texture = surface.reset_shm_textures();
|
||||
if let Some(buffer) = surface.buffer.get() {
|
||||
let had_buffer_texture = *updated_buffers.get(&buffer.buffer.id).unwrap();
|
||||
let had_buffer_texture =
|
||||
*updated_buffers.get(&Rc::as_ptr(&buffer.buffer)).unwrap();
|
||||
if had_shm_texture || had_buffer_texture {
|
||||
buffer.buffer.update_texture_or_log(surface, true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue