]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re/util/include/video/goos_fb
update
[l4.git] / l4 / pkg / l4re / util / include / video / goos_fb
1 // vi:ft=cpp:
2 /*
3  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
4  *               Alexander Warg <warg@os.inf.tu-dresden.de>
5  *     economic rights: Technische Universität Dresden (Germany)
6  *
7  * This file is part of TUD:OS and distributed under the terms of the
8  * GNU General Public License 2.
9  * Please see the COPYING-GPL-2 file for details.
10  *
11  * As a special exception, you may use this file as part of a free software
12  * library without restriction.  Specifically, if other files instantiate
13  * templates or use macros or inline functions from this file, or you compile
14  * this file and link it with other files to produce an executable, this
15  * file does not by itself cause the resulting executable to be covered by
16  * the GNU General Public License.  This exception does not however
17  * invalidate any other reasons why the executable file might be covered by
18  * the GNU General Public License.
19  */
20 #pragma once
21
22 #include <l4/re/video/goos>
23
24 namespace L4Re { namespace Util { namespace Video {
25
26 class Goos_fb
27 {
28 private:
29   L4::Cap<L4Re::Video::Goos> _goos;
30   L4Re::Video::View _view;
31   L4::Cap<L4Re::Dataspace> _buffer;
32
33   enum Flags
34   {
35     F_dyn_buffer = 0x01,
36     F_dyn_view   = 0x02,
37     F_dyn_goos   = 0x04,
38   };
39   unsigned _flags;
40
41   unsigned _buffer_index;
42
43 private:
44   void init();
45
46   Goos_fb(Goos_fb const &);
47   void operator = (Goos_fb const &);
48
49 public:
50   Goos_fb() : _goos(L4_INVALID_CAP), _buffer(L4_INVALID_CAP), _flags(0) {}
51
52   explicit Goos_fb(L4::Cap<L4Re::Video::Goos> goos);
53   explicit Goos_fb(char const *name);
54
55   void setup(L4::Cap<L4Re::Video::Goos> goos);
56   void setup(char const *name);
57
58   ~Goos_fb();
59
60   int view_info(L4Re::Video::View::Info *info)
61   { return _view.info(info); }
62
63   L4Re::Video::View const *view() const { return &_view; }
64   L4Re::Video::View *view() { return &_view; }
65
66   L4::Cap<L4Re::Dataspace> buffer() const { return _buffer; }
67   void *attach_buffer();
68
69   int refresh(int x, int y, int w, int h)
70   { return _view.refresh(x, y, w, h); }
71
72   L4::Cap<L4Re::Video::Goos> goos() const { return _goos; }
73 };
74 }}}