Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Xf86 Video Fbturbo
Commits
5d9c791d
Commit
5d9c791d
authored
Mar 13, 2013
by
Siarhei Siamashka
Browse files
test: use G2D acceleration in sunxi_disp_vsync_demo
Signed-off-by:
Siarhei Siamashka
<
siarhei.siamashka@gmail.com
>
parent
df534b22
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/sunxi_disp_vsync_demo.c
View file @
5d9c791d
...
...
@@ -36,6 +36,8 @@
#include "../src/sunxi_disp.h"
static
sunxi_disp_t
*
disp
;
void
memset32
(
uint32_t
*
buf
,
uint32_t
color
,
int
n
)
{
while
(
n
--
)
{
...
...
@@ -43,19 +45,27 @@ void memset32(uint32_t *buf, uint32_t color, int n)
}
}
void
fill_framebuffer
(
void
*
buf_
,
int
pitc
h
,
int
height
,
void
fill_framebuffer
(
void
*
buf_
,
int
yoffs
,
int
widt
h
,
int
height
,
int
bw_split_pos
,
uint32_t
color
)
{
uint32_t
*
buf
=
(
uint32_t
*
)
buf_
;
int
i
;
while
(
height
--
)
{
memset32
(
buf
,
color
,
bw_split_pos
);
memset32
(
buf
+
bw_split_pos
,
0x00
,
pitch
-
bw_split_pos
);
buf
+=
pitch
;
if
(
disp
->
fd_g2d
>=
0
)
{
sunxi_g2d_fill_a8r8g8b8
(
disp
,
0
,
yoffs
,
bw_split_pos
,
height
,
color
);
sunxi_g2d_fill_a8r8g8b8
(
disp
,
bw_split_pos
,
yoffs
,
width
-
bw_split_pos
,
height
+
yoffs
,
0
);
}
else
{
buf
+=
yoffs
*
width
;
while
(
height
--
)
{
memset32
(
buf
,
color
,
bw_split_pos
);
memset32
(
buf
+
bw_split_pos
,
0x00
,
width
-
bw_split_pos
);
buf
+=
width
;
}
}
}
static
sunxi_disp_t
*
disp
;
void
disp_destructor
(
int
signum
)
{
...
...
@@ -83,8 +93,9 @@ int main(int argc, char *argv[])
exit
(
1
);
}
printf
(
"disp->xres=%d, disp->yres=%d, disp_bits_per_pixel=%d
\n
"
,
disp
->
xres
,
disp
->
yres
,
disp
->
bits_per_pixel
);
printf
(
"disp->xres=%d, disp->yres=%d, disp_bits_per_pixel=%d, g2d_accel=%s
\n
"
,
disp
->
xres
,
disp
->
yres
,
disp
->
bits_per_pixel
,
(
disp
->
fd_g2d
>=
0
)
?
"yes"
:
"no"
);
if
(
disp
->
bits_per_pixel
!=
32
)
{
printf
(
"Sorry, only 32 bits per pixel is supported for now
\n
"
);
...
...
@@ -125,13 +136,13 @@ int main(int argc, char *argv[])
pos
=
(
pos
+
16
)
%
(
disp
->
xres
*
2
);
/* paint part of the screen with blue in the offscreen buffer */
fill_framebuffer
(
disp
->
framebuffer_addr
+
yoffs
*
disp
->
xres
*
4
,
fill_framebuffer
(
disp
->
framebuffer_addr
,
yoffs
,
disp
->
xres
,
disp
->
yres
,
pos
<
disp
->
xres
?
pos
:
2
*
disp
->
xres
-
pos
,
0xFF0000FF
);
/* paint part of the screen with yellow in the offscreen buffer */
fill_framebuffer
(
disp
->
framebuffer_addr
+
yoffs
*
disp
->
xres
*
4
,
fill_framebuffer
(
disp
->
framebuffer_addr
,
yoffs
,
disp
->
xres
,
disp
->
yres
,
pos
<
disp
->
xres
?
pos
:
2
*
disp
->
xres
-
pos
,
color
);
...
...
@@ -140,7 +151,7 @@ int main(int argc, char *argv[])
sunxi_layer_set_x8r8g8b8_input_buffer
(
disp
,
yoffs
*
disp
->
xres
*
4
,
disp
->
xres
,
disp
->
yres
,
disp
->
xres
);
/* wait for the vsync itself */
ioctl
(
disp
->
fd_fb
,
FBIO_WAITFORVSYNC
,
0
);
sunxi_wait_for_vsync
(
disp
);
framenum
++
;
}
...
...
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