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