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