Add mode_sigh and release to framebuffer::Session
The 'mode_sigh' function allows the client to receive notifications about server-side display-mode changes. To respond to such a signal, the client can use the new 'release' function, which acknowledges the mode change at the server and frees the original framebuffer dataspace. Via a subsequent call of 'dataspace', a framebuffer dataspace corresponding to the new mode can be obtained. Related to issue #11.
This commit is contained in:
parent
9e3ecade16
commit
c35207d9c4
|
@ -196,7 +196,10 @@ namespace Framebuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Genode::Dataspace_capability dataspace() { return _window_content->fb_ds_cap(); }
|
Genode::Dataspace_capability dataspace() {
|
||||||
|
return _window_content->fb_ds_cap(); }
|
||||||
|
|
||||||
|
void release() { }
|
||||||
|
|
||||||
Mode mode()
|
Mode mode()
|
||||||
{
|
{
|
||||||
|
@ -204,6 +207,8 @@ namespace Framebuffer
|
||||||
Mode::RGB565);
|
Mode::RGB565);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mode_sigh(Genode::Signal_context_capability) { }
|
||||||
|
|
||||||
void refresh(int x, int y, int w, int h) {
|
void refresh(int x, int y, int w, int h) {
|
||||||
window_content()->redraw_area(x, y, w, h); }
|
window_content()->redraw_area(x, y, w, h); }
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,8 +27,12 @@ namespace Framebuffer {
|
||||||
Genode::Dataspace_capability dataspace() {
|
Genode::Dataspace_capability dataspace() {
|
||||||
return call<Rpc_dataspace>(); }
|
return call<Rpc_dataspace>(); }
|
||||||
|
|
||||||
Mode mode() {
|
void release() { call<Rpc_release>(); }
|
||||||
return call<Rpc_mode>(); }
|
|
||||||
|
Mode mode() { return call<Rpc_mode>(); }
|
||||||
|
|
||||||
|
void mode_sigh(Genode::Signal_context_capability sigh) {
|
||||||
|
call<Rpc_mode_sigh>(sigh); }
|
||||||
|
|
||||||
void refresh(int x, int y, int w, int h) {
|
void refresh(int x, int y, int w, int h) {
|
||||||
call<Rpc_refresh>(x, y, w, h); }
|
call<Rpc_refresh>(x, y, w, h); }
|
||||||
|
|
|
@ -14,11 +14,15 @@
|
||||||
#ifndef _INCLUDE__FRAMEBUFFER_SESSION__FRAMEBUFFER_SESSION_H_
|
#ifndef _INCLUDE__FRAMEBUFFER_SESSION__FRAMEBUFFER_SESSION_H_
|
||||||
#define _INCLUDE__FRAMEBUFFER_SESSION__FRAMEBUFFER_SESSION_H_
|
#define _INCLUDE__FRAMEBUFFER_SESSION__FRAMEBUFFER_SESSION_H_
|
||||||
|
|
||||||
|
#include <base/signal.h>
|
||||||
#include <dataspace/capability.h>
|
#include <dataspace/capability.h>
|
||||||
#include <session/session.h>
|
#include <session/session.h>
|
||||||
|
|
||||||
namespace Framebuffer {
|
namespace Framebuffer {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Framebuffer mode info as returned by 'Framebuffer::Session::mode()'
|
||||||
|
*/
|
||||||
struct Mode
|
struct Mode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -57,6 +61,7 @@ namespace Framebuffer {
|
||||||
return bytes_per_pixel(_format); }
|
return bytes_per_pixel(_format); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct Session : Genode::Session
|
struct Session : Genode::Session
|
||||||
{
|
{
|
||||||
static const char *service_name() { return "Framebuffer"; }
|
static const char *service_name() { return "Framebuffer"; }
|
||||||
|
@ -69,10 +74,35 @@ namespace Framebuffer {
|
||||||
virtual Genode::Dataspace_capability dataspace() = 0;
|
virtual Genode::Dataspace_capability dataspace() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request current screen mode properties
|
* Release framebuffer, free dataspace
|
||||||
|
*
|
||||||
|
* By calling this function, the framebuffer client enables the server
|
||||||
|
* to reallocate the framebuffer dataspace on mode changes. Prior
|
||||||
|
* calling this function, the client should have detached the dataspace
|
||||||
|
* from its local address space.
|
||||||
|
*/
|
||||||
|
virtual void release() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request current display-mode properties
|
||||||
*/
|
*/
|
||||||
virtual Mode mode() = 0;
|
virtual Mode mode() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register signal handler to be notified on mode changes
|
||||||
|
*
|
||||||
|
* The framebuffer server may support changing the display mode on the
|
||||||
|
* fly. For example, a virtual framebuffer presented in a window may
|
||||||
|
* get resized according to the window dimensions. By installing a
|
||||||
|
* signal handler for mode changes, the framebuffer client can respond
|
||||||
|
* to such changes. From the client's perspective, the original mode
|
||||||
|
* stays in effect until the client calls 'release()'. After having
|
||||||
|
* released the framebuffer, the new mode can be obtained using the
|
||||||
|
* 'mode()' function and a new framebuffer dataspace can be requested
|
||||||
|
* by calling 'dataspace()'.
|
||||||
|
*/
|
||||||
|
virtual void mode_sigh(Genode::Signal_context_capability sigh) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flush specified pixel region
|
* Flush specified pixel region
|
||||||
*
|
*
|
||||||
|
@ -86,10 +116,13 @@ namespace Framebuffer {
|
||||||
*********************/
|
*********************/
|
||||||
|
|
||||||
GENODE_RPC(Rpc_dataspace, Genode::Dataspace_capability, dataspace);
|
GENODE_RPC(Rpc_dataspace, Genode::Dataspace_capability, dataspace);
|
||||||
|
GENODE_RPC(Rpc_release, void, release);
|
||||||
GENODE_RPC(Rpc_mode, Mode, mode);
|
GENODE_RPC(Rpc_mode, Mode, mode);
|
||||||
GENODE_RPC(Rpc_refresh, void, refresh, int, int, int, int);
|
GENODE_RPC(Rpc_refresh, void, refresh, int, int, int, int);
|
||||||
|
GENODE_RPC(Rpc_mode_sigh, void, mode_sigh, Genode::Signal_context_capability);
|
||||||
|
|
||||||
GENODE_RPC_INTERFACE(Rpc_dataspace, Rpc_mode, Rpc_refresh);
|
GENODE_RPC_INTERFACE(Rpc_dataspace, Rpc_release, Rpc_mode,
|
||||||
|
Rpc_mode_sigh, Rpc_refresh);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,17 +45,18 @@ namespace Framebuffer {
|
||||||
|
|
||||||
Dataspace_capability dataspace() { return Framebuffer_drv::hw_framebuffer(); }
|
Dataspace_capability dataspace() { return Framebuffer_drv::hw_framebuffer(); }
|
||||||
|
|
||||||
void info(int *out_w, int *out_h, Mode *out_mode)
|
void release() { }
|
||||||
{
|
|
||||||
*out_w = scr_width;
|
|
||||||
*out_h = scr_height;
|
|
||||||
|
|
||||||
switch (scr_mode) {
|
Mode mode()
|
||||||
case 16: *out_mode = RGB565; break;
|
{
|
||||||
default: *out_mode = INVALID;
|
if (scr_mode != 16)
|
||||||
}
|
return Mode(); /* invalid mode */
|
||||||
|
|
||||||
|
return Mode(scr_width, scr_height, Mode::RGB565);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mode_sigh(Genode::Signal_context_capability sigh) { }
|
||||||
|
|
||||||
void refresh(int x, int y, int w, int h)
|
void refresh(int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -165,8 +165,12 @@ namespace Framebuffer
|
||||||
|
|
||||||
Genode::Dataspace_capability dataspace() { return _fb_ds_cap; }
|
Genode::Dataspace_capability dataspace() { return _fb_ds_cap; }
|
||||||
|
|
||||||
|
void release() { }
|
||||||
|
|
||||||
Mode mode() { return Mode(SCR_WIDTH, SCR_HEIGHT, Mode::RGB565); }
|
Mode mode() { return Mode(SCR_WIDTH, SCR_HEIGHT, Mode::RGB565); }
|
||||||
|
|
||||||
|
void mode_sigh(Genode::Signal_context_capability) { }
|
||||||
|
|
||||||
void refresh(int x, int y, int w, int h) { }
|
void refresh(int x, int y, int w, int h) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,12 @@ namespace Framebuffer {
|
||||||
|
|
||||||
Genode::Dataspace_capability dataspace() { return fb_ds_cap; }
|
Genode::Dataspace_capability dataspace() { return fb_ds_cap; }
|
||||||
|
|
||||||
|
void release() { }
|
||||||
|
|
||||||
Mode mode() { return _mode; }
|
Mode mode() { return _mode; }
|
||||||
|
|
||||||
|
void mode_sigh(Genode::Signal_context_capability) { }
|
||||||
|
|
||||||
void refresh(int x, int y, int w, int h)
|
void refresh(int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
/* clip refresh area to screen boundaries */
|
/* clip refresh area to screen boundaries */
|
||||||
|
|
|
@ -150,12 +150,16 @@ namespace Framebuffer {
|
||||||
return _buffered ? Dataspace_capability(_bb_ds)
|
return _buffered ? Dataspace_capability(_bb_ds)
|
||||||
: Dataspace_capability(_fb_ds); }
|
: Dataspace_capability(_fb_ds); }
|
||||||
|
|
||||||
|
void release() { }
|
||||||
|
|
||||||
Mode mode()
|
Mode mode()
|
||||||
{
|
{
|
||||||
return Mode(_scr_width, _scr_height,
|
return Mode(_scr_width, _scr_height,
|
||||||
_scr_mode == 16 ? Mode::RGB565 : Mode::INVALID);
|
_scr_mode == 16 ? Mode::RGB565 : Mode::INVALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mode_sigh(Genode::Signal_context_capability) { }
|
||||||
|
|
||||||
/* not implemented */
|
/* not implemented */
|
||||||
void refresh(int x, int y, int w, int h)
|
void refresh(int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
|
|
|
@ -341,12 +341,16 @@ namespace Framebuffer {
|
||||||
|
|
||||||
Genode::Dataspace_capability dataspace() { return _buffer->ds_cap(); }
|
Genode::Dataspace_capability dataspace() { return _buffer->ds_cap(); }
|
||||||
|
|
||||||
|
void release() { }
|
||||||
|
|
||||||
Mode mode()
|
Mode mode()
|
||||||
{
|
{
|
||||||
return Mode(_buffer->size().w(), _buffer->size().h(),
|
return Mode(_buffer->size().w(), _buffer->size().h(),
|
||||||
_buffer->format());
|
_buffer->format());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mode_sigh(Genode::Signal_context_capability) { }
|
||||||
|
|
||||||
void refresh(int x, int y, int w, int h)
|
void refresh(int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
_view_stack->update_session_views(_session,
|
_view_stack->update_session_views(_session,
|
||||||
|
|
Loading…
Reference in New Issue