2011-12-22 15:19:25 +00:00
|
|
|
/*
|
2020-06-11 14:06:21 +00:00
|
|
|
* \brief GUI session interface
|
2011-12-22 15:19:25 +00:00
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2006-08-10
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 12:23:52 +00:00
|
|
|
* Copyright (C) 2006-2017 Genode Labs GmbH
|
2011-12-22 15:19:25 +00:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 12:23:52 +00:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2011-12-22 15:19:25 +00:00
|
|
|
*/
|
|
|
|
|
2020-06-11 12:27:20 +00:00
|
|
|
#ifndef _INCLUDE__GUI_SESSION__GUI_SESSION_H_
|
|
|
|
#define _INCLUDE__GUI_SESSION__GUI_SESSION_H_
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
#include <session/session.h>
|
2014-06-06 15:26:53 +00:00
|
|
|
#include <os/surface.h>
|
|
|
|
#include <os/handle_registry.h>
|
2011-12-22 15:19:25 +00:00
|
|
|
#include <framebuffer_session/capability.h>
|
|
|
|
#include <input_session/capability.h>
|
|
|
|
|
2020-06-12 09:23:57 +00:00
|
|
|
namespace Gui {
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 20:03:22 +00:00
|
|
|
|
2013-12-28 21:29:30 +00:00
|
|
|
using Genode::size_t;
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 20:03:22 +00:00
|
|
|
|
2016-11-06 13:27:26 +00:00
|
|
|
struct Session_client;
|
2014-06-06 15:26:53 +00:00
|
|
|
struct View;
|
2013-10-14 19:31:14 +00:00
|
|
|
struct Session;
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 20:03:22 +00:00
|
|
|
|
|
|
|
typedef Genode::Capability<View> View_capability;
|
|
|
|
|
2014-06-06 15:26:53 +00:00
|
|
|
typedef Genode::Surface_base::Rect Rect;
|
|
|
|
typedef Genode::Surface_base::Point Point;
|
|
|
|
typedef Genode::Surface_base::Area Area;
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 20:03:22 +00:00
|
|
|
|
|
|
|
typedef Genode::Out_of_ram Out_of_ram;
|
|
|
|
typedef Genode::Out_of_caps Out_of_caps;
|
2013-10-14 19:31:14 +00:00
|
|
|
}
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
|
2020-06-12 09:23:57 +00:00
|
|
|
struct Gui::Session : Genode::Session
|
2013-10-14 19:31:14 +00:00
|
|
|
{
|
2017-05-24 12:41:19 +00:00
|
|
|
/**
|
|
|
|
* \noapi
|
|
|
|
*/
|
2020-06-11 14:06:21 +00:00
|
|
|
static const char *service_name() { return "Gui"; }
|
2013-10-14 19:31:14 +00:00
|
|
|
|
2017-05-07 20:03:25 +00:00
|
|
|
/*
|
|
|
|
* A nitpicker session consumes a dataspace capability for the server's
|
|
|
|
* session-object allocation, a session capability, a dataspace capability
|
|
|
|
* for the command buffer, and the capabilities needed for the aggregated
|
|
|
|
* 'Framebuffer' and 'Input' sessions.
|
|
|
|
*/
|
2023-05-15 15:33:44 +00:00
|
|
|
static constexpr unsigned CAP_QUOTA = Framebuffer::Session::CAP_QUOTA
|
|
|
|
+ Input::Session::CAP_QUOTA + 3;
|
2017-05-07 20:03:25 +00:00
|
|
|
|
2016-11-06 13:27:26 +00:00
|
|
|
typedef Session_client Client;
|
|
|
|
|
2013-10-14 19:31:14 +00:00
|
|
|
/**
|
2014-06-06 15:26:53 +00:00
|
|
|
* Session-local view handle
|
|
|
|
*
|
2015-03-20 16:50:41 +00:00
|
|
|
* When issuing commands to nitpicker via the 'execute' method, views
|
2014-06-06 15:26:53 +00:00
|
|
|
* are referenced by session-local handles.
|
|
|
|
*/
|
|
|
|
typedef Genode::Handle<View> View_handle;
|
|
|
|
|
|
|
|
|
|
|
|
struct Command
|
|
|
|
{
|
|
|
|
enum Opcode { OP_GEOMETRY, OP_OFFSET,
|
|
|
|
OP_TO_FRONT, OP_TO_BACK, OP_BACKGROUND,
|
|
|
|
OP_TITLE, OP_NOP };
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Argument structures for nitpicker's command interface
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct Nop { static Opcode opcode() { return OP_NOP; } };
|
|
|
|
|
|
|
|
struct Geometry
|
|
|
|
{
|
|
|
|
static Opcode opcode() { return OP_GEOMETRY; }
|
|
|
|
View_handle view;
|
|
|
|
Rect rect;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Offset
|
|
|
|
{
|
|
|
|
static Opcode opcode() { return OP_OFFSET; }
|
|
|
|
View_handle view;
|
|
|
|
Point offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct To_front
|
|
|
|
{
|
|
|
|
static Opcode opcode() { return OP_TO_FRONT; }
|
|
|
|
View_handle view;
|
|
|
|
View_handle neighbor;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct To_back
|
|
|
|
{
|
|
|
|
static Opcode opcode() { return OP_TO_BACK; }
|
|
|
|
View_handle view;
|
|
|
|
View_handle neighbor;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Background
|
|
|
|
{
|
|
|
|
static Opcode opcode() { return OP_BACKGROUND; }
|
|
|
|
View_handle view;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Title
|
|
|
|
{
|
|
|
|
static Opcode opcode() { return OP_TITLE; }
|
|
|
|
View_handle view;
|
|
|
|
Genode::String<64> title;
|
|
|
|
};
|
|
|
|
|
|
|
|
Opcode opcode;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
Nop nop;
|
|
|
|
Geometry geometry;
|
|
|
|
Offset offset;
|
|
|
|
To_front to_front;
|
|
|
|
To_back to_back;
|
|
|
|
Background background;
|
|
|
|
Title title;
|
|
|
|
};
|
|
|
|
|
|
|
|
Command() : opcode(OP_NOP) { }
|
|
|
|
|
|
|
|
template <typename ARGS>
|
Follow practices suggested by "Effective C++"
The patch adjust the code of the base, base-<kernel>, and os repository.
To adapt existing components to fix violations of the best practices
suggested by "Effective C++" as reported by the -Weffc++ compiler
argument. The changes follow the patterns outlined below:
* A class with virtual functions can no longer publicly inherit base
classed without a vtable. The inherited object may either be moved
to a member variable, or inherited privately. The latter would be
used for classes that inherit 'List::Element' or 'Avl_node'. In order
to enable the 'List' and 'Avl_tree' to access the meta data, the
'List' must become a friend.
* Instead of adding a virtual destructor to abstract base classes,
we inherit the new 'Interface' class, which contains a virtual
destructor. This way, single-line abstract base classes can stay
as compact as they are now. The 'Interface' utility resides in
base/include/util/interface.h.
* With the new warnings enabled, all member variables must be explicitly
initialized. Basic types may be initialized with '='. All other types
are initialized with braces '{ ... }' or as class initializers. If
basic types and non-basic types appear in a row, it is nice to only
use the brace syntax (also for basic types) and align the braces.
* If a class contains pointers as members, it must now also provide a
copy constructor and assignment operator. In the most cases, one
would make them private, effectively disallowing the objects to be
copied. Unfortunately, this warning cannot be fixed be inheriting
our existing 'Noncopyable' class (the compiler fails to detect that
the inheriting class cannot be copied and still gives the error).
For now, we have to manually add declarations for both the copy
constructor and assignment operator as private class members. Those
declarations should be prepended with a comment like this:
/*
* Noncopyable
*/
Thread(Thread const &);
Thread &operator = (Thread const &);
In the future, we should revisit these places and try to replace
the pointers with references. In the presence of at least one
reference member, the compiler would no longer implicitly generate
a copy constructor. So we could remove the manual declaration.
Issue #465
2017-12-21 14:42:15 +00:00
|
|
|
Command(ARGS args) : opcode(ARGS::opcode())
|
2014-06-06 15:26:53 +00:00
|
|
|
{
|
|
|
|
reinterpret_cast<ARGS &>(nop) = args;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Command buffer shared between nitpicker and client
|
|
|
|
*/
|
|
|
|
class Command_buffer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum { MAX_COMMANDS = 64 };
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
unsigned _num = 0;
|
|
|
|
|
|
|
|
Command _commands[MAX_COMMANDS];
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2016-05-11 16:21:47 +00:00
|
|
|
bool full() const { return _num >= MAX_COMMANDS; }
|
|
|
|
|
2014-06-06 15:26:53 +00:00
|
|
|
unsigned num() const
|
|
|
|
{
|
|
|
|
/* copy out _num value to avoid use-after-check problems */
|
|
|
|
unsigned const num = _num;
|
|
|
|
return num <= MAX_COMMANDS ? num : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void reset() { _num = 0; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enqueue command
|
|
|
|
*
|
|
|
|
* The command will be dropped if the buffer is full. Check for this
|
2016-05-11 16:21:47 +00:00
|
|
|
* condition by calling 'full()' prior calling this method.
|
2014-06-06 15:26:53 +00:00
|
|
|
*/
|
|
|
|
void enqueue(Command const &command)
|
|
|
|
{
|
2016-05-11 16:21:47 +00:00
|
|
|
if (!full())
|
2014-06-06 15:26:53 +00:00
|
|
|
_commands[_num++] = command;
|
|
|
|
}
|
|
|
|
|
|
|
|
Command get(unsigned i)
|
|
|
|
{
|
|
|
|
if (i >= MAX_COMMANDS) return Command(Command::Nop());
|
|
|
|
|
|
|
|
return _commands[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Exception types
|
2013-10-14 19:31:14 +00:00
|
|
|
*/
|
2014-06-06 15:26:53 +00:00
|
|
|
struct Invalid_handle : Genode::Exception { };
|
2013-10-14 19:31:14 +00:00
|
|
|
|
|
|
|
virtual ~Session() { }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request framebuffer sub-session
|
|
|
|
*/
|
|
|
|
virtual Framebuffer::Session_capability framebuffer_session() = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request input sub-session
|
|
|
|
*/
|
|
|
|
virtual Input::Session_capability input_session() = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new view at the buffer
|
|
|
|
*
|
2014-02-14 09:36:04 +00:00
|
|
|
* \param parent parent view
|
|
|
|
*
|
2014-06-06 15:26:53 +00:00
|
|
|
* \throw Invalid_handle
|
|
|
|
* \return handle for new view
|
2014-02-14 09:36:04 +00:00
|
|
|
*
|
|
|
|
* The 'parent' argument allows the client to use the location of an
|
|
|
|
* existing view as the coordinate origin for the to-be-created view.
|
2014-06-06 15:26:53 +00:00
|
|
|
* If an invalid handle is specified (default), the view will be a
|
2014-02-14 09:36:04 +00:00
|
|
|
* top-level view.
|
2013-10-14 19:31:14 +00:00
|
|
|
*/
|
2014-06-06 15:26:53 +00:00
|
|
|
virtual View_handle create_view(View_handle parent = View_handle()) = 0;
|
2013-10-14 19:31:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Destroy view
|
|
|
|
*/
|
2014-06-06 15:26:53 +00:00
|
|
|
virtual void destroy_view(View_handle) = 0;
|
2013-10-14 19:31:14 +00:00
|
|
|
|
|
|
|
/**
|
2014-06-06 15:26:53 +00:00
|
|
|
* Return session-local handle for the specified view
|
|
|
|
*
|
2015-03-20 16:50:41 +00:00
|
|
|
* The handle returned by this method can be used to issue commands
|
|
|
|
* via the 'execute' method.
|
2014-06-06 15:26:53 +00:00
|
|
|
*
|
|
|
|
* \param handle designated view handle to be assigned to the imported
|
|
|
|
* view. By default, a new handle will be allocated.
|
|
|
|
*
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 20:03:22 +00:00
|
|
|
* \throw Out_of_ram
|
|
|
|
* \throw Out_of_caps
|
2013-10-14 19:31:14 +00:00
|
|
|
*/
|
2014-06-06 15:26:53 +00:00
|
|
|
virtual View_handle view_handle(View_capability,
|
|
|
|
View_handle handle = View_handle()) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request view capability for a given handle
|
|
|
|
*
|
|
|
|
* The returned view capability can be used to share the view with another
|
|
|
|
* session.
|
|
|
|
*/
|
|
|
|
virtual View_capability view_capability(View_handle) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Release session-local view handle
|
|
|
|
*/
|
|
|
|
virtual void release_view_handle(View_handle) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Request dataspace used for issuing view commands to nitpicker
|
|
|
|
*/
|
|
|
|
virtual Genode::Dataspace_capability command_dataspace() = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execution batch of commands contained in the command dataspace
|
|
|
|
*/
|
|
|
|
virtual void execute() = 0;
|
2013-10-14 19:31:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return physical screen mode
|
|
|
|
*/
|
|
|
|
virtual Framebuffer::Mode mode() = 0;
|
|
|
|
|
2014-07-09 08:34:02 +00:00
|
|
|
/**
|
|
|
|
* Register signal handler to be notified about mode changes
|
|
|
|
*/
|
|
|
|
virtual void mode_sigh(Genode::Signal_context_capability) = 0;
|
|
|
|
|
2013-10-14 19:31:14 +00:00
|
|
|
/**
|
|
|
|
* Define dimensions of virtual framebuffer
|
|
|
|
*
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 20:03:22 +00:00
|
|
|
* \throw Out_of_ram session quota does not suffice for specified
|
|
|
|
* buffer dimensions
|
|
|
|
* \throw Out_of_caps
|
2013-10-14 19:31:14 +00:00
|
|
|
*/
|
|
|
|
virtual void buffer(Framebuffer::Mode mode, bool use_alpha) = 0;
|
|
|
|
|
2014-06-04 13:58:49 +00:00
|
|
|
/**
|
|
|
|
* Set focused session
|
|
|
|
*
|
2018-04-05 17:50:56 +00:00
|
|
|
* Normally, the focused session is defined by the 'focus' ROM, which is
|
|
|
|
* driven by an external policy component. However, in cases where one
|
|
|
|
* application consists of multiple nitpicker sessions, it is desirable to
|
|
|
|
* let the application manage the focus among its sessions by applying an
|
|
|
|
* application-local policy. The 'focus' RPC function allows a client to
|
|
|
|
* specify another client that should receive the focus whenever the
|
|
|
|
* session becomes focused. As the designated receiver of the focus is
|
|
|
|
* referred to by its session capability, a common parent can manage the
|
|
|
|
* focus among its children. But unrelated sessions cannot interfere.
|
2014-06-04 13:58:49 +00:00
|
|
|
*/
|
|
|
|
virtual void focus(Genode::Capability<Session> focused) = 0;
|
|
|
|
|
2014-10-04 16:50:06 +00:00
|
|
|
typedef Genode::String<160> Label;
|
|
|
|
|
|
|
|
enum Session_control { SESSION_CONTROL_HIDE, SESSION_CONTROL_SHOW,
|
2018-04-05 17:50:56 +00:00
|
|
|
SESSION_CONTROL_TO_FRONT };
|
2014-10-04 16:50:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Perform control operation on one or multiple sessions
|
|
|
|
*
|
|
|
|
* The 'label' is used to select the sessions, on which the 'operation' is
|
2020-06-12 09:23:57 +00:00
|
|
|
* performed. The GUI server creates a selector string by concatenating the
|
2014-10-04 16:50:06 +00:00
|
|
|
* caller's session label with the supplied 'label' argument. A session is
|
|
|
|
* selected if its label starts with the selector string. Thereby, the
|
|
|
|
* operation is limited to the caller session or any child session of the
|
|
|
|
* caller.
|
|
|
|
*/
|
Follow practices suggested by "Effective C++"
The patch adjust the code of the base, base-<kernel>, and os repository.
To adapt existing components to fix violations of the best practices
suggested by "Effective C++" as reported by the -Weffc++ compiler
argument. The changes follow the patterns outlined below:
* A class with virtual functions can no longer publicly inherit base
classed without a vtable. The inherited object may either be moved
to a member variable, or inherited privately. The latter would be
used for classes that inherit 'List::Element' or 'Avl_node'. In order
to enable the 'List' and 'Avl_tree' to access the meta data, the
'List' must become a friend.
* Instead of adding a virtual destructor to abstract base classes,
we inherit the new 'Interface' class, which contains a virtual
destructor. This way, single-line abstract base classes can stay
as compact as they are now. The 'Interface' utility resides in
base/include/util/interface.h.
* With the new warnings enabled, all member variables must be explicitly
initialized. Basic types may be initialized with '='. All other types
are initialized with braces '{ ... }' or as class initializers. If
basic types and non-basic types appear in a row, it is nice to only
use the brace syntax (also for basic types) and align the braces.
* If a class contains pointers as members, it must now also provide a
copy constructor and assignment operator. In the most cases, one
would make them private, effectively disallowing the objects to be
copied. Unfortunately, this warning cannot be fixed be inheriting
our existing 'Noncopyable' class (the compiler fails to detect that
the inheriting class cannot be copied and still gives the error).
For now, we have to manually add declarations for both the copy
constructor and assignment operator as private class members. Those
declarations should be prepended with a comment like this:
/*
* Noncopyable
*/
Thread(Thread const &);
Thread &operator = (Thread const &);
In the future, we should revisit these places and try to replace
the pointers with references. In the presence of at least one
reference member, the compiler would no longer implicitly generate
a copy constructor. So we could remove the manual declaration.
Issue #465
2017-12-21 14:42:15 +00:00
|
|
|
virtual void session_control(Label, Session_control) { }
|
2014-10-04 16:50:06 +00:00
|
|
|
|
2013-10-14 19:31:14 +00:00
|
|
|
/**
|
|
|
|
* Return number of bytes needed for virtual framebuffer of specified size
|
|
|
|
*/
|
|
|
|
static size_t ram_quota(Framebuffer::Mode mode, bool use_alpha)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* If alpha blending is used, each pixel requires an additional byte
|
|
|
|
* for the alpha value and a byte holding the input mask.
|
2011-12-22 15:19:25 +00:00
|
|
|
*/
|
2020-06-16 13:46:59 +00:00
|
|
|
return (mode.bytes_per_pixel() + 2*use_alpha)*mode.area.count();
|
2013-10-14 19:31:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
** RPC declaration **
|
|
|
|
*********************/
|
|
|
|
|
|
|
|
GENODE_RPC(Rpc_framebuffer_session, Framebuffer::Session_capability, framebuffer_session);
|
|
|
|
GENODE_RPC(Rpc_input_session, Input::Session_capability, input_session);
|
2014-06-06 15:26:53 +00:00
|
|
|
GENODE_RPC_THROW(Rpc_create_view, View_handle, create_view,
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 20:03:22 +00:00
|
|
|
GENODE_TYPE_LIST(Out_of_ram, Out_of_caps, Invalid_handle), View_handle);
|
2014-06-06 15:26:53 +00:00
|
|
|
GENODE_RPC(Rpc_destroy_view, void, destroy_view, View_handle);
|
|
|
|
GENODE_RPC_THROW(Rpc_view_handle, View_handle, view_handle,
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 20:03:22 +00:00
|
|
|
GENODE_TYPE_LIST(Out_of_ram, Out_of_caps), View_capability, View_handle);
|
2014-06-06 15:26:53 +00:00
|
|
|
GENODE_RPC(Rpc_view_capability, View_capability, view_capability, View_handle);
|
|
|
|
GENODE_RPC(Rpc_release_view_handle, void, release_view_handle, View_handle);
|
|
|
|
GENODE_RPC(Rpc_command_dataspace, Genode::Dataspace_capability, command_dataspace);
|
|
|
|
GENODE_RPC(Rpc_execute, void, execute);
|
2013-10-14 19:31:14 +00:00
|
|
|
GENODE_RPC(Rpc_background, int, background, View_capability);
|
|
|
|
GENODE_RPC(Rpc_mode, Framebuffer::Mode, mode);
|
2014-07-09 08:34:02 +00:00
|
|
|
GENODE_RPC(Rpc_mode_sigh, void, mode_sigh, Genode::Signal_context_capability);
|
2014-06-04 13:58:49 +00:00
|
|
|
GENODE_RPC(Rpc_focus, void, focus, Genode::Capability<Session>);
|
2014-10-04 16:50:06 +00:00
|
|
|
GENODE_RPC(Rpc_session_control, void, session_control, Label, Session_control);
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 20:03:22 +00:00
|
|
|
GENODE_RPC_THROW(Rpc_buffer, void, buffer, GENODE_TYPE_LIST(Out_of_ram, Out_of_caps),
|
2013-10-14 19:31:14 +00:00
|
|
|
Framebuffer::Mode, bool);
|
|
|
|
|
2016-05-11 15:23:51 +00:00
|
|
|
GENODE_RPC_INTERFACE(Rpc_framebuffer_session, Rpc_input_session,
|
|
|
|
Rpc_create_view, Rpc_destroy_view, Rpc_view_handle,
|
|
|
|
Rpc_view_capability, Rpc_release_view_handle,
|
|
|
|
Rpc_command_dataspace, Rpc_execute, Rpc_mode,
|
|
|
|
Rpc_mode_sigh, Rpc_buffer, Rpc_focus, Rpc_session_control);
|
2013-10-14 19:31:14 +00:00
|
|
|
};
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2020-06-11 12:27:20 +00:00
|
|
|
#endif /* _INCLUDE__GUI_SESSION__GUI_SESSION_H_ */
|