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