Logo
  • Main Page
  • Related Pages
  • Modules
  • Classes
  • Files

mmsfb.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005-2007 Stefan Schwarzer, Jens Schneider,             *
00003  *                           Matthias Hardt, Guido Madaus                  *
00004  *                                                                         *
00005  *   Copyright (C) 2007-2008 BerLinux Solutions GbR                        *
00006  *                           Stefan Schwarzer & Guido Madaus               *
00007  *                                                                         *
00008  *   Copyright (C) 2009-2013 BerLinux Solutions GmbH                       *
00009  *                                                                         *
00010  *   Authors:                                                              *
00011  *      Stefan Schwarzer   <stefan.schwarzer@diskohq.org>,                 *
00012  *      Matthias Hardt     <matthias.hardt@diskohq.org>,                   *
00013  *      Jens Schneider     <jens.schneider@diskohq.org>,                   *
00014  *      Guido Madaus       <guido.madaus@diskohq.org>,                     *
00015  *      Patrick Helterhoff <patrick.helterhoff@diskohq.org>,               *
00016  *      René Bählkow       <rene.baehlkow@diskohq.org>                     *
00017  *                                                                         *
00018  *   This library is free software; you can redistribute it and/or         *
00019  *   modify it under the terms of the GNU Lesser General Public            *
00020  *   License version 2.1 as published by the Free Software Foundation.     *
00021  *                                                                         *
00022  *   This library is distributed in the hope that it will be useful,       *
00023  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00024  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00025  *   Lesser General Public License for more details.                       *
00026  *                                                                         *
00027  *   You should have received a copy of the GNU Lesser General Public      *
00028  *   License along with this library; if not, write to the                 *
00029  *   Free Software Foundation, Inc.,                                       *
00030  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
00031  **************************************************************************/
00032 
00033 #ifndef MMSFB_H_
00034 #define MMSFB_H_
00035 
00036 #include "mmstools/mmstypes.h"
00037 #include "mmstools/mmslogger.h"
00038 
00039 #include "mmsgui/fb/mmsfbdev.h"
00040 #include "mmsgui/fb/mmskms.h"
00041 #include "mmsgui/fb/mmsfbdevmatrox.h"
00042 #include "mmsgui/fb/mmsfbdevdavinci.h"
00043 #include "mmsgui/fb/mmsfbdevomap.h"
00044 #include "mmsgui/fb/mmsfblayer.h"
00045 #include "mmsgui/fb/mmsfbwindowmanager.h"
00046 #include "mmsgui/fb/mmsfbfont.h"
00047 #include "mmsgui/fb/mmsfbbackendinterface.h"
00048 
00049 #ifdef __HAVE_OPENGL__
00050 #define LOCK_OGL(fbo)   { mmsfb->lock(); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); glDisable(GL_SCISSOR_TEST); }
00051 #define UNLOCK_OGL      { glDisable(GL_SCISSOR_TEST); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); mmsfb->unlock(); }
00052 #endif
00053 
00054 #define MMSFBLAYER_MAXNUM 32
00055 
00056 //! The lowest layer to the backends like DFB, X11(XSHM/XVSHM) or FBDEV.
00057 /*!
00058 \author Jens Schneider
00059 */
00060 class MMSFB {
00061     private:
00062         int              argc;       /* commandline arguments */
00063         char             **argv;
00064         string           applname;
00065         string           appliconname;
00066         bool             hidden;
00067         MMSFBPointerMode pointer;
00068 
00069         //! name of binary
00070         string           bin;
00071 
00072         //! is initialized?
00073         bool initialized;
00074 
00075         MMSFBFullScreenMode fullscreen;
00076 
00077 #ifdef  __HAVE_DIRECTFB__
00078         // interface to dfb
00079         IDirectFB       *dfb;
00080 #endif
00081 
00082 #ifdef  __HAVE_FBDEV__
00083         // interface to own FB device
00084         MMSFBDev        *mmsfbdev;
00085 #endif
00086 
00087 #ifdef  __HAVE_KMS__
00088         // interface to own FB device
00089         MMSKms          *mmskms;
00090 #endif
00091 
00092 #ifdef __HAVE_XLIB__
00093         //! connection to the x-server
00094         Display         *x_display;
00095         int             x_screen;
00096         Window          x_window;
00097         Window          input_window;
00098         GC              x_gc;
00099         Visual          *x_visual;
00100         int             x_depth;
00101         MMSMutex        xlock;
00102         int             display_w;
00103         int             display_h;
00104         int             target_window_w;
00105         int             target_window_h;
00106         bool            resized;
00107         bool            resizeWindow();
00108         Window          x_windows[MMSFBLAYER_MAXNUM];
00109         XImage          *rootimage;
00110 #endif
00111 
00112 #ifdef __HAVE_XV__
00113         int         xv_port;
00114 #endif
00115 
00116 #ifdef __HAVE_OPENGL__
00117         // backend interface server needed for OPENGL
00118         MMSFBBackEndInterface   *bei;
00119 #endif
00120 
00121         MMSFBLayer      *layer[MMSFBLAYER_MAXNUM];
00122 
00123         MMSFBBackend    backend;
00124         MMSFBRectangle  x11_win_rect;
00125 
00126         //! to make it thread-safe
00127         MMSMutex        Lock;
00128 
00129     public:
00130         MMSFB();
00131         virtual ~MMSFB();
00132 
00133         bool init(int argc, char **argv, MMSFBBackend backend, MMSFBRectangle x11_win_rect,
00134                   bool extendedaccel, MMSFBFullScreenMode fullscreen, MMSFBPointerMode pointer,
00135                   string appl_name = "Disko Application", string appl_icon_name = "Disko Application", bool hidden=false);
00136         bool release();
00137         bool isInitialized();
00138 
00139         MMSFBBackend getBackend();
00140 
00141         bool lock();
00142         bool unlock();
00143 
00144         bool getLayer(int id, MMSFBLayer **layer, MMSFBOutputType outputtype, bool virtual_console);
00145         bool getLayer(int id, MMSFBLayer **layer);
00146 
00147         void *getX11Window();
00148         void *getX11Display();
00149         bool refresh();
00150 
00151         bool createSurface(MMSFBSurface **surface, int w, int h, MMSFBSurfacePixelFormat pixelformat, int backbuffer = 0, bool systemonly = false);
00152 
00153 #ifdef  __HAVE_DIRECTFB__
00154         bool createImageProvider(IDirectFBImageProvider **provider, string filename);
00155 #endif
00156         bool createFont(MMSFBFont **font, string filename, int width = 0, int height = 0);
00157 
00158 
00159         void realignLayer();
00160 
00161 #ifdef  __HAVE_KMS__
00162         // interface to own FB device
00163         MMSKms  *getKmsInterface();
00164 #endif
00165 
00166     friend class MMSFBLayer;
00167     friend class MMSFBSurface;
00168     friend class MMSFBFont;
00169     friend class MMSInputX11Handler;
00170     friend class MMSInputLISHandler;
00171     friend class MMSFBBuffer;
00172 };
00173 
00174 /* access to global mmsfb */
00175 extern MMSFB *mmsfb;
00176 
00177 #endif /*MMSFB_H_*/

Generated by doxygen