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)
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.
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.
22 #include <l4/sys/capability>
23 #include <l4/re/dataspace>
24 #include <l4/re/video/colors>
25 #include <l4/re/video/view>
27 namespace L4Re { namespace Video {
30 * \defgroup api_l4re_goos Goos video API
37 * \ingroup api_l4re_goos
39 class L4_EXPORT Goos :
40 public L4::Kobject_t<Goos, L4::Kobject, L4Re::Protocol::Goos>
42 L4_KOBJECT_DISABLE_COPY(Goos)
45 /** Flags for a goos */
48 F_auto_refresh = 0x01, ///< The graphics display is automatically refreshed
49 F_pointer = 0x02, ///< We have a mouse pointer
50 F_dynamic_views = 0x04, ///< Supports dynamically allocated views
51 F_dynamic_buffers = 0x08, ///< Supports dynamically allocated buffers
54 /** Information structure of a goos */
57 unsigned long width; ///< Width
58 unsigned long height; ///< Height
59 unsigned flags; ///< Flags, see \a Flags
60 unsigned num_static_views; ///< Number of static view
61 unsigned num_static_buffers; ///< Number of static buffers
62 Pixel_info pixel_info; ///< Pixel information
64 /** Return whether this goos does auto refreshing or the view refresh
65 * functions must be used to make changes visible. */
66 bool auto_refresh() const { return flags & F_auto_refresh; }
67 /** Return whether a pointer is used by the provider of the goos */
68 bool has_pointer() const { return flags & F_pointer; }
69 /** Return whether dynamic view are supported */
70 bool has_dynamic_views() const { return flags & F_dynamic_views; }
71 /** Return whether dynamic buffers are supported */
72 bool has_dynamic_buffers() const { return flags & F_dynamic_buffers; }
76 * \brief Return the goos information of the goos.
77 * \retval info Goos information structure pointer.
78 * \return 0 on success, error otherwise
80 int info(Info *) const throw();
83 * \brief Return a static buffer of a goos.
84 * \param idx Index of the static buffer.
85 * \param rbuf Capability slot to point the buffer dataspace to.
86 * \return 0 on success, error otherwise
88 int get_static_buffer(unsigned idx, L4::Cap<L4Re::Dataspace> rbuf) const throw();
91 * \brief Create a buffer.
92 * \param size Size of buffer in bytes.
93 * \param rbuf Capability slot to point the buffer dataspace to.
94 * \return Positive: buffer index, negative: Error code
96 int create_buffer(unsigned long size, L4::Cap<L4Re::Dataspace> rbuf) const throw();
99 * \brief Delete a buffer.
100 * \param idx Buffer to delete.
101 * \return 0 on success, error otherwise
103 int delete_buffer(unsigned idx) const throw();
106 * \brief Create a view.
107 * \retval view A view object.
108 * \return Positive: view index, negative: Error code
110 int create_view(View *view) const throw();
113 * \brief Delete a view.
114 * \param v The view object to delete.
115 * \return 0 on success, error otherwise
117 int delete_view(View const &v) const throw();
120 * \brief Return a view.
121 * \param index Index of the view to return.
124 View view(unsigned index) const throw();
128 Goos::view(unsigned index) const throw()
129 { return View(cap(), index); }