1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * Copyright © 2002 David Dawes 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * Permission is hereby granted, free of charge, to any person obtaining a 5*4882a593Smuzhiyun * copy of this software and associated documentation files (the "Software"), 6*4882a593Smuzhiyun * to deal in the Software without restriction, including without limitation 7*4882a593Smuzhiyun * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8*4882a593Smuzhiyun * and/or sell copies of the Software, and to permit persons to whom the 9*4882a593Smuzhiyun * Software is furnished to do so, subject to the following conditions: 10*4882a593Smuzhiyun * 11*4882a593Smuzhiyun * The above copyright notice and this permission notice shall be included in 12*4882a593Smuzhiyun * all copies or substantial portions of the Software. 13*4882a593Smuzhiyun * 14*4882a593Smuzhiyun * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15*4882a593Smuzhiyun * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16*4882a593Smuzhiyun * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17*4882a593Smuzhiyun * THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18*4882a593Smuzhiyun * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 19*4882a593Smuzhiyun * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20*4882a593Smuzhiyun * SOFTWARE. 21*4882a593Smuzhiyun * 22*4882a593Smuzhiyun * Except as contained in this notice, the name of the author(s) shall 23*4882a593Smuzhiyun * not be used in advertising or otherwise to promote the sale, use or other 24*4882a593Smuzhiyun * dealings in this Software without prior written authorization from 25*4882a593Smuzhiyun * the author(s). 26*4882a593Smuzhiyun * 27*4882a593Smuzhiyun * Authors: David Dawes <dawes@xfree86.org> 28*4882a593Smuzhiyun * 29*4882a593Smuzhiyun */ 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun #ifndef _VBE_MODES_H 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun /* 34*4882a593Smuzhiyun * This is intended to be stored in the DisplayModeRec's private area. 35*4882a593Smuzhiyun * It includes all the information necessary to VBE information. 36*4882a593Smuzhiyun */ 37*4882a593Smuzhiyun typedef struct _VbeModeInfoData { 38*4882a593Smuzhiyun int mode; 39*4882a593Smuzhiyun VbeModeInfoBlock *data; 40*4882a593Smuzhiyun VbeCRTCInfoBlock *block; 41*4882a593Smuzhiyun } VbeModeInfoData; 42*4882a593Smuzhiyun 43*4882a593Smuzhiyun #define V_DEPTH_1 0x001 44*4882a593Smuzhiyun #define V_DEPTH_4 0x002 45*4882a593Smuzhiyun #define V_DEPTH_8 0x004 46*4882a593Smuzhiyun #define V_DEPTH_15 0x008 47*4882a593Smuzhiyun #define V_DEPTH_16 0x010 48*4882a593Smuzhiyun #define V_DEPTH_24_24 0x020 49*4882a593Smuzhiyun #define V_DEPTH_24_32 0x040 50*4882a593Smuzhiyun #define V_DEPTH_24 (V_DEPTH_24_24 | V_DEPTH_24_32) 51*4882a593Smuzhiyun #define V_DEPTH_30 0x080 52*4882a593Smuzhiyun #define V_DEPTH_32 0x100 53*4882a593Smuzhiyun 54*4882a593Smuzhiyun #define VBE_MODE_SUPPORTED(m) (((m)->ModeAttributes & 0x01) != 0) 55*4882a593Smuzhiyun #define VBE_MODE_COLOR(m) (((m)->ModeAttributes & 0x08) != 0) 56*4882a593Smuzhiyun #define VBE_MODE_GRAPHICS(m) (((m)->ModeAttributes & 0x10) != 0) 57*4882a593Smuzhiyun #define VBE_MODE_VGA(m) (((m)->ModeAttributes & 0x40) == 0) 58*4882a593Smuzhiyun #define VBE_MODE_LINEAR(m) (((m)->ModeAttributes & 0x80) != 0 && \ 59*4882a593Smuzhiyun ((m)->PhysBasePtr != 0)) 60*4882a593Smuzhiyun 61*4882a593Smuzhiyun #define VBE_MODE_USABLE(m, f) (VBE_MODE_SUPPORTED(m) || \ 62*4882a593Smuzhiyun (f & V_MODETYPE_BAD)) && \ 63*4882a593Smuzhiyun VBE_MODE_GRAPHICS(m) && \ 64*4882a593Smuzhiyun (VBE_MODE_VGA(m) || VBE_MODE_LINEAR(m)) 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun #define V_MODETYPE_VBE 0x01 67*4882a593Smuzhiyun #define V_MODETYPE_VGA 0x02 68*4882a593Smuzhiyun #define V_MODETYPE_BAD 0x04 69*4882a593Smuzhiyun 70*4882a593Smuzhiyun extern _X_EXPORT int VBEFindSupportedDepths(vbeInfoPtr pVbe, VbeInfoBlock * vbe, 71*4882a593Smuzhiyun int *flags24, int modeTypes); 72*4882a593Smuzhiyun extern _X_EXPORT DisplayModePtr VBEGetModePool(ScrnInfoPtr pScrn, 73*4882a593Smuzhiyun vbeInfoPtr pVbe, 74*4882a593Smuzhiyun VbeInfoBlock * vbe, 75*4882a593Smuzhiyun int modeTypes); 76*4882a593Smuzhiyun extern _X_EXPORT void VBESetModeNames(DisplayModePtr pMode); 77*4882a593Smuzhiyun extern _X_EXPORT void VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe); 78*4882a593Smuzhiyun 79*4882a593Smuzhiyun /* 80*4882a593Smuzhiyun * Note: These are alternatives to the standard helpers. They should 81*4882a593Smuzhiyun * usually just wrap the standard helpers. 82*4882a593Smuzhiyun */ 83*4882a593Smuzhiyun extern _X_EXPORT int VBEValidateModes(ScrnInfoPtr scrp, 84*4882a593Smuzhiyun DisplayModePtr availModes, 85*4882a593Smuzhiyun const char **modeNames, 86*4882a593Smuzhiyun ClockRangePtr clockRanges, 87*4882a593Smuzhiyun int *linePitches, int minPitch, 88*4882a593Smuzhiyun int maxPitch, int pitchInc, int minHeight, 89*4882a593Smuzhiyun int maxHeight, int virtualX, int virtualY, 90*4882a593Smuzhiyun int apertureSize, 91*4882a593Smuzhiyun LookupModeFlags strategy); 92*4882a593Smuzhiyun extern _X_EXPORT void VBEPrintModes(ScrnInfoPtr scrp); 93*4882a593Smuzhiyun 94*4882a593Smuzhiyun #endif /* VBE_MODES_H */ 95