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