00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
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
00071 unsigned int fb_id;
00072 } DRM_FB;
00073
00074 #include "mmsgui/fb/mmsfbbase.h"
00075
00076 class MMSKms {
00077 private:
00078
00079 bool isinitialized;
00080
00081
00082 void *framebuffer_base;
00083 uint32_t stride;
00084
00085 typedef struct {
00086
00087 bool isinitialized;
00088
00089 int width;
00090
00091 int height;
00092
00093 MMSFBSurfacePlanesBuffer buffers;
00094
00095 MMSFBSurfacePixelFormat pixelformat;
00096 } MMSKMS_LAYER;
00097
00098
00099 MMSKMS_LAYER layers[MMSKMS_MAX_LAYERS];
00100
00101
00102 int layers_cnt;
00103
00104
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