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

mmsfbdevmatrox.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 MMSFBDEVMATROX_H_
00034 #define MMSFBDEVMATROX_H_
00035 
00036 #ifdef __HAVE_FBDEV__
00037 
00038 #include "mmsgui/fb/mmsfbdev.h"
00039 
00040 // matrox registers & flags needed to enable TVOut layer 2
00041 // we do only support g450/g550!
00042 #define C2CTRL                      0x3C10
00043 #define C2CTRL_C2EN                 0x00000001
00044 #define C2CTRL_C2PIXCLKSEL_CRISTAL  0x00004002
00045 #define C2CTRL_C2PIXCLKDIS          0x00000008
00046 #define C2CTRL_C2DEPTH_YCBCR420     0x00E00000
00047 #define C2CTRL_C2INTERLACE          0x02000000
00048 
00049 #define C2HPARAM                    0x3C14
00050 #define C2HSYNC                     0x3C18
00051 #define C2VPARAM                    0x3C1C
00052 #define C2VSYNC                     0x3C20
00053 #define C2PRELOAD                   0x3C24
00054 #define C2PLANE1START0              0x3C28
00055 #define C2PLANE1START1              0x3C2C
00056 #define C2PLANE2START0              0x3C30
00057 #define C2PLANE2START1              0x3C34
00058 #define C2PLANE3START0              0x3C38
00059 #define C2PLANE3START1              0x3C3C
00060 #define C2OFFSET                    0x3C40
00061 
00062 #define C2MISC                      0x3C44
00063 #define C2VCOUNT                    0x3C48
00064 #define C2DATACTRL                  0x3C4C
00065 #define C2DATACTRL_C2NTSCEN         0x00000010
00066 
00067 #define DAC_INDEX                   0x3C00
00068 #define DAC_DATA                    0x3C0A
00069 
00070 #define XGENIOCTRL                  0x2A
00071 #define XGENIODATA                  0x2B
00072 
00073 #define XDISPCTRL                   0x8A
00074 #define XDISPCTRL_DAC2OUTSEL_DIS    0x00
00075 #define XDISPCTRL_DAC2OUTSEL_TVE    0x0C
00076 #define XDISPCTRL_DAC2OUTSEL_MASK   0x0C
00077 
00078 #define XSYNCCTRL                   0x8B
00079 #define XSYNCCTRL_DAC2HSOFF         0x10
00080 #define XSYNCCTRL_DAC2VSOFF         0x20
00081 #define XSYNCCTRL_DAC2HSPOL         0x40
00082 #define XSYNCCTRL_DAC2VSPOL         0x80
00083 
00084 #define XPWRCTRL                    0xA0
00085 #define XPWRCTRL_DAC2PDN            0x01
00086 #define XPWRCTRL_CFIFOPDN           0x10
00087 
00088 
00089 #define mga_out8(mmioaddr, val, reg) *((volatile unsigned char*)(((volatile unsigned char *)mmioaddr) + reg)) = val;
00090 
00091 #define mga_out32(mmioaddr, val, reg) *((volatile unsigned int*)(((volatile unsigned char *)mmioaddr) + reg)) = val;
00092 
00093 #define mga_in8(mmioaddr, reg) *((volatile unsigned char*)(((volatile unsigned char*)mmioaddr)+reg))
00094 
00095 #define mga_in32(mmioaddr, reg) *((volatile unsigned int*)(((volatile unsigned char*)mmioaddr)+reg))
00096 
00097 #define mga_out_dac(mmioaddr, val, reg) \
00098     mga_out8(mmioaddr, reg, DAC_INDEX); \
00099     mga_out8(mmioaddr, val, DAC_DATA);
00100 
00101 #define mga_in_dac(mmioaddr, reg) \
00102     mga_out8(mmioaddr, reg, DAC_INDEX); \
00103     mga_in8(mmioaddr, DAC_DATA)
00104 
00105 #define maven_out8(mmioaddr, val, reg) \
00106     mga_out_dac(mmioaddr, reg, 0x87); \
00107     mga_out_dac(mmioaddr, val, 0x88);
00108 
00109 
00110 
00111 class MMSFBDevMatrox : public MMSFBDev {
00112     private:
00113         bool scart_rgb_cable;
00114         bool tv_std_pal;
00115 
00116         unsigned char *mmio_base;
00117 
00118         // crtc2 registers
00119         struct {
00120             unsigned int c2ctrl;
00121             unsigned int c2datactrl;
00122             unsigned int c2misc;
00123             unsigned int c2offset;
00124             unsigned int c2hparam;
00125             unsigned int c2vparam;
00126             unsigned int c2_plane1_start0;
00127             unsigned int c2_plane1_start1;
00128             unsigned int c2_plane2_start0;
00129             unsigned int c2_plane2_start1;
00130             unsigned int c2_plane3_start0;
00131             unsigned int c2_plane3_start1;
00132         } crtc2_regs;
00133 
00134 
00135         void buildCRTC2Regs();
00136         void setCRTC2Regs();
00137 
00138         void buildCRTC2Buffer();
00139         void setCRTC2Buffer();
00140 
00141         void switchCRTC2(bool on);
00142         bool enableCRTC2();
00143         bool disableCRTC2();
00144 
00145         void setMavenRegs();
00146         void enableMaven();
00147         void disableMaven();
00148 
00149     public:
00150         MMSFBDevMatrox();
00151         virtual ~MMSFBDevMatrox();
00152 
00153         bool openDevice(char *device_file = NULL, int console = MMSFBDEV_QUERY_CONSOLE);
00154         void closeDevice();
00155 
00156         bool waitForVSync();
00157 
00158         bool testLayer(int layer_id);
00159         bool initLayer(int layer_id, int width, int height, MMSFBSurfacePixelFormat pixelformat, int backbuffer = 0);
00160 
00161         bool releaseLayer(int layer_id);
00162         bool restoreLayer(int layer_id);
00163 };
00164 
00165 #endif
00166 
00167 #endif /* MMSFBDEVMATROX_H_ */

Generated by doxygen