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:
Norman Feske
2012-01-20 21:34:01 +01:00
parent 9e3ecade16
commit c35207d9c4
8 changed files with 72 additions and 13 deletions

View File

@ -14,11 +14,15 @@
#ifndef _INCLUDE__FRAMEBUFFER_SESSION__FRAMEBUFFER_SESSION_H_
#define _INCLUDE__FRAMEBUFFER_SESSION__FRAMEBUFFER_SESSION_H_
#include <base/signal.h>
#include <dataspace/capability.h>
#include <session/session.h>
namespace Framebuffer {
/**
* Framebuffer mode info as returned by 'Framebuffer::Session::mode()'
*/
struct Mode
{
public:
@ -57,6 +61,7 @@ namespace Framebuffer {
return bytes_per_pixel(_format); }
};
struct Session : Genode::Session
{
static const char *service_name() { return "Framebuffer"; }
@ -69,10 +74,35 @@ namespace Framebuffer {
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;
/**
* 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
*
@ -86,10 +116,13 @@ namespace Framebuffer {
*********************/
GENODE_RPC(Rpc_dataspace, Genode::Dataspace_capability, dataspace);
GENODE_RPC(Rpc_release, void, release);
GENODE_RPC(Rpc_mode, Mode, mode);
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);
};
}