Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
John Hodge
rust_os
Commits
d26a2903
Commit
d26a2903
authored
Nov 24, 2018
by
John Hodge
Browse files
Kernel Video - Fix double-lock of device list
parent
2d203721
Changes
1
Hide whitespace changes
Inline
Side-by-side
Kernel/Core/metadevs/video/mod.rs
View file @
d26a2903
...
...
@@ -67,7 +67,7 @@ static S_DISPLAY_SURFACES: LazyMutex<SparseVec<DisplaySurface>> = lazymutex_init
/// Boot video mode
static
S_BOOT_MODE
:
Mutex
<
Option
<
bootvideo
::
VideoMode
>>
=
Mutex
::
new
(
None
);
/// Function called when display geometry changes
static
S_GEOM_UPDATE_SIGNAL
:
Mutex
<
Option
<
fn
(
new_total
:
Rect
)
>>
=
m
utex
_init!
(
None
);
static
S_GEOM_UPDATE_SIGNAL
:
Mutex
<
Option
<
fn
(
new_total
:
Rect
)
>>
=
M
utex
::
new
(
None
);
fn
init
()
{
...
...
@@ -201,7 +201,7 @@ pub fn register_geom_update(fcn: fn(new_total: Rect))
*
lh
=
Some
(
fcn
);
}
fn
signal_geom_update
(
surfs
:
&
SparseVec
<
DisplaySurface
>
)
fn
signal_geom_update
(
surfs
:
::
sync
::
mutex
::
HeldLazyMutex
<
SparseVec
<
DisplaySurface
>
>
)
{
// API Requirements
// - New surface added (with location)
...
...
@@ -211,6 +211,8 @@ fn signal_geom_update(surfs: &SparseVec<DisplaySurface>)
if
let
Some
(
fcn
)
=
*
S_GEOM_UPDATE_SIGNAL
.lock
()
{
let
total_area
=
surfs
.iter
()
.map
(|
x
|
x
.region
)
.fold
(
Rect
::
new
(
0
,
0
,
0
,
0
),
|
a
,
b
|
a
.union
(
&
b
));
log_trace!
(
"signal_geom_update: total_area={:?}"
,
total_area
);
drop
(
surfs
);
fcn
(
total_area
);
}
}
...
...
@@ -223,8 +225,8 @@ pub fn add_output(output: Box<Framebuffer>) -> FramebufferRegistration
if
S_BOOT_MODE
.lock
()
.take
()
.is_some
()
{
// - Remove boot video framebuffer
S_DISPLAY_SURFACES
.lock
()
.remove
(
0
);
log_notice!
(
"Alternative display driver loaded, dropping boot video"
);
S_DISPLAY_SURFACES
.lock
()
.remove
(
0
);
}
// Add new output to the global list
...
...
@@ -239,7 +241,7 @@ pub fn add_output(output: Box<Framebuffer>) -> FramebufferRegistration
fb
:
output
}
);
signal_geom_update
(
&
lh
);
signal_geom_update
(
lh
);
log_debug!
(
"Registering framebuffer #{}"
,
idx
);
FramebufferRegistration
{
...
...
@@ -314,7 +316,7 @@ impl ::core::ops::Drop for FramebufferRegistration
{
let
mut
lh
=
S_DISPLAY_SURFACES
.lock
();
lh
.remove
(
self
.reg_id
);
signal_geom_update
(
&
lh
);
signal_geom_update
(
lh
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment