Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hust-x86-simulator
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
yizhiran
hust-x86-simulator
Commits
e48eb1ea
There was an error fetching the commit references. Please try again later.
Verified
Commit
e48eb1ea
authored
5 years ago
by
Recolic Keghart
Browse files
Options
Downloads
Patches
Plain Diff
add option to disable async render
parent
cbd90a84
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
nemu/src/device/device.cc
+12
-8
12 additions, 8 deletions
nemu/src/device/device.cc
nemu/src/device/vga.cc
+6
-1
6 additions, 1 deletion
nemu/src/device/vga.cc
with
18 additions
and
9 deletions
nemu/src/device/device.cc
+
12
−
8
View file @
e48eb1ea
...
...
@@ -41,11 +41,6 @@ static void timer_sig_handler(int signum) {
}
void
device_update_impl
()
{
// async
if
(
device_update_flag
)
device_update_flag
=
false
;
else
return
;
if
(
update_screen_flag
)
{
update_screen
();
update_screen_flag
=
false
;
...
...
@@ -75,9 +70,16 @@ void device_update_impl() {
}
}
void
device_update
()
{
device_update_impl
();}
void
device_update
()
{
#ifdef ENABLE_ASYNC_RENDER
#else
if
(
device_update_flag
.
exchange
(
false
))
{
device_update_impl
();
}
#endif
}
static
void
device_update_thread_daemon
()
{
[[
maybe_unused
]]
static
void
device_update_thread_daemon
()
{
while
(
true
)
{
if
(
device_update_flag
.
exchange
(
false
))
{
device_update_impl
();
...
...
@@ -109,7 +111,9 @@ void init_device() {
ret
=
setitimer
(
ITIMER_VIRTUAL
,
&
it
,
NULL
);
Assert
(
ret
==
0
,
"Can not set timer"
);
// std::thread(device_update_thread_daemon).detach();
#ifdef ENABLE_ASYNC_RENDER
std
::
thread
(
device_update_thread_daemon
).
detach
();
#endif
}
#else
...
...
This diff is collapsed.
Click to expand it.
nemu/src/device/vga.cc
+
6
−
1
View file @
e48eb1ea
...
...
@@ -40,7 +40,9 @@ static void init_vga_impl() {
void
update_screen
()
{
#ifndef DISABLE_MMIO
// if(window == nullptr) init_vga_impl();
#ifdef ENABLE_ASYNC_RENDER
if
(
window
==
nullptr
)
init_vga_impl
();
#endif
SDL_ErrorCheck
(
SDL_UpdateTexture
(
texture
,
NULL
,
vmem
,
SCREEN_W
*
sizeof
(
vmem
[
0
][
0
])));
SDL_ErrorCheck
(
SDL_RenderClear
(
renderer
));
SDL_ErrorCheck
(
SDL_RenderCopy
(
renderer
,
texture
,
NULL
,
NULL
));
...
...
@@ -49,9 +51,12 @@ void update_screen() {
}
void
init_vga
()
{
#ifdef ENABLE_ASYNC_RENDER
// Because of fucking SDL design, vga_init should be done in updating thread.
// Do nothing in main thread.
#else
init_vga_impl
();
#endif
}
#endif
/* HAS_IOE */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment