fb_drv: generate periodic sync events

Fixes #1762
This commit is contained in:
Norman Feske 2015-01-29 14:11:14 +01:00
parent 650267b425
commit 24b7accbf2
6 changed files with 33 additions and 38 deletions

View File

@ -25,6 +25,7 @@
#include <dataspace/client.h>
#include <blit/blit.h>
#include <os/config.h>
#include <timer_session/connection.h>
/* Local */
#include "framebuffer.h"
@ -94,7 +95,7 @@ namespace Framebuffer {
Genode::Dataspace_capability _fb_ds;
void *_fb_addr;
Genode::Signal_context_capability _sync_sigh;
Timer::Connection _timer;
void _refresh_buffered(int x, int y, int w, int h)
{
@ -184,16 +185,14 @@ namespace Framebuffer {
void sync_sigh(Genode::Signal_context_capability sigh) override
{
_sync_sigh = sigh;
_timer.sigh(sigh);
_timer.trigger_periodic(10*1000);
}
void refresh(int x, int y, int w, int h) override
{
if (_buffered)
_refresh_buffered(x, y, w, h);
if (_sync_sigh.valid())
Signal_transmitter(_sync_sigh).submit();
}
};

View File

@ -14,6 +14,7 @@
/* Genode includes */
#include <framebuffer_session/framebuffer_session.h>
#include <cap_session/connection.h>
#include <timer_session/connection.h>
#include <dataspace/client.h>
#include <base/printf.h>
#include <base/sleep.h>
@ -46,7 +47,7 @@ class Framebuffer::Session_component
size_t _size;
Dataspace_capability _ds;
addr_t _phys_base;
Signal_context_capability _sync_sigh;
Timer::Connection _timer;
/**
* Convert Driver::Format to Framebuffer::Mode::Format
@ -101,14 +102,11 @@ class Framebuffer::Session_component
void sync_sigh(Genode::Signal_context_capability sigh) override
{
_sync_sigh = sigh;
_timer.sigh(sigh);
_timer.trigger_periodic(10*1000);
}
void refresh(int, int, int, int) override
{
if (_sync_sigh.valid())
Signal_transmitter(_sync_sigh).submit();
}
void refresh(int, int, int, int) override { }
};

View File

@ -8,6 +8,7 @@
/* Genode includes */
#include <imx_framebuffer_session/imx_framebuffer_session.h>
#include <cap_session/connection.h>
#include <timer_session/connection.h>
#include <dataspace/client.h>
#include <base/printf.h>
#include <base/sleep.h>
@ -41,7 +42,8 @@ class Framebuffer::Session_component :
Genode::Dataspace_capability _fb_ds;
void *_fb_addr;
Signal_context_capability _sync_sigh;
Timer::Connection _timer;
Ipu &_ipu;
@ -95,16 +97,14 @@ class Framebuffer::Session_component :
void sync_sigh(Genode::Signal_context_capability sigh) override
{
_sync_sigh = sigh;
_timer.sigh(sigh);
_timer.trigger_periodic(10*1000);
}
void refresh(int x, int y, int w, int h) override
{
if (_buffered)
_refresh_buffered(x, y, w, h);
if (_sync_sigh.valid())
Signal_transmitter(_sync_sigh).submit();
}
void overlay(Genode::addr_t phys_base, int x, int y, int alpha) {

View File

@ -18,6 +18,7 @@
#include <base/rpc_server.h>
#include <io_mem_session/connection.h>
#include <cap_session/connection.h>
#include <timer_session/connection.h>
#include <dataspace/client.h>
#include <timer_session/connection.h>
#include <framebuffer_session/framebuffer_session.h>
@ -55,12 +56,11 @@ namespace Framebuffer
{
private:
Genode::Dataspace_capability _fb_ds_cap;
Genode::Dataspace_client _fb_ds;
Genode::addr_t _regs_base;
Genode::addr_t _sys_regs_base;
Timer::Connection _timer;
Genode::Signal_context_capability _sync_sigh;
Genode::Dataspace_capability _fb_ds_cap;
Genode::Dataspace_client _fb_ds;
Genode::addr_t _regs_base;
Genode::addr_t _sys_regs_base;
Timer::Connection _timer;
enum {
/**
@ -162,13 +162,13 @@ namespace Framebuffer
void mode_sigh(Genode::Signal_context_capability) override { }
void sync_sigh(Genode::Signal_context_capability sigh) override { _sync_sigh = sigh; }
void refresh(int x, int y, int w, int h) override
void sync_sigh(Genode::Signal_context_capability sigh) override
{
if (_sync_sigh.valid())
Genode::Signal_transmitter(_sync_sigh).submit();
_timer.sigh(sigh);
_timer.trigger_periodic(10*1000);
}
void refresh(int x, int y, int w, int h) override { }
};

View File

@ -23,6 +23,7 @@
#include <base/rpc_server.h>
#include <platform_session/connection.h>
#include <blit/blit.h>
#include <timer_session/connection.h>
namespace Framebuffer {
using namespace Genode;
@ -38,7 +39,7 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Framebuffer::Se
size_t const _height;
Lazy_volatile_object<Attached_ram_dataspace> _bb_mem;
Attached_io_mem_dataspace _fb_mem;
Signal_context_capability _sync_sigh;
Timer::Connection _timer;
void _refresh_buffered(int x, int y, int w, int h)
{
@ -95,16 +96,14 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Framebuffer::Se
void sync_sigh(Genode::Signal_context_capability sigh) override
{
_sync_sigh = sigh;
_timer.sigh(sigh);
_timer.trigger_periodic(10*1000);
}
void refresh(int x, int y, int w, int h) override
{
if (_bb_mem.is_constructed())
_refresh_buffered(x, y, w, h);
if (_sync_sigh.valid())
Signal_transmitter(_sync_sigh).submit();
}
};

View File

@ -24,6 +24,7 @@
#include <cap_session/connection.h>
#include <input/root.h>
#include <os/config.h>
#include <timer_session/connection.h>
/* local includes */
#include <input.h>
@ -66,7 +67,7 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Session>
Mode _mode;
Genode::Signal_context_capability _sync_sigh;
Timer::Connection _timer;
public:
@ -83,7 +84,8 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Session>
void sync_sigh(Genode::Signal_context_capability sigh) override
{
_sync_sigh = sigh;
_timer.sigh(sigh);
_timer.trigger_periodic(10*1000);
}
void refresh(int x, int y, int w, int h) override
@ -110,9 +112,6 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Session>
/* flush pixels in sdl window */
SDL_UpdateRect(screen, x1, y1, x2 - x1 + 1, y2 - y1 + 1);
}
if (_sync_sigh.valid())
Genode::Signal_transmitter(_sync_sigh).submit();
}
};