2011-12-22 15:19:25 +00:00
|
|
|
/*
|
|
|
|
* \brief Framebuffer session interface
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2006-07-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
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _INCLUDE__FRAMEBUFFER_SESSION__FRAMEBUFFER_SESSION_H_
|
|
|
|
#define _INCLUDE__FRAMEBUFFER_SESSION__FRAMEBUFFER_SESSION_H_
|
|
|
|
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
#include <base/output.h>
|
2012-01-20 20:34:01 +00:00
|
|
|
#include <base/signal.h>
|
2011-12-22 15:19:25 +00:00
|
|
|
#include <dataspace/capability.h>
|
|
|
|
#include <session/session.h>
|
2020-06-16 13:46:59 +00:00
|
|
|
#include <os/surface.h>
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
namespace Framebuffer {
|
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
struct Mode;
|
|
|
|
struct Session;
|
2016-11-23 16:07:49 +00:00
|
|
|
struct Session_client;
|
2020-06-16 13:46:59 +00:00
|
|
|
|
|
|
|
using Area = Genode::Surface_base::Area;
|
2015-03-04 20:12:14 +00:00
|
|
|
}
|
2012-01-18 13:57:08 +00:00
|
|
|
|
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
/**
|
|
|
|
* Framebuffer mode info as returned by 'Framebuffer::Session::mode()'
|
|
|
|
*/
|
|
|
|
struct Framebuffer::Mode
|
|
|
|
{
|
2020-06-16 13:46:59 +00:00
|
|
|
Area area;
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2020-06-16 13:46:59 +00:00
|
|
|
Genode::size_t bytes_per_pixel() const { return 4; }
|
base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.
While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).
To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.
Issue #1987
2016-07-13 17:07:09 +00:00
|
|
|
|
2020-06-16 13:46:59 +00:00
|
|
|
void print(Genode::Output &out) const { Genode::print(out, area); }
|
2015-03-04 20:12:14 +00:00
|
|
|
};
|
2012-01-20 20:34:01 +00:00
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
struct Framebuffer::Session : Genode::Session
|
|
|
|
{
|
2017-05-24 12:41:19 +00:00
|
|
|
/**
|
|
|
|
* \noapi
|
|
|
|
*/
|
2015-03-04 20:12:14 +00:00
|
|
|
static const char *service_name() { return "Framebuffer"; }
|
2012-01-20 20:34:01 +00:00
|
|
|
|
2017-05-07 20:03:25 +00:00
|
|
|
/*
|
|
|
|
* A framebuffer session consumes a dataspace capability for the server's
|
|
|
|
* session-object allocation, a dataspace capability for the framebuffer
|
|
|
|
* dataspace, and its session capability.
|
|
|
|
*/
|
2023-05-15 15:33:44 +00:00
|
|
|
static constexpr unsigned CAP_QUOTA = 3;
|
2017-05-07 20:03:25 +00:00
|
|
|
|
2016-11-23 16:07:49 +00:00
|
|
|
typedef Session_client Client;
|
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
virtual ~Session() { }
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
/**
|
|
|
|
* Request dataspace representing the logical frame buffer
|
|
|
|
*
|
2015-03-20 16:50:41 +00:00
|
|
|
* By calling this method, the framebuffer client enables the server
|
2015-03-04 20:12:14 +00:00
|
|
|
* to reallocate the framebuffer dataspace (e.g., on mode changes).
|
2015-03-20 16:50:41 +00:00
|
|
|
* Hence, prior calling this method, the client should make sure to
|
2015-03-04 20:12:14 +00:00
|
|
|
* have detached the previously requested dataspace from its local
|
|
|
|
* address space.
|
|
|
|
*/
|
|
|
|
virtual Genode::Dataspace_capability dataspace() = 0;
|
2014-04-29 13:32:09 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
/**
|
|
|
|
* Request display-mode properties of the framebuffer ready to be
|
2015-03-20 16:50:41 +00:00
|
|
|
* obtained via the 'dataspace()' method
|
2015-03-04 20:12:14 +00:00
|
|
|
*/
|
|
|
|
virtual Mode mode() const = 0;
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
/**
|
|
|
|
* 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. The new mode can be obtained using the 'mode()'
|
2015-03-20 16:50:41 +00:00
|
|
|
* method. However, from the client's perspective, the original mode
|
2015-03-04 20:12:14 +00:00
|
|
|
* stays in effect until the it calls 'dataspace()' again.
|
|
|
|
*/
|
|
|
|
virtual void mode_sigh(Genode::Signal_context_capability sigh) = 0;
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
/**
|
|
|
|
* Flush specified pixel region
|
|
|
|
*
|
|
|
|
* \param x,y,w,h region to be updated on physical frame buffer
|
|
|
|
*/
|
|
|
|
virtual void refresh(int x, int y, int w, int h) = 0;
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-03-04 20:12:14 +00:00
|
|
|
/**
|
|
|
|
* Register signal handler for refresh synchronization
|
|
|
|
*/
|
|
|
|
virtual void sync_sigh(Genode::Signal_context_capability) = 0;
|
|
|
|
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
** RPC declaration **
|
|
|
|
*********************/
|
|
|
|
|
|
|
|
GENODE_RPC(Rpc_dataspace, Genode::Dataspace_capability, dataspace);
|
|
|
|
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(Rpc_sync_sigh, void, sync_sigh, Genode::Signal_context_capability);
|
|
|
|
|
|
|
|
GENODE_RPC_INTERFACE(Rpc_dataspace, Rpc_mode, Rpc_mode_sigh, Rpc_refresh,
|
|
|
|
Rpc_sync_sigh);
|
|
|
|
};
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
#endif /* _INCLUDE__FRAMEBUFFER_SESSION__FRAMEBUFFER_SESSION_H_ */
|