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

mmskms.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 MMSKMS_H_
00034 #define MMSKMS_H_
00035 
00036 #ifdef __HAVE_KMS__
00037 
00038 #include <xf86drm.h>
00039 #include <xf86drmMode.h>
00040 #include <gbm.h>
00041 extern "C" {
00042 #include <omap_drmif.h>
00043 }
00044 
00045 #define MMSKMS_MAX_LAYERS   2
00046 
00047 typedef struct {
00048     struct gbm_device *dev;
00049     struct gbm_surface *surface;
00050 } GBM;
00051 
00052 typedef struct {
00053     int fd;
00054     drmModeModeInfo *mode;
00055     unsigned int crtc_id;
00056     unsigned int connector_id;
00057     unsigned int plane_id;
00058 
00059     int width;
00060     int height;
00061 
00062     struct gbm_device *dev;
00063     struct gbm_surface *surface;
00064     struct omap_device *o_dev;
00065 
00066 } DRM;
00067 
00068 typedef struct {
00069     struct gbm_bo *bo;
00070 //  struct omap_bo *bo;
00071     unsigned int fb_id;
00072 } DRM_FB;
00073 
00074 #include "mmsgui/fb/mmsfbbase.h"
00075 
00076 class MMSKms {
00077     private:
00078         //! is initialized?
00079         bool    isinitialized;
00080 
00081         //! virtual framebuffer address
00082         void    *framebuffer_base;
00083         uint32_t stride;
00084 
00085         typedef struct {
00086             //! is initialized?
00087             bool    isinitialized;
00088             //! width of the layer
00089             int width;
00090             //! height of the layer
00091             int height;
00092             //! describes the surface buffers
00093             MMSFBSurfacePlanesBuffer buffers;
00094             //! pixelformat of the layer
00095             MMSFBSurfacePixelFormat pixelformat;
00096         } MMSKMS_LAYER;
00097 
00098         //! layer infos
00099         MMSKMS_LAYER layers[MMSKMS_MAX_LAYERS];
00100 
00101         //! number of layers
00102         int layers_cnt;
00103 
00104         //! id of the active screen (this is for fbs != vesa)
00105         int active_screen;
00106 
00107         MMSFBOutputType outputtype;
00108 
00109         struct gbm_bo *bo;
00110         struct omap_bo *o_bo;
00111 
00112         DRM     drm;
00113         DRM_FB *fb;
00114 
00115         drmEventContext evctx;
00116 
00117         bool rotate180;
00118 
00119         bool init_drm();
00120         bool init_gbm();
00121         DRM_FB* drm_fb_get_from_bo(struct gbm_bo *bo);
00122         bool init_omap();
00123 
00124         void dump_prop(uint32_t prop_id, uint64_t value);
00125         void dump_blob(uint32_t blob_id);
00126 
00127         void genFBPixelFormat(MMSFBSurfacePixelFormat pf, unsigned int *nonstd_format, MMSFBPixelDef *pixeldef);
00128 
00129     public:
00130         MMSKms();
00131         virtual ~MMSKms();
00132 
00133         virtual bool openDevice(MMSFBOutputType outputtype);
00134         virtual void closeDevice();
00135         bool isInitialized();
00136 
00137         virtual bool panDisplay(int buffer_id, void *framebuffer_base = NULL);
00138 
00139         virtual bool testLayer(int layer_id);
00140         virtual bool initLayer(int layer_id, int width, int height, MMSFBSurfacePixelFormat pixelformat, int backbuffer = 0);
00141 
00142         virtual bool releaseLayer(int layer_id);
00143         virtual bool restoreLayer(int layer_id);
00144 
00145         bool getPixelFormat(int layer_id, MMSFBSurfacePixelFormat *pf);
00146         bool getFrameBufferPtr(int layer_id, MMSFBSurfacePlanesBuffer buffers, int *width, int *height);
00147 
00148         DRM *getDrm();
00149         void pageFlip();
00150 
00151         sigc::signal<bool, MMSFBSurfacePixelFormat, unsigned int*, MMSFBPixelDef*>::accumulated<neg_bool_accumulator> onGenFBPixelFormat;
00152 
00153     private:
00154 
00155         friend class MMSInputLISHandler;
00156 
00157 };
00158 
00159 #endif
00160 
00161 #endif /* MMSKMS_H_ */

Generated by doxygen