2013-05-03 17:20:45 +02:00
|
|
|
/*
|
|
|
|
* \brief Frame-buffer driver for the i.MX53
|
|
|
|
* \author Nikolay Golikov <nik@ksyslabs.org>
|
|
|
|
* \date 2012-06-21
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Genode includes */
|
2013-04-30 15:19:18 +02:00
|
|
|
#include <imx_framebuffer_session/imx_framebuffer_session.h>
|
2013-05-03 17:20:45 +02:00
|
|
|
#include <cap_session/connection.h>
|
|
|
|
#include <dataspace/client.h>
|
|
|
|
#include <base/printf.h>
|
|
|
|
#include <base/sleep.h>
|
|
|
|
#include <os/static_root.h>
|
|
|
|
|
|
|
|
/* local includes */
|
|
|
|
#include <driver.h>
|
|
|
|
|
|
|
|
namespace Framebuffer {
|
|
|
|
using namespace Genode;
|
|
|
|
class Session_component;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class Framebuffer::Session_component :
|
2013-04-30 15:19:18 +02:00
|
|
|
public Genode::Rpc_object<Framebuffer::Imx_session>
|
2013-05-03 17:20:45 +02:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
|
|
|
size_t _size;
|
|
|
|
Dataspace_capability _ds;
|
|
|
|
addr_t _phys_base;
|
2013-04-30 15:19:18 +02:00
|
|
|
Mode _mode;
|
2013-05-03 17:20:45 +02:00
|
|
|
|
2013-04-30 15:19:18 +02:00
|
|
|
Ipu &_ipu;
|
2013-05-03 17:20:45 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
Session_component(Driver &driver)
|
2013-04-30 15:19:18 +02:00
|
|
|
: _size(driver.size()),
|
2013-05-03 17:20:45 +02:00
|
|
|
_ds(env()->ram_session()->alloc(_size, false)),
|
2013-04-30 15:19:18 +02:00
|
|
|
_phys_base(Dataspace_client(_ds).phys_addr()),
|
|
|
|
_mode(driver.mode()),
|
|
|
|
_ipu(driver.ipu())
|
2013-05-03 17:20:45 +02:00
|
|
|
{
|
|
|
|
if (!driver.init(_phys_base)) {
|
|
|
|
PERR("Could not initialize display");
|
|
|
|
struct Could_not_initialize_display : Exception { };
|
|
|
|
throw Could_not_initialize_display();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************
|
|
|
|
** Framebuffer::session interface **
|
|
|
|
**************************************/
|
|
|
|
|
2013-04-30 15:19:18 +02:00
|
|
|
Dataspace_capability dataspace() { return _ds; }
|
|
|
|
void release() { }
|
|
|
|
Mode mode() const { return _mode; }
|
2013-05-03 17:20:45 +02:00
|
|
|
void mode_sigh(Genode::Signal_context_capability) { }
|
2013-04-30 15:19:18 +02:00
|
|
|
void refresh(int, int, int, int) { }
|
|
|
|
|
|
|
|
void overlay(Genode::addr_t phys_base, int x, int y, int alpha) {
|
|
|
|
_ipu.overlay(phys_base, x, y, alpha); }
|
2013-05-03 17:20:45 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
int main(int, char **)
|
|
|
|
{
|
|
|
|
Genode::printf("Starting i.MX53 framebuffer driver\n");
|
|
|
|
|
|
|
|
using namespace Framebuffer;
|
|
|
|
|
|
|
|
static Driver driver;
|
|
|
|
|
|
|
|
enum { STACK_SIZE = 4096 };
|
|
|
|
static Cap_connection cap;
|
|
|
|
static Rpc_entrypoint ep(&cap, STACK_SIZE, "fb_ep");
|
|
|
|
|
|
|
|
static Session_component fb_session(driver);
|
|
|
|
static Static_root<Framebuffer::Session> fb_root(ep.manage(&fb_session));
|
|
|
|
|
|
|
|
env()->parent()->announce(ep.manage(&fb_root));
|
|
|
|
|
|
|
|
sleep_forever();
|
|
|
|
return 0;
|
|
|
|
}
|