shell: Using parking_lot's RwLock for fairness guarantees
This commit is contained in:
parent
8194be30c6
commit
465813c1c5
42 changed files with 247 additions and 396 deletions
|
|
@ -307,7 +307,7 @@ impl State {
|
|||
|
||||
let connectors = device.enumerate_surfaces()?.added; // There are no removed outputs on newly added devices
|
||||
let mut wl_outputs = Vec::new();
|
||||
let mut w = self.common.shell.read().unwrap().global_space().size.w as u32;
|
||||
let mut w = self.common.shell.read().global_space().size.w as u32;
|
||||
|
||||
{
|
||||
for (conn, maybe_crtc) in connectors {
|
||||
|
|
@ -380,7 +380,7 @@ impl State {
|
|||
if let Some(device) = backend.drm_devices.get_mut(&drm_node) {
|
||||
let changes = device.enumerate_surfaces()?;
|
||||
|
||||
let mut w = self.common.shell.read().unwrap().global_space().size.w as u32;
|
||||
let mut w = self.common.shell.read().global_space().size.w as u32;
|
||||
for conn in changes.removed {
|
||||
// contains conns with updated crtcs, just drop the surface and re-create
|
||||
if let Some(pos) = device
|
||||
|
|
@ -577,7 +577,7 @@ impl Device {
|
|||
position: (u32, u32),
|
||||
evlh: &LoopHandle<'static, State>,
|
||||
screen_filter: ScreenFilter,
|
||||
shell: Arc<RwLock<Shell>>,
|
||||
shell: Arc<parking_lot::RwLock<Shell>>,
|
||||
startup_done: Arc<AtomicBool>,
|
||||
) -> Result<(Output, bool)> {
|
||||
let output = self
|
||||
|
|
@ -676,7 +676,7 @@ impl Device {
|
|||
flags: FrameFlags,
|
||||
renderer: &mut GlMultiRenderer,
|
||||
clock: &Clock<Monotonic>,
|
||||
shell: &Arc<RwLock<Shell>>,
|
||||
shell: &Arc<parking_lot::RwLock<Shell>>,
|
||||
) -> Result<()> {
|
||||
for surface in self.surfaces.values_mut() {
|
||||
surface.allow_frame_flags(flag, flags);
|
||||
|
|
@ -733,7 +733,7 @@ impl Device {
|
|||
flag: bool,
|
||||
renderer: &mut GlMultiRenderer,
|
||||
clock: &Clock<Monotonic>,
|
||||
shell: &Arc<RwLock<Shell>>,
|
||||
shell: &Arc<parking_lot::RwLock<Shell>>,
|
||||
) -> Result<()> {
|
||||
self.allow_frame_flags(
|
||||
flag,
|
||||
|
|
@ -749,7 +749,7 @@ impl Device {
|
|||
flag: bool,
|
||||
renderer: &mut GlMultiRenderer,
|
||||
clock: &Clock<Monotonic>,
|
||||
shell: &Arc<RwLock<Shell>>,
|
||||
shell: &Arc<parking_lot::RwLock<Shell>>,
|
||||
) -> Result<()> {
|
||||
self.allow_frame_flags(
|
||||
flag,
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ fn init_libinput(
|
|||
|
||||
state.process_input_event(event);
|
||||
|
||||
for output in state.common.shell.read().unwrap().outputs() {
|
||||
for output in state.common.shell.read().outputs() {
|
||||
state.backend.kms().schedule_render(output);
|
||||
}
|
||||
})
|
||||
|
|
@ -592,7 +592,7 @@ impl KmsState {
|
|||
test_only: bool,
|
||||
loop_handle: &LoopHandle<'static, State>,
|
||||
screen_filter: &ScreenFilter,
|
||||
shell: Arc<RwLock<Shell>>,
|
||||
shell: Arc<parking_lot::RwLock<Shell>>,
|
||||
startup_done: Arc<AtomicBool>,
|
||||
clock: &Clock<Monotonic>,
|
||||
) -> Result<Vec<Output>, anyhow::Error> {
|
||||
|
|
@ -683,7 +683,7 @@ impl KmsState {
|
|||
}
|
||||
|
||||
// add new ones
|
||||
let mut w = shell.read().unwrap().global_space().size.w as u32;
|
||||
let mut w = shell.read().global_space().size.w as u32;
|
||||
if !test_only {
|
||||
for (conn, crtc) in new_pairings {
|
||||
let (output, _) = device.connector_added(
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ pub struct SurfaceThreadState {
|
|||
screen_filter: ScreenFilter,
|
||||
postprocess_textures: HashMap<DrmNode, PostprocessState>,
|
||||
|
||||
shell: Arc<RwLock<Shell>>,
|
||||
shell: Arc<parking_lot::RwLock<Shell>>,
|
||||
|
||||
loop_handle: LoopHandle<'static, Self>,
|
||||
clock: Clock<Monotonic>,
|
||||
|
|
@ -233,7 +233,7 @@ impl Surface {
|
|||
target_node: DrmNode,
|
||||
evlh: &LoopHandle<'static, State>,
|
||||
screen_filter: ScreenFilter,
|
||||
shell: Arc<RwLock<Shell>>,
|
||||
shell: Arc<parking_lot::RwLock<Shell>>,
|
||||
startup_done: Arc<AtomicBool>,
|
||||
) -> Result<Self> {
|
||||
let (tx, rx) = channel::<ThreadCommand>();
|
||||
|
|
@ -471,7 +471,7 @@ fn surface_thread(
|
|||
output: Output,
|
||||
primary_node: Arc<RwLock<Option<DrmNode>>>,
|
||||
target_node: DrmNode,
|
||||
shell: Arc<RwLock<Shell>>,
|
||||
shell: Arc<parking_lot::RwLock<Shell>>,
|
||||
active: Arc<AtomicBool>,
|
||||
screen_filter: ScreenFilter,
|
||||
thread_sender: Sender<SurfaceCommand>,
|
||||
|
|
@ -839,7 +839,7 @@ impl SurfaceThreadState {
|
|||
QueueState::WaitingForEstimatedVBlankAndQueued { .. } => unreachable!(),
|
||||
};
|
||||
|
||||
if redraw_needed || self.shell.read().unwrap().animations_going() {
|
||||
if redraw_needed || self.shell.read().animations_going() {
|
||||
let vblank_frame = tracy_client::Client::running()
|
||||
.unwrap()
|
||||
.non_continuous_frame(self.vblank_frame_name);
|
||||
|
|
@ -866,7 +866,7 @@ impl SurfaceThreadState {
|
|||
|
||||
self.frame_callback_seq = self.frame_callback_seq.wrapping_add(1);
|
||||
|
||||
if force || self.shell.read().unwrap().animations_going() {
|
||||
if force || self.shell.read().animations_going() {
|
||||
self.queue_redraw(false);
|
||||
} else {
|
||||
self.send_frame_callbacks();
|
||||
|
|
@ -962,7 +962,7 @@ impl SurfaceThreadState {
|
|||
.as_ref()
|
||||
.unwrap_or(&self.target_node),
|
||||
&self.target_node,
|
||||
&*self.shell.read().unwrap(),
|
||||
&*self.shell.read(),
|
||||
);
|
||||
|
||||
let mut renderer = if render_node != self.target_node {
|
||||
|
|
@ -979,7 +979,7 @@ impl SurfaceThreadState {
|
|||
let mut remove_frame_flags = FrameFlags::empty();
|
||||
|
||||
let has_active_fullscreen = {
|
||||
let shell = self.shell.read().unwrap();
|
||||
let shell = self.shell.read();
|
||||
let output = self.mirroring.as_ref().unwrap_or(&self.output);
|
||||
if let Some((_, workspace)) = shell.workspaces.active(output) {
|
||||
workspace.get_fullscreen().is_some()
|
||||
|
|
@ -1416,7 +1416,6 @@ impl SurfaceThreadState {
|
|||
Some((
|
||||
self.shell
|
||||
.read()
|
||||
.unwrap()
|
||||
.take_presentation_feedback(&self.output, &frame_result.states),
|
||||
rx,
|
||||
estimated_presentation,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue