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