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