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