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