cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync/*
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * Copyright © 2002 David Dawes
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync *
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * Permission is hereby granted, free of charge, to any person obtaining a
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * copy of this software and associated documentation files (the "Software"),
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * to deal in the Software without restriction, including without limitation
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * and/or sell copies of the Software, and to permit persons to whom the
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * Software is furnished to do so, subject to the following conditions:
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync *
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * The above copyright notice and this permission notice shall be included in
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * all copies or substantial portions of the Software.
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync *
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * SOFTWARE.
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync *
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * Except as contained in this notice, the name of the author(s) shall
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * not be used in advertising or otherwise to promote the sale, use or other
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * dealings in this Software without prior written authorization from
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * the author(s).
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync *
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * Authors: David Dawes <dawes@xfree86.org>
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync *
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync */
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#ifndef _VBE_MODES_H
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync/*
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * This is intended to be stored in the DisplayModeRec's private area.
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * It includes all the information necessary to VBE information.
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync */
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsynctypedef struct _VbeModeInfoData {
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync int mode;
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync VbeModeInfoBlock *data;
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync VbeCRTCInfoBlock *block;
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync} VbeModeInfoData;
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define V_DEPTH_1 0x001
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define V_DEPTH_4 0x002
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define V_DEPTH_8 0x004
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define V_DEPTH_15 0x008
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define V_DEPTH_16 0x010
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define V_DEPTH_24_24 0x020
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define V_DEPTH_24_32 0x040
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define V_DEPTH_24 (V_DEPTH_24_24 | V_DEPTH_24_32)
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define V_DEPTH_30 0x080
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define V_DEPTH_32 0x100
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define VBE_MODE_SUPPORTED(m) (((m)->ModeAttributes & 0x01) != 0)
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define VBE_MODE_COLOR(m) (((m)->ModeAttributes & 0x08) != 0)
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define VBE_MODE_GRAPHICS(m) (((m)->ModeAttributes & 0x10) != 0)
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define VBE_MODE_VGA(m) (((m)->ModeAttributes & 0x40) == 0)
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define VBE_MODE_LINEAR(m) (((m)->ModeAttributes & 0x80) != 0 && \
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync ((m)->PhysBasePtr != 0))
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define VBE_MODE_USABLE(m, f) (VBE_MODE_SUPPORTED(m) || \
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync (f & V_MODETYPE_BAD)) && \
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync VBE_MODE_GRAPHICS(m) && \
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync (VBE_MODE_VGA(m) || VBE_MODE_LINEAR(m))
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define V_MODETYPE_VBE 0x01
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define V_MODETYPE_VGA 0x02
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#define V_MODETYPE_BAD 0x04
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsyncextern _X_EXPORT int VBEFindSupportedDepths(vbeInfoPtr pVbe, VbeInfoBlock *vbe,
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync int *flags24, int modeTypes);
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsyncextern _X_EXPORT DisplayModePtr VBEGetModePool(ScrnInfoPtr pScrn, vbeInfoPtr pVbe,
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync VbeInfoBlock *vbe, int modeTypes);
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsyncextern _X_EXPORT void VBESetModeNames(DisplayModePtr pMode);
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsyncextern _X_EXPORT void VBESetModeParameters(ScrnInfoPtr pScrn, vbeInfoPtr pVbe);
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync/*
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * Note: These are alternatives to the standard helpers. They should
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync * usually just wrap the standard helpers.
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync */
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsyncextern _X_EXPORT int VBEValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync char **modeNames, ClockRangePtr clockRanges,
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync int *linePitches, int minPitch, int maxPitch,
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync int pitchInc, int minHeight, int maxHeight,
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync int virtualX, int virtualY, int apertureSize,
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync LookupModeFlags strategy);
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsyncextern _X_EXPORT void VBEPrintModes(ScrnInfoPtr scrp);
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync
cabde247f900dcf6e58d009bbdd15099c028c6fcvboxsync#endif /* VBE_MODES_H */