// vi:ft=cpp: /* * (c) 2008-2009 Adam Lackorzynski , * Alexander Warg * economic rights: Technische Universität Dresden (Germany) * * This file is part of TUD:OS and distributed under the terms of the * GNU General Public License 2. * Please see the COPYING-GPL-2 file for details. * * As a special exception, you may use this file as part of a free software * library without restriction. Specifically, if other files instantiate * templates or use macros or inline functions from this file, or you compile * this file and link it with other files to produce an executable, this * file does not by itself cause the resulting executable to be covered by * the GNU General Public License. This exception does not however * invalidate any other reasons why the executable file might be covered by * the GNU General Public License. */ #pragma once #include #include #include #include namespace L4Re { namespace Video { /** * \defgroup api_l4re_goos Goos video API * \ingroup api_l4re */ /** * \brief A goos. * \ingroup api_l4re_goos */ class L4_EXPORT Goos : public L4::Kobject_t { L4_KOBJECT_DISABLE_COPY(Goos) public: /** Flags for a goos */ enum Flags { F_auto_refresh = 0x01, ///< The graphics display is automatically refreshed F_pointer = 0x02, ///< We have a mouse pointer F_dynamic_views = 0x04, ///< Supports dynamically allocated views F_dynamic_buffers = 0x08, ///< Supports dynamically allocated buffers }; /** Information structure of a goos */ struct Info { unsigned long width; ///< Width unsigned long height; ///< Height unsigned flags; ///< Flags, see \a Flags unsigned num_static_views; ///< Number of static view unsigned num_static_buffers; ///< Number of static buffers Pixel_info pixel_info; ///< Pixel information /** Return whether this goos does auto refreshing or the view refresh * functions must be used to make changes visible. */ bool auto_refresh() const { return flags & F_auto_refresh; } /** Return whether a pointer is used by the provider of the goos */ bool has_pointer() const { return flags & F_pointer; } /** Return whether dynamic view are supported */ bool has_dynamic_views() const { return flags & F_dynamic_views; } /** Return whether dynamic buffers are supported */ bool has_dynamic_buffers() const { return flags & F_dynamic_buffers; } }; /** * \brief Return the goos information of the goos. * \retval info Goos information structure pointer. * \return 0 on success, error otherwise */ int info(Info *) const throw(); /** * \brief Return a static buffer of a goos. * \param idx Index of the static buffer. * \param rbuf Capability slot to point the buffer dataspace to. * \return 0 on success, error otherwise */ int get_static_buffer(unsigned idx, L4::Cap rbuf) const throw(); /** * \brief Create a buffer. * \param size Size of buffer in bytes. * \param rbuf Capability slot to point the buffer dataspace to. * \return Positive: buffer index, negative: Error code */ int create_buffer(unsigned long size, L4::Cap rbuf) const throw(); /** * \brief Delete a buffer. * \param idx Buffer to delete. * \return 0 on success, error otherwise */ int delete_buffer(unsigned idx) const throw(); /** * \brief Create a view. * \retval view A view object. * \return Positive: view index, negative: Error code */ int create_view(View *view) const throw(); /** * \brief Delete a view. * \param v The view object to delete. * \return 0 on success, error otherwise */ int delete_view(View const &v) const throw(); /** * \brief Return a view. * \param index Index of the view to return. * \return The view. */ View view(unsigned index) const throw(); /** * \brief Trigger refreshing of the given area on the virtual screen. */ int refresh(int x, int y, int w, int h) throw(); }; inline View Goos::view(unsigned index) const throw() { return View(cap(), index); } }}