Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
37c82f6b
Commit
37c82f6b
authored
19 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Relieve pressure on vstat mutex by doing full screen updates from a copy
of vstat rather than the vstat struct itself.
parent
61f79d8c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/conio/sdl_con.c
+33
-37
33 additions, 37 deletions
src/conio/sdl_con.c
with
33 additions
and
37 deletions
src/conio/sdl_con.c
+
33
−
37
View file @
37c82f6b
...
@@ -769,7 +769,7 @@ int sdl_getche(void)
...
@@ -769,7 +769,7 @@ int sdl_getche(void)
putch
(
ch
);
putch
(
ch
);
return
(
ch
);
return
(
ch
);
}
}
ch
=
sdl_getch
();
sdl_getch
();
}
}
}
}
...
@@ -949,7 +949,7 @@ void sdl_draw_cursor(void)
...
@@ -949,7 +949,7 @@ void sdl_draw_cursor(void)
/* Called from event thread */
/* Called from event thread */
/* ONLY Called from sdl_full_screen_redraw() which holds the mutex... */
/* ONLY Called from sdl_full_screen_redraw() which holds the mutex... */
int
sdl_draw_one_char
(
unsigned
short
sch
,
unsigned
int
x
,
unsigned
int
y
)
int
sdl_draw_one_char
(
unsigned
short
sch
,
unsigned
int
x
,
unsigned
int
y
,
struct
video_stats
*
vs
)
{
{
SDL_Color
co
;
SDL_Color
co
;
SDL_Rect
src
;
SDL_Rect
src
;
...
@@ -960,30 +960,30 @@ int sdl_draw_one_char(unsigned short sch, unsigned int x, unsigned int y)
...
@@ -960,30 +960,30 @@ int sdl_draw_one_char(unsigned short sch, unsigned int x, unsigned int y)
ch
=
(
sch
>>
8
)
&
0x0f
;
ch
=
(
sch
>>
8
)
&
0x0f
;
if
(
lastfg
!=
ch
)
{
if
(
lastfg
!=
ch
)
{
co
.
r
=
dac_default256
[
vs
tat
.
palette
[
ch
]].
red
;
co
.
r
=
dac_default256
[
vs
->
palette
[
ch
]].
red
;
co
.
g
=
dac_default256
[
vs
tat
.
palette
[
ch
]].
green
;
co
.
g
=
dac_default256
[
vs
->
palette
[
ch
]].
green
;
co
.
b
=
dac_default256
[
vs
tat
.
palette
[
ch
]].
blue
;
co
.
b
=
dac_default256
[
vs
->
palette
[
ch
]].
blue
;
SDL_SetColors
(
sdl_font
,
&
co
,
1
,
1
);
SDL_SetColors
(
sdl_font
,
&
co
,
1
,
1
);
lastfg
=
ch
;
lastfg
=
ch
;
}
}
ch
=
(
sch
>>
12
)
&
0x07
;
ch
=
(
sch
>>
12
)
&
0x07
;
if
(
lastbg
!=
ch
)
{
if
(
lastbg
!=
ch
)
{
co
.
r
=
dac_default256
[
vs
tat
.
palette
[
ch
]].
red
;
co
.
r
=
dac_default256
[
vs
->
palette
[
ch
]].
red
;
co
.
g
=
dac_default256
[
vs
tat
.
palette
[
ch
]].
green
;
co
.
g
=
dac_default256
[
vs
->
palette
[
ch
]].
green
;
co
.
b
=
dac_default256
[
vs
tat
.
palette
[
ch
]].
blue
;
co
.
b
=
dac_default256
[
vs
->
palette
[
ch
]].
blue
;
SDL_SetColors
(
sdl_font
,
&
co
,
0
,
1
);
SDL_SetColors
(
sdl_font
,
&
co
,
0
,
1
);
lastbg
=
ch
;
lastbg
=
ch
;
}
}
dst
.
x
=
x
*
vs
tat
.
charwidth
*
vs
tat
.
scaling
;
dst
.
x
=
x
*
vs
->
charwidth
*
vs
->
scaling
;
dst
.
y
=
y
*
vs
tat
.
charheight
*
vs
tat
.
scaling
;
dst
.
y
=
y
*
vs
->
charheight
*
vs
->
scaling
;
dst
.
w
=
vs
tat
.
charwidth
*
vs
tat
.
scaling
;
dst
.
w
=
vs
->
charwidth
*
vs
->
scaling
;
dst
.
h
=
vs
tat
.
charheight
*
vs
tat
.
scaling
;
dst
.
h
=
vs
->
charheight
*
vs
->
scaling
;
src
.
x
=
0
;
src
.
x
=
0
;
src
.
w
=
vs
tat
.
charwidth
;
src
.
w
=
vs
->
charwidth
;
src
.
h
=
vs
tat
.
charheight
;
src
.
h
=
vs
->
charheight
;
src
.
y
=
vs
tat
.
charheight
*
vs
tat
.
scaling
;
src
.
y
=
vs
->
charheight
*
vs
->
scaling
;
ch
=
sch
&
0xff
;
ch
=
sch
&
0xff
;
if
((
sch
>>
15
)
&&
!
(
vs
tat
.
blink
))
if
((
sch
>>
15
)
&&
!
(
vs
->
blink
))
src
.
y
*=
' '
;
src
.
y
*=
' '
;
else
else
src
.
y
*=
ch
;
src
.
y
*=
ch
;
...
@@ -995,7 +995,6 @@ int sdl_draw_one_char(unsigned short sch, unsigned int x, unsigned int y)
...
@@ -995,7 +995,6 @@ int sdl_draw_one_char(unsigned short sch, unsigned int x, unsigned int y)
int
sdl_full_screen_redraw
(
void
)
int
sdl_full_screen_redraw
(
void
)
{
{
static
int
last_blink
;
static
int
last_blink
;
int
this_blink
;
int
x
;
int
x
;
int
y
;
int
y
;
unsigned
int
pos
;
unsigned
int
pos
;
...
@@ -1003,44 +1002,41 @@ int sdl_full_screen_redraw(void)
...
@@ -1003,44 +1002,41 @@ int sdl_full_screen_redraw(void)
unsigned
short
*
p
;
unsigned
short
*
p
;
SDL_Rect
*
rects
;
SDL_Rect
*
rects
;
int
rcount
=
0
;
int
rcount
=
0
;
struct
video_stats
vs
;
SDL_mutexP
(
sdl_vstatlock
);
SDL_mutexP
(
sdl_vstatlock
);
this_blink
=
vstat
.
blink
;
memcpy
(
&
vs
,
&
vstat
,
sizeof
(
vs
));
if
((
newvmem
=
(
unsigned
short
*
)
malloc
(
vstat
.
cols
*
vstat
.
rows
*
sizeof
(
unsigned
short
)))
==
NULL
)
{
if
((
newvmem
=
(
unsigned
short
*
)
malloc
(
vs
.
cols
*
vs
.
rows
*
sizeof
(
unsigned
short
)))
==
NULL
)
SDL_mutexV
(
sdl_vstatlock
);
return
(
-
1
);
return
(
-
1
);
}
memcpy
(
newvmem
,
vs
.
vmem
,
vs
.
cols
*
vs
.
rows
*
sizeof
(
unsigned
short
));
memcpy
(
newvmem
,
vstat
.
vmem
,
vstat
.
cols
*
vstat
.
rows
*
sizeof
(
unsigned
short
));
rects
=
(
SDL_Rect
*
)
malloc
(
sizeof
(
SDL_Rect
)
*
vstat
.
cols
*
vstat
.
rows
);
if
(
rects
==
NULL
)
{
SDL_mutexV
(
sdl_vstatlock
);
SDL_mutexV
(
sdl_vstatlock
);
rects
=
(
SDL_Rect
*
)
malloc
(
sizeof
(
SDL_Rect
)
*
vs
.
cols
*
vs
.
rows
);
if
(
rects
==
NULL
)
return
(
-
1
);
return
(
-
1
);
}
SDL_mutexP
(
sdl_updlock
);
SDL_mutexP
(
sdl_updlock
);
sdl_updated
=
1
;
sdl_updated
=
1
;
SDL_mutexV
(
sdl_updlock
);
SDL_mutexV
(
sdl_updlock
);
/* Redraw all chars */
/* Redraw all chars */
pos
=
0
;
pos
=
0
;
for
(
y
=
0
;
y
<
vs
tat
.
rows
;
y
++
)
{
for
(
y
=
0
;
y
<
vs
.
rows
;
y
++
)
{
for
(
x
=
0
;
x
<
vs
tat
.
cols
;
x
++
)
{
for
(
x
=
0
;
x
<
vs
.
cols
;
x
++
)
{
if
((
last_vmem
==
NULL
)
if
((
last_vmem
==
NULL
)
||
(
last_vmem
[
pos
]
!=
newvmem
[
pos
])
||
(
last_vmem
[
pos
]
!=
newvmem
[
pos
])
||
(
last_blink
!=
this_
blink
&&
newvmem
[
pos
]
>>
15
)
||
(
last_blink
!=
vs
.
blink
&&
newvmem
[
pos
]
>>
15
)
||
(
lastcursor_x
==
x
&&
lastcursor_y
==
y
)
||
(
lastcursor_x
==
x
&&
lastcursor_y
==
y
)
||
(
vs
tat
.
curs_col
==
x
&&
vs
tat
.
curs_row
==
y
)
||
(
vs
.
curs_col
==
x
&&
vs
.
curs_row
==
y
)
)
{
)
{
sdl_draw_one_char
(
newvmem
[
pos
],
x
,
y
);
sdl_draw_one_char
(
newvmem
[
pos
],
x
,
y
,
&
vs
);
rects
[
rcount
].
x
=
x
*
vs
tat
.
charwidth
*
vs
tat
.
scaling
;
rects
[
rcount
].
x
=
x
*
vs
.
charwidth
*
vs
.
scaling
;
rects
[
rcount
].
y
=
y
*
vs
tat
.
charheight
*
vs
tat
.
scaling
;
rects
[
rcount
].
y
=
y
*
vs
.
charheight
*
vs
.
scaling
;
rects
[
rcount
].
w
=
vs
tat
.
charwidth
*
vs
tat
.
scaling
;
rects
[
rcount
].
w
=
vs
.
charwidth
*
vs
.
scaling
;
rects
[
rcount
++
].
h
=
vs
tat
.
charheight
*
vs
tat
.
scaling
;
rects
[
rcount
++
].
h
=
vs
.
charheight
*
vs
.
scaling
;
}
}
pos
++
;
pos
++
;
}
}
}
}
SDL_mutexV
(
sdl_vstatlock
);
last_blink
=
this_
blink
;
last_blink
=
vs
.
blink
;
p
=
last_vmem
;
p
=
last_vmem
;
last_vmem
=
newvmem
;
last_vmem
=
newvmem
;
free
(
p
);
free
(
p
);
...
...
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