Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mensactrl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
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
stratum0
mensactrl
Commits
c54f05a6
Commit
c54f05a6
authored
10 years ago
by
Jan Luebbe
Browse files
Options
Downloads
Patches
Plain Diff
mensactrl: add simple benchmark mode
parent
551018a5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
configure.ac
+1
-1
1 addition, 1 deletion
configure.ac
src/mensactrl.c
+39
-11
39 additions, 11 deletions
src/mensactrl.c
with
40 additions
and
12 deletions
configure.ac
+
1
−
1
View file @
c54f05a6
...
...
@@ -9,7 +9,7 @@ AC_CANONICAL_HOST
AM_MAINTAINER_MODE
CFLAGS="${CFLAGS} -W -Wall"
CFLAGS="${CFLAGS}
-std=gnu11
-W -Wall"
#
# libtool library versioning stuff
...
...
This diff is collapsed.
Click to expand it.
src/mensactrl.c
+
39
−
11
View file @
c54f05a6
...
...
@@ -20,6 +20,7 @@
#include
<stdlib.h>
#include
<unistd.h>
#include
<stdio.h>
#include
<stdbool.h>
#include
<string.h>
#include
<stdint.h>
#include
<linux/fb.h>
...
...
@@ -29,6 +30,7 @@
#include
<fcntl.h>
#include
<sys/ioctl.h>
#include
<math.h>
#include
<time.h>
#include
<zmq.h>
...
...
@@ -43,6 +45,8 @@
#define POWER_TIMEOUT 180000
/* milliseconds */
#define POWER_GPIO_PATH "/sys/class/gpio/gpio91/value"
#define BENCH_LOOPS 100
struct
mensa_fb
{
int
x_res
,
y_res
;
int
hmodules
,
vmodules
;
...
...
@@ -141,9 +145,7 @@ static struct mensa_fb *setup_fb(const char *devname, int hmodules, int vmodules
}
if
(
ioctl
(
mensafb
->
fd
,
FBIOGET_VSCREENINFO
,
&
vsinfo
))
{
perror
(
"could not get var screen info"
);
free
(
mensafb
);
exit
(
1
);
perror
(
"could not get var screen info, ignoring"
);
}
vsinfo
.
xres
=
960
;
...
...
@@ -154,12 +156,9 @@ static struct mensa_fb *setup_fb(const char *devname, int hmodules, int vmodules
vsinfo
.
pixclock
=
125000
;
if
(
ioctl
(
mensafb
->
fd
,
FBIOPUT_VSCREENINFO
,
&
vsinfo
))
{
perror
(
"could not set var screen info"
);
free
(
mensafb
);
exit
(
1
);
perror
(
"could not set var screen info, ignoring"
);
}
mensafb
->
inputfb
=
malloc
(
mensafb
->
x_res
*
mensafb
->
y_res
);
if
(
!
mensafb
->
inputfb
)
{
free
(
mensafb
);
...
...
@@ -294,14 +293,45 @@ int setPower(int enabled) {
return
0
;
}
void
runBenchmark
(
struct
mensa_fb
*
mensafb
)
{
clock_t
t
=
clock
();
for
(
int
i
=
0
;
i
<
BENCH_LOOPS
;
i
++
)
{
blit_area
(
mensafb
,
0
,
0
,
mensafb
->
x_res
,
mensafb
->
y_res
);
}
t
=
clock
()
-
t
;
printf
(
"%fus / blit_area
\n
"
,
(
float
)
t
/
100
.
0
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
struct
mensa_fb
*
mensafb
;
void
*
context
=
zmq_ctx_new
();
void
*
responder
=
zmq_socket
(
context
,
ZMQ_REP
);
int
rc
,
timeout
=
POWER_TIMEOUT
;
int
opt
;
bool
benchmark
=
false
;
while
((
opt
=
getopt
(
argc
,
argv
,
"b"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'b'
:
benchmark
=
true
;
break
;
default:
fprintf
(
stderr
,
"Usage: %s [-b] framebuffer
\n
"
,
argv
[
0
]);
exit
(
EXIT_FAILURE
);
}
}
if
(
argc
!=
2
)
exit
(
1
);
if
(
optind
>=
argc
)
{
fprintf
(
stderr
,
"missing framebuffer argument
\n
"
);
exit
(
EXIT_FAILURE
);
}
mensafb
=
setup_fb
(
argv
[
optind
],
12
,
5
);
if
(
benchmark
)
{
runBenchmark
(
mensafb
);
exit
(
0
);
}
rc
=
zmq_setsockopt
(
responder
,
ZMQ_RCVTIMEO
,
&
timeout
,
sizeof
(
timeout
));
if
(
rc
<
0
)
...
...
@@ -311,8 +341,6 @@ int main(int argc, char *argv[]) {
if
(
rc
<
0
)
perror
(
"zmq_bind"
);
mensafb
=
setup_fb
(
argv
[
1
],
12
,
5
);
while
(
1
)
{
while
(
1
)
{
zmq_msg_t
message
;
...
...
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