]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/fb-drv/server/src/vesa.cc
510bed75a8b4143fc3c7ef198c825306c4c60aca
[l4.git] / l4 / pkg / fb-drv / server / src / vesa.cc
1 /*
2  * (c) 2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
3  *          Alexander Warg <warg@os.inf.tu-dresden.de>
4  *     economic rights: Technische Universität Dresden (Germany)
5  *
6  * This file is part of TUD:OS and distributed under the terms of the
7  * GNU General Public License 2.
8  * Please see the COPYING-GPL-2 file for details.
9  */
10
11 #include <l4/x86emu/int10.h>
12 #include <l4/io/io.h>
13 #include <cstdio>
14
15 #include "fb.h"
16 #include "splash.h"
17
18 bool
19 Vesa_fb::setup_drv(Prog_args *pa)
20 {
21   l4util_mb_vbe_ctrl_t *vbe;
22   l4util_mb_vbe_mode_t *vbi;
23
24   if (x86emu_int10_set_vbemode(pa->vbemode, &vbe, &vbi))
25     return false;
26
27   _vidmem_size = 64*1024*vbe->total_memory;
28
29   _vidmem_start = 0;
30   int error;
31   if ((error = l4io_request_iomem(vbi->phys_base, _vidmem_size,
32                                   0, &_vidmem_start)) < 0)
33     printf("map of gfx mem failed\n");
34
35   _vidmem_end   = _vidmem_start + _vidmem_size;
36
37   _screen_info.width = vbi->x_resolution;
38   _screen_info.height = vbi->y_resolution;
39   _screen_info.flags = L4Re::Video::Goos::F_auto_refresh;
40   _screen_info.pixel_info = L4Re::Video::Pixel_info(vbi);
41
42   _view_info.buffer_offset = 0; //base_offset;
43   _view_info.bytes_per_line = vbi->bytes_per_scanline;
44
45   init_infos();
46
47   printf("Framebuffer memory: phys: %x - %lx\n",
48          vbi->phys_base, vbi->phys_base + _vidmem_size);
49   printf("                    virt: %lx - %lx\n",
50          _vidmem_start, _vidmem_start + _vidmem_size);
51
52   x86emu_int10_done();
53
54   splash_display(&_screen_info, _vidmem_start);
55
56   return true;
57 }