mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-25 22:00:32 +00:00
parent
4112037c0c
commit
12461291b8
@ -21,6 +21,8 @@
|
|||||||
#include <util/reconstructible.h>
|
#include <util/reconstructible.h>
|
||||||
|
|
||||||
|
|
||||||
|
using Genode::uint16_t;
|
||||||
|
|
||||||
class Test_environment
|
class Test_environment
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@ -55,6 +57,8 @@ class Test_environment
|
|||||||
void _sync_handle() {
|
void _sync_handle() {
|
||||||
if (_sync_cnt++ % FRAME_CNT == 0) _draw(); }
|
if (_sync_cnt++ % FRAME_CNT == 0) _draw(); }
|
||||||
|
|
||||||
|
void _draw_frame(uint16_t volatile *, uint16_t, unsigned, unsigned);
|
||||||
|
|
||||||
Genode::size_t _fb_bpp() { return _mode.bytes_per_pixel(); }
|
Genode::size_t _fb_bpp() { return _mode.bytes_per_pixel(); }
|
||||||
Genode::size_t _fb_size() { return _fb_ds->size(); }
|
Genode::size_t _fb_size() { return _fb_ds->size(); }
|
||||||
Genode::addr_t _fb_base() {
|
Genode::addr_t _fb_base() {
|
||||||
@ -75,6 +79,19 @@ class Test_environment
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void Test_environment::_draw_frame(uint16_t volatile *p, uint16_t c,
|
||||||
|
unsigned const w, unsigned const h)
|
||||||
|
{
|
||||||
|
/* top and bottom */
|
||||||
|
for (unsigned i = 0; i < w; ++i)
|
||||||
|
p[i] = p[(h - 1)*w + i] = c;
|
||||||
|
|
||||||
|
/* left and right */
|
||||||
|
for (unsigned i = 0; i < h; ++i)
|
||||||
|
p[i*w] = p[i*w + w - 1] = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Test_environment::_draw()
|
void Test_environment::_draw()
|
||||||
{
|
{
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
@ -94,6 +111,9 @@ void Test_environment::_draw()
|
|||||||
}
|
}
|
||||||
*(uint16_t volatile *)(_fb_base() + o) = stripe ? BLACK : WHITE;
|
*(uint16_t volatile *)(_fb_base() + o) = stripe ? BLACK : WHITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_draw_frame((uint16_t volatile *)_fb_base(), RED,
|
||||||
|
_mode.width(), _mode.height());
|
||||||
_state = ALL_BLUE;
|
_state = ALL_BLUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -102,6 +122,9 @@ void Test_environment::_draw()
|
|||||||
Genode::log("blue");
|
Genode::log("blue");
|
||||||
for (addr_t o = 0; o < _fb_size(); o += _fb_bpp())
|
for (addr_t o = 0; o < _fb_size(); o += _fb_bpp())
|
||||||
*(uint16_t volatile *)(_fb_base() + o) = BLUE;
|
*(uint16_t volatile *)(_fb_base() + o) = BLUE;
|
||||||
|
|
||||||
|
_draw_frame((uint16_t volatile *)_fb_base(), RED,
|
||||||
|
_mode.width(), _mode.height());
|
||||||
_state = ALL_GREEN;
|
_state = ALL_GREEN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -110,6 +133,9 @@ void Test_environment::_draw()
|
|||||||
Genode::log("green");
|
Genode::log("green");
|
||||||
for (addr_t o = 0; o < _fb_size(); o += _fb_bpp())
|
for (addr_t o = 0; o < _fb_size(); o += _fb_bpp())
|
||||||
*(uint16_t volatile *)(_fb_base() + o) = GREEN;
|
*(uint16_t volatile *)(_fb_base() + o) = GREEN;
|
||||||
|
|
||||||
|
_draw_frame((uint16_t volatile *)_fb_base(), RED,
|
||||||
|
_mode.width(), _mode.height());
|
||||||
_state = ALL_RED;
|
_state = ALL_RED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -118,6 +144,9 @@ void Test_environment::_draw()
|
|||||||
Genode::log("red");
|
Genode::log("red");
|
||||||
for (addr_t o = 0; o < _fb_size(); o += _fb_bpp())
|
for (addr_t o = 0; o < _fb_size(); o += _fb_bpp())
|
||||||
*(uint16_t volatile *)(_fb_base() + o) = RED;
|
*(uint16_t volatile *)(_fb_base() + o) = RED;
|
||||||
|
|
||||||
|
_draw_frame((uint16_t volatile *)_fb_base(), WHITE,
|
||||||
|
_mode.width(), _mode.height());
|
||||||
_state = COLORED;
|
_state = COLORED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -127,6 +156,9 @@ void Test_environment::_draw()
|
|||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
for (addr_t o = 0; o < _fb_size(); o += _fb_bpp(), i++)
|
for (addr_t o = 0; o < _fb_size(); o += _fb_bpp(), i++)
|
||||||
*(uint16_t volatile *)(_fb_base() + o) = i;
|
*(uint16_t volatile *)(_fb_base() + o) = i;
|
||||||
|
|
||||||
|
_draw_frame((uint16_t volatile *)_fb_base(), WHITE,
|
||||||
|
_mode.width(), _mode.height());
|
||||||
_state = STRIPES;
|
_state = STRIPES;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user