Remove obsolete Fiasco UX framebuffer driver

This commit is contained in:
Stefan Kalkowski 2013-04-29 10:45:40 +02:00 committed by Norman Feske
parent 4873f35945
commit 8aad441ef0
4 changed files with 0 additions and 291 deletions

View File

@ -1,129 +0,0 @@
/**
* \brief Fiasco-UX Framebuffer driver
* \author Christian Helmuth
* \date 2006-08-30
*/
/*
* Copyright (C) 2006-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#include <base/env.h>
#include <base/stdint.h>
#include <base/printf.h>
#include <base/snprintf.h>
#include <rom_session/connection.h>
#include <io_mem_session/connection.h>
namespace Fiasco {
#include <l4/sys/vhw.h>
}
#include "framebuffer.h"
using namespace Genode;
/**
* Framebuffer area
*/
static Dataspace_capability io_mem_cap;
/****************
** Driver API **
****************/
Dataspace_capability Framebuffer_drv::hw_framebuffer()
{
return io_mem_cap;
}
/********************
** Driver startup **
********************/
/**
* Configure Fiasco kernel info page
*/
static void *map_kip()
{
/* request KIP dataspace */
Rom_connection rom("l4v2_kip");
rom.on_destruction(Rom_connection::KEEP_OPEN);
/* attach KIP dataspace */
return env()->rm_session()->attach(rom.dataspace());
}
/**
* Read virtual hardware descriptor from kernel info page
*/
static int init_framebuffer_vhw(void *kip, addr_t *base, size_t *size)
{
Fiasco::l4_kernel_info_t *kip_ptr = (Fiasco::l4_kernel_info_t *)kip;
struct Fiasco::l4_vhw_descriptor *vhw = Fiasco::l4_vhw_get(kip_ptr);
if (!vhw) return -1;
struct Fiasco::l4_vhw_entry *e = Fiasco::l4_vhw_get_entry_type(vhw, Fiasco::L4_TYPE_VHW_FRAMEBUFFER);
if (!e) return -2;
*base = e->mem_start;
*size = e->mem_size;
return 0;
}
/**
* Configure io_mem area containing Fiasco-UX framebuffer
*/
Dataspace_capability map_framebuffer_area(addr_t base, size_t size, void **framebuffer)
{
/* request io_mem dataspace */
Io_mem_connection io_mem(base, size);
io_mem.on_destruction(Io_mem_connection::KEEP_OPEN);
Io_mem_dataspace_capability io_mem_ds = io_mem.dataspace();
if (!io_mem_ds.valid()) return Dataspace_capability();
/* attach io_mem dataspace */
*framebuffer = env()->rm_session()->attach(io_mem_ds);
return io_mem_ds;
}
int Framebuffer_drv::init()
{
using namespace Genode;
void *kip = 0;
try { kip = map_kip(); }
catch (...) {
PERR("KIP mapping failed");
return 1;
}
addr_t base; size_t size;
if (init_framebuffer_vhw(kip, &base, &size)) {
PERR("VHW framebuffer init failed");
return 2;
}
PDBG("--- framebuffer area is [%lx,%lx) ---", base, base + size);
void *framebuffer = 0;
io_mem_cap = map_framebuffer_area(base, size, &framebuffer);
if (!io_mem_cap.valid()) {
PERR("VHW framebuffer area mapping failed");
return 3;
}
return 0;
}

View File

@ -1,32 +0,0 @@
/**
* \brief Framebuffer driver interface
* \author Christian Helmuth
* \date 2006-08-30
*/
/*
* Copyright (C) 2006-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _FRAMEBUFFER_H
#define _FRAMEBUFFER_H
#include <dataspace/capability.h>
namespace Framebuffer_drv {
/**
* Return capability for h/w framebuffer dataspace
*/
Genode::Dataspace_capability hw_framebuffer();
/**
* Initialize driver
*/
int init();
}
#endif

View File

@ -1,126 +0,0 @@
/**
* \brief Framebuffer driver front-end
* \author Norman Feske
* \author Christian Helmuth
* \date 2006-08-30
*/
/*
* Copyright (C) 2006-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
/* Genode */
#include <base/env.h>
#include <base/sleep.h>
#include <base/rpc_server.h>
#include <root/component.h>
#include <cap_session/connection.h>
#include <framebuffer_session/framebuffer_session.h>
/* Local */
#include "framebuffer.h"
using namespace Genode;
/***********************************************
** Implementation of the framebuffer service **
***********************************************/
/*
* Screen configuration
*
* FIXME currently it's 640x480@16 and not configurable
*/
static int scr_width = 640, scr_height = 480, scr_mode = 16;
namespace Framebuffer {
class Session_component : public Genode::Rpc_object<Session>
{
public:
Dataspace_capability dataspace() { return Framebuffer_drv::hw_framebuffer(); }
void release() { }
Mode mode() const
{
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)
{
#if 0
/* clip refresh area to screen boundaries */
int x1 = max(x, 0);
int y1 = max(y, 0);
int x2 = min(x + w - 1, scr_width - 1);
int y2 = min(y + h - 1, scr_height - 1);
if (x1 > x2 || y1 > y2) return;
/* copy pixels from shared dataspace to sdl surface */
const int start_offset = bytes_per_pixel()*(y1*scr_width + x1);
const int line_len = bytes_per_pixel()*(x2 - x1 + 1);
const int pitch = bytes_per_pixel()*scr_width;
char *src = (char *)fb_ds_addr + start_offset;
char *dst = (char *)screen->pixels + start_offset;
for (int i = y1; i <= y2; i++, src += pitch, dst += pitch)
Genode::memcpy(dst, src, line_len);
/* flush pixels in sdl window */
SDL_UpdateRect(screen, x1, y1, x2 - x1 + 1, y2 - y1 + 1);
#endif
}
};
class Root : public Root_component<Session_component>
{
protected:
Session_component *_create_session(const char *args) {
return new (md_alloc()) Session_component(); }
public:
Root(Rpc_entrypoint *session_ep, Allocator *md_alloc)
: Root_component<Session_component>(session_ep, md_alloc) { }
};
}
int main(int argc, char **argv)
{
/* initialize server entry point */
enum { STACK_SIZE = 4096 };
static Cap_connection cap;
static Rpc_entrypoint ep(&cap, STACK_SIZE, "fb_ep");
/* init driver back-end */
if (Framebuffer_drv::init()) {
PERR("H/W driver init failed");
return 3;
}
static Framebuffer::Root fb_root(&ep, env()->heap());
/* tell parent about the service */
env()->parent()->announce(ep.manage(&fb_root));
/* main's done - go to sleep */
sleep_forever();
return 0;
}

View File

@ -1,4 +0,0 @@
TARGET = framebuffer_ux_drv
REQUIRES = fiasco x86
SRC_CC = main.cc framebuffer.cc
LIBS = base