Annotation of ntddk/src/video/inc/ntddvdeo.h, revision 1.1.1.1

1.1       root        1: /*++ BUILD Version: 0001    // Increment this if a change has global effects
                      2: 
                      3: Copyright (c) 1990-1993  Microsoft Corporation
                      4: 
                      5: Module Name:
                      6: 
                      7:     ddvdeo.h
                      8: 
                      9: Abstract:
                     10: 
                     11:     This is the include file that defines all constants and types for
                     12:     accessing the Video device.
                     13: 
                     14: Author:
                     15: 
                     16:     Andre Vachon (andreva) 21-Jan-1992
                     17: 
                     18: Revision History:
                     19: 
                     20: --*/
                     21: 
                     22: //
                     23: // VideoIoControlFile InputBuffer/OutputBuffer record structures for
                     24: // this device.
                     25: //
                     26: 
                     27: //
                     28: // Name used to create the miniport logical device names
                     29: //
                     30: 
                     31: #define VIDEO_DEVICE_NAME "DISPLAY%d"
                     32: #define WVIDEO_DEVICE_NAME L"DISPLAY%d"
                     33: 
                     34: 
                     35: //
                     36: // The first set of IOCTLs are handle by the port driver and never seen
                     37: // by the miniport.
                     38: //
                     39: 
                     40: #define IOCTL_VIDEO_ENABLE_VDM \
                     41:     CTL_CODE(FILE_DEVICE_VIDEO, 0x00, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     42: #define IOCTL_VIDEO_DISABLE_VDM \
                     43:     CTL_CODE(FILE_DEVICE_VIDEO, 0x01, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     44: #define IOCTL_VIDEO_REGISTER_VDM \
                     45:     CTL_CODE(FILE_DEVICE_VIDEO, 0x02, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     46: 
                     47: 
                     48: //
                     49: // All these IOCTL's must be both handled by the port and miniport since
                     50: // they require processing by both parties.
                     51: //
                     52: #define IOCTL_VIDEO_SAVE_HARDWARE_STATE \
                     53:     CTL_CODE(FILE_DEVICE_VIDEO, 0x80, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     54: #define IOCTL_VIDEO_RESTORE_HARDWARE_STATE \
                     55:     CTL_CODE(FILE_DEVICE_VIDEO, 0x81, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     56: 
                     57: 
                     58: //
                     59: // All these IOCTL's are public and must/can be handled by the miniport
                     60: // driver
                     61: //
                     62: 
                     63: #define IOCTL_VIDEO_QUERY_AVAIL_MODES \
                     64:     CTL_CODE(FILE_DEVICE_VIDEO, 0x100, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     65: #define IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES \
                     66:     CTL_CODE(FILE_DEVICE_VIDEO, 0x101, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     67: #define IOCTL_VIDEO_QUERY_CURRENT_MODE \
                     68:     CTL_CODE(FILE_DEVICE_VIDEO, 0x102, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     69: #define IOCTL_VIDEO_SET_CURRENT_MODE \
                     70:     CTL_CODE(FILE_DEVICE_VIDEO, 0x103, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     71: #define IOCTL_VIDEO_RESET_DEVICE \
                     72:     CTL_CODE(FILE_DEVICE_VIDEO, 0x104, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     73: 
                     74: #define IOCTL_VIDEO_LOAD_AND_SET_FONT \
                     75:     CTL_CODE(FILE_DEVICE_VIDEO, 0x105, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     76: 
                     77: #define IOCTL_VIDEO_SET_PALETTE_REGISTERS \
                     78:     CTL_CODE(FILE_DEVICE_VIDEO, 0x106, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     79: #define IOCTL_VIDEO_SET_COLOR_REGISTERS \
                     80:     CTL_CODE(FILE_DEVICE_VIDEO, 0x107, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     81: 
                     82: #define IOCTL_VIDEO_ENABLE_CURSOR \
                     83:     CTL_CODE(FILE_DEVICE_VIDEO, 0x108, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     84: #define IOCTL_VIDEO_DISABLE_CURSOR \
                     85:     CTL_CODE(FILE_DEVICE_VIDEO, 0x109, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     86: #define IOCTL_VIDEO_SET_CURSOR_ATTR \
                     87:     CTL_CODE(FILE_DEVICE_VIDEO, 0x10a, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     88: #define IOCTL_VIDEO_QUERY_CURSOR_ATTR \
                     89:     CTL_CODE(FILE_DEVICE_VIDEO, 0x10b, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     90: #define IOCTL_VIDEO_SET_CURSOR_POSITION \
                     91:     CTL_CODE(FILE_DEVICE_VIDEO, 0x10c, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     92: #define IOCTL_VIDEO_QUERY_CURSOR_POSITION \
                     93:     CTL_CODE(FILE_DEVICE_VIDEO, 0x10d, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     94: 
                     95: #define IOCTL_VIDEO_ENABLE_POINTER \
                     96:     CTL_CODE(FILE_DEVICE_VIDEO, 0x10e, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     97: #define IOCTL_VIDEO_DISABLE_POINTER \
                     98:     CTL_CODE(FILE_DEVICE_VIDEO, 0x10f, METHOD_BUFFERED, FILE_ANY_ACCESS)
                     99: #define IOCTL_VIDEO_SET_POINTER_ATTR \
                    100:     CTL_CODE(FILE_DEVICE_VIDEO, 0x110, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    101: #define IOCTL_VIDEO_QUERY_POINTER_ATTR \
                    102:     CTL_CODE(FILE_DEVICE_VIDEO, 0x111, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    103: #define IOCTL_VIDEO_SET_POINTER_POSITION \
                    104:     CTL_CODE(FILE_DEVICE_VIDEO, 0x112, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    105: #define IOCTL_VIDEO_QUERY_POINTER_POSITION \
                    106:     CTL_CODE(FILE_DEVICE_VIDEO, 0x113, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    107: #define IOCTL_VIDEO_QUERY_POINTER_CAPABILITIES \
                    108:     CTL_CODE(FILE_DEVICE_VIDEO, 0x114, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    109: 
                    110: #define IOCTL_VIDEO_GET_BANK_SELECT_CODE \
                    111:     CTL_CODE(FILE_DEVICE_VIDEO, 0x115, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    112: 
                    113: #define IOCTL_VIDEO_MAP_VIDEO_MEMORY \
                    114:     CTL_CODE(FILE_DEVICE_VIDEO, 0x116, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    115: #define IOCTL_VIDEO_UNMAP_VIDEO_MEMORY \
                    116:     CTL_CODE(FILE_DEVICE_VIDEO, 0x117, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    117: #define IOCTL_VIDEO_QUERY_PUBLIC_ACCESS_RANGES \
                    118:     CTL_CODE(FILE_DEVICE_VIDEO, 0x118, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    119: #define IOCTL_VIDEO_FREE_PUBLIC_ACCESS_RANGES \
                    120:     CTL_CODE(FILE_DEVICE_VIDEO, 0x119, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    121: 
                    122: #define IOCTL_VIDEO_QUERY_COLOR_CAPABILITIES \
                    123:     CTL_CODE(FILE_DEVICE_VIDEO, 0x11a, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    124: 
                    125: #define IOCTL_VIDEO_QUERY_AVAIL_FONTS \
                    126:     CTL_CODE(FILE_DEVICE_VIDEO, 0x11b, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    127: #define IOCTL_VIDEO_QUERY_NUM_AVAIL_FONTS \
                    128:     CTL_CODE(FILE_DEVICE_VIDEO, 0x11c, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    129: #define IOCTL_VIDEO_QUERY_CURRENT_FONT \
                    130:     CTL_CODE(FILE_DEVICE_VIDEO, 0x11d, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    131: #define IOCTL_VIDEO_SET_CURRENT_FONT \
                    132:     CTL_CODE(FILE_DEVICE_VIDEO, 0x11e, METHOD_BUFFERED, FILE_ANY_ACCESS)
                    133: 
                    134: 
                    135: 
                    136: //
                    137: // Many of the video ICOTLs are modal. When ever the palette is set, or the
                    138: // cursor is set or queried, it is done for the current mode.
                    139: //
                    140: // Modal specifies that the operation is only valid within a mode. Once a
                    141: // set mode operation is performed, the state associated to the modal IOCTL
                    142: // has been destroyed or reinitialized.
                    143: // Non-modal IOCTLs have their state preserved across set-mode operations.
                    144: //
                    145: // Optional IOCTLs are IOCTLs the miniport can optionally support. If the
                    146: // miniport does not support the IOCTL, it should return the appropriate
                    147: // error status.
                    148: // Required IOCTLs must be implemented in a miniport in order for the system
                    149: // to system properly.
                    150: //
                    151: // IOCTL_VIDEO_ENABLE_VDM                       Non-Modal    Private(1)
                    152: // IOCTL_VIDEO_DISABLE_VDM                      Non-Modal    Private(1)
                    153: // IOCTL_VIDEO_REGISTER_VDM                     Non-Modal    Private(1)
                    154: //
                    155: // IOCTL_VIDEO_SAVE_HARDWARE_STATE              Non-Modal    Required(2)
                    156: // IOCTL_VIDEO_RESTORE_HARDWARE_STATE           Non-Modal    Required(2)
                    157: //
                    158: // IOCTL_VIDEO_QUERY_AVAIL_MODES                Non-Modal    Required
                    159: // IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES            Non-Modal    Required
                    160: // IOCTL_VIDEO_QUERY_CURRENT_MODE               Modal        Required
                    161: // IOCTL_VIDEO_SET_CURRENT_MODE                 Non-Modal    Required
                    162: // IOCTL_VIDEO_RESET_DEVICE                     Non-Modal    Required
                    163: //
                    164: // IOCTL_VIDEO_LOAD_AND_SET_FONT                Modal        Required(2)
                    165: //
                    166: // IOCTL_VIDEO_SET_PALETTE_REGISTERS            Modal        Required(2)
                    167: // IOCTL_VIDEO_SET_COLOR_REGISTERS              Modal        Required(3)
                    168: //
                    169: // IOCTL_VIDEO_ENABLE_CURSOR                    Modal        Required(2)
                    170: // IOCTL_VIDEO_DISABLE_CURSOR                   Modal        Required(2)
                    171: // IOCTL_VIDEO_SET_CURSOR_ATTR                  Modal        Required(2)
                    172: // IOCTL_VIDEO_QUERY_CURSOR_ATTR                Modal        Required(2)
                    173: // IOCTL_VIDEO_SET_CURSOR_POSITION              Modal        Required(2)
                    174: // IOCTL_VIDEO_QUERY_CURSOR_POSITION            Modal        Required(2)
                    175: //
                    176: // IOCTL_VIDEO_ENABLE_POINTER                   Modal        Optional
                    177: // IOCTL_VIDEO_DISABLE_POINTER                  Modal        Optional
                    178: // IOCTL_VIDEO_SET_POINTER_ATTR                 Modal        Optional
                    179: // IOCTL_VIDEO_QUERY_POINTER_ATTR               Modal        Optional
                    180: // IOCTL_VIDEO_SET_POINTER_POSITION             Modal        Optional
                    181: // IOCTL_VIDEO_QUERY_POINTER_POSITION           Modal        Optional
                    182: // IOCTL_VIDEO_QUERY_POINTER_CAPABILITIES       Non-Modal    Optional
                    183: //
                    184: // IOCTL_VIDEO_GET_BANK_SELECT_CODE             Modal        Required(2)
                    185: //
                    186: // IOCTL_VIDEO_MAP_VIDEO_MEMORY                 Special(4)   Required
                    187: // IOCTL_VIDEO_UNMAP_VIDEO_MEMORY               Non-Modal    Required
                    188: // IOCTL_VIDEO_QUERY_PUBLIC_ACCESS_RANGES       Non-Modal    Required
                    189: // IOCTL_VIDEO_FREE_PUBLIC_ACCESS_RANGES        Non-Modal    Required
                    190: //
                    191: // IOCTL_VIDEO_QUERY_COLOR_CAPABILITIES         Non-Modal    Optional
                    192: //
                    193: // IOCTL_VIDEO_QUERY_AVAIL_FONTS                Non-Modal    Optional
                    194: // IOCTL_VIDEO_QUERY_NUM_AVAIL_FONTS            Non-Modal    Optional
                    195: // IOCTL_VIDEO_SET_CURRENT_FONT                 Non-Modal    Optional
                    196: // IOCTL_VIDEO_QUERY_CURRENT_FONT               Non-Modal    Optional
                    197: //
                    198: //
                    199: // (1) Private means the IOCTL is completely implemeted within the port driver
                    200: //     and the miniport does not need to support it.
                    201: //
                    202: // (2) These Required functions are for "Vga Compatible" miniports. They are
                    203: //     Optional for other, non vga-compatible (i.e frame buffers) drivers.
                    204: //     VGA compatible means here that the miniport implements all the VGA
                    205: //     functionality and that the VgaCompatible flag for the miniport in the
                    206: //     registry parameters is turned on.
                    207: //
                    208: // (3) This IOCTL is required if the device has a color lookup table (also
                    209: //     commonly called palette) the PALETTE IOCTL is used for VGA while the
                    210: //     COLOR IOCTL is the more general IOCTL that is called by the display
                    211: //     driver or application to set the colors in the devices internal
                    212: //     lookup table
                    213: //
                    214: // (4) This IOCTL is both modal and non-modal. It should map all of video
                    215: //     memory in the caller's address space. A set mode MUST NOT cause the
                    216: //     video memory to change location - in this sense it is non-modal.
                    217: //     However, this IOCTL returns the location size of the frame buffer within
                    218: //     video memory, and the frame buffer size and location may vary from mode
                    219: //     to mode - so that information is modal.
                    220: //
                    221: 
                    222: 
                    223: //
                    224: // Any IOCTL that returns information should return in the status block the
                    225: // size of the data returned.
                    226: // If the output buffer was too small, an error should be returned.
                    227: //
                    228: //
                    229: //
                    230: //
                    231: 
                    232: 
                    233: 
                    234: //
                    235: // VIDEO_IOCTL_ENABLE_VDM
                    236: // VIDEO_IOCTL_DISABLE_VDM
                    237: // VIDEO_IOCTL_REGISTER_VDM
                    238: //
                    239: // These IOCTLs are used to enable or disable a VDM's access to the video
                    240: // hardware. This call will cause the real video frame buffer to be mapped
                    241: // into the VDM's address space and get the video validator connected to the
                    242: // V86 emulator for direct video register access.
                    243: //
                    244: // Information used by this function is passed using the following structure:
                    245: //
                    246: 
                    247: typedef struct _VIDEO_VDM {
                    248:     HANDLE ProcessHandle;
                    249: } VIDEO_VDM, *PVIDEO_VDM;
                    250: 
                    251: //
                    252: //ProcessHandle - Handle to the process for which this request must be
                    253: //    performed. This is required because the console calls the miniport on
                    254: //    the behalf of the VDM process; we are not performing this request in
                    255: //    the context of the current caller.
                    256: //
                    257: 
                    258: 
                    259: typedef struct _VIDEO_REGISTER_VDM {
                    260:     ULONG MinimumStateSize;
                    261: } VIDEO_REGISTER_VDM, *PVIDEO_REGISTER_VDM;
                    262: 
                    263: //
                    264: //MinimumStateSize - Output value determining the minimum size required to
                    265: //    store the video hardware state when performing SAVE_HARDWARE_SATE or
                    266: //    RESTORE_HARDWARE_STATE Ioctls.
                    267: //
                    268: 
                    269: 
                    270: //
                    271: // Second set of structures
                    272: //
                    273: 
                    274: //
                    275: // These IOCTLs are used by the VDM and the console to communicate state
                    276: // changes between the VDM and the kernel video driver.
                    277: //
                    278: // VIDEO_IOCTL_SAVE_HARDWARE_STATE -
                    279: // VIDEO_IOCTL_RESTORE_HARDWARE_STATE -
                    280: //
                    281: //
                    282: // This structure is at the start of the block used when saving or restoring
                    283: // the state of the video hardware using ConsoleHardwareState().
                    284: // the ULONG are offset to the location of the rest of the data. That data
                    285: // is stored within the same memory block pointed to by the
                    286: // VIDEO_HARDWARE_STATE structure, right after this header.
                    287: //
                    288: // Information used by this function is passed using the following structure:
                    289: //
                    290: 
                    291: typedef struct _VIDEO_HARDWARE_STATE_HEADER {
                    292:     ULONG Length;
                    293:     UCHAR PortValue[0x30];
                    294:     ULONG AttribIndexDataState;
                    295:     ULONG BasicSequencerOffset;
                    296:     ULONG BasicCrtContOffset;
                    297:     ULONG BasicGraphContOffset;
                    298:     ULONG BasicAttribContOffset;
                    299:     ULONG BasicDacOffset;
                    300:     ULONG BasicLatchesOffset;
                    301:     ULONG ExtendedSequencerOffset;
                    302:     ULONG ExtendedCrtContOffset;
                    303:     ULONG ExtendedGraphContOffset;
                    304:     ULONG ExtendedAttribContOffset;
                    305:     ULONG ExtendedDacOffset;
                    306:     ULONG ExtendedValidatorStateOffset;
                    307:     ULONG ExtendedMiscDataOffset;
                    308:     ULONG PlaneLength;
                    309:     ULONG Plane1Offset;
                    310:     ULONG Plane2Offset;
                    311:     ULONG Plane3Offset;
                    312:     ULONG Plane4Offset;
                    313:     ULONG VGAStateFlags;
                    314:     ULONG DIBOffset;
                    315:     ULONG DIBBitsPerPixel;
                    316:     ULONG DIBXResolution;
                    317:     ULONG DIBYResolution;
                    318:     ULONG DIBXlatOffset;
                    319:     ULONG DIBXlatLength;
                    320: } VIDEO_HARDWARE_STATE_HEADER, *PVIDEO_HARDWARE_STATE_HEADER;
                    321: 
                    322: //
                    323: // defines for VGAStateFlags
                    324: //
                    325: 
                    326: #define VIDEO_STATE_NON_STANDARD_VGA       0x00000001
                    327: #define VIDEO_STATE_UNEMULATED_VGA_STATE   0x00000002
                    328: #define VIDEO_STATE_PACKED_CHAIN4_MODE     0x00000004
                    329: 
                    330: 
                    331: typedef struct _VIDEO_HARDWARE_STATE {
                    332:     PVIDEO_HARDWARE_STATE_HEADER StateHeader;
                    333:     ULONG StateLength;
                    334: } VIDEO_HARDWARE_STATE, *PVIDEO_HARDWARE_STATE;
                    335: 
                    336: //
                    337: //Length - Length of the basic structure. Used for versioning purposes. The
                    338: //    length field should be initialized to be equal to
                    339: //    sizeof(VIDEO_HARDWARE_STATE_HEADER).
                    340: //
                    341: //PortValue - Array of entries containing the data values for port 3B0 through
                    342: //    3DF.
                    343: //
                    344: //AttribIndexDataState - State of the attribute index register.
                    345: //
                    346: //BasicSequencerOffset - Offset, in bytes, from the beginning of the structure,
                    347: //    to an array of fields containing the register values for the basic
                    348: //    sequencer register set of the VGA.
                    349: //
                    350: //BasicCrtContOffset - Offset, in bytes, from the beginning of the structure,
                    351: //    to an array of fields containing the register values for the basic
                    352: //    CRT register set of the VGA.
                    353: //
                    354: //BasicGraphContOffset - Offset, in bytes, from the beginning of the structure,
                    355: //    to an array of fields containing the register values for the basic
                    356: //    graphics controller register set of the VGA.
                    357: //
                    358: //BasicAttribContOffset - Offset, in bytes, from the beginning of the structure,
                    359: //    to an array of fields containing the register values for the basic
                    360: //    attribute controller register set of the VGA.
                    361: //
                    362: //BasicDacOffset - Offset, in bytes, from the beginning of the structure,
                    363: //    to an array of fields containing the register values for the basic
                    364: //    DAC registers of the VGA.
                    365: //
                    366: //BasicLatchesOffset - Offset, in bytes, from the beginning of the structure,
                    367: //    to an array of fields containing the register values for the basic
                    368: //    latches of the VGA.
                    369: //
                    370: //ExtendedSequencerOffset - Offset, in bytes, from the beginning of the structure,
                    371: //    to an array of fields containing the registers values for the extended
                    372: //    sequencer register set of the VGA.
                    373: //
                    374: //ExtendedCrtContOffset - Offset, in bytes, from the beginning of the structure,
                    375: //    to an array of fields containing the registers values for the extended
                    376: //    CRT register set of the VGA.
                    377: //
                    378: //ExtendedGraphContOffset - Offset, in bytes, from the beginning of the structure,
                    379: //    to an array of fields containing the registers values for the extended
                    380: //    graphics controller register set of the VGA.
                    381: //
                    382: //ExtendedAttribContOffset - Offset, in bytes, from the beginning of the structure,
                    383: //    to an array of fields containing the registers values for the extended
                    384: //    attribute controller register set of the VGA.
                    385: //
                    386: //ExtendedDacOffset - Offset, in bytes, from the beginning of the structure,
                    387: //    to an array of fields containing the registers values for the extended
                    388: //    DAC registers of the VGA.
                    389: //
                    390: //ExtendedValidatorStateOffset - Offset, in bytes, from the beginning of the
                    391: //    structure, to an area reserved for the miniport to put the unemulated
                    392: //    save state that the miniport uses to perform instruction validation for
                    393: //    DOS apps.
                    394: //
                    395: //ExtendedMiscDataOffset - Offset, in bytes, from the beginning of the structure,
                    396: //    to an area reserved for the use of the miniport.
                    397: //
                    398: //PlaneLength - Length of each of the following plane (if present)
                    399: //
                    400: //Plane1Offset - Offset, in bytes, from the beginning of the structure, to an
                    401: //    array of fields containing the data of the first plane of video memory.
                    402: //
                    403: //Plane2Offset - Offset, in bytes, from the beginning of the structure, to an
                    404: //    array of fields containing the data of the second plane of video memory.
                    405: //
                    406: //Plane3Offset - Offset, in bytes, from the beginning of the structure, to an
                    407: //    array of fields containing the data of the third plane of video memory.
                    408: //
                    409: //Plane4Offset - Offset, in bytes, from the beginning of the structure, to an
                    410: //    array of fields containing the data of the fourth plane of video memory.
                    411: //
                    412: //VGAStateFlags - Flags used for the interpretation of the VGA state.
                    413: //    VIDEO_STATE_NON_STANDARD_VGA is set when the set of registers the VGA
                    414: //        returns is not the basic set (all super vga's are not standard).
                    415: //        The VDM should not emulate the saved state unless a specific VDD
                    416: //        has been written for the device.
                    417: //    VIDEO_STATE_UNEMULATED_VGA_STATE specified the miniport has stored
                    418: //        informaiton in the ExtendedValidatorState field and the miniport
                    419: //        should treat this as a frozen state, whatever the registers say.
                    420: //    VIDEO_STATE_PACKED_CHAIN4_MODE indicates that in mode 13 (320x200x256).
                    421: //        the data is stored in a packed pixel format in the plane, as
                    422: //        opposed to the standard VGA format where the data is interleaved
                    423: //        at every four bytes, and on every 16K boundary, offset by one
                    424: //        extra byte.
                    425: //
                    426: //DIBOffset - Offset to the location of the DIB in the allocated data
                    427: //        structure. If NULL, no translation is available.
                    428: //
                    429: //DIBBitsPerPixel - Format of the DIB.
                    430: //
                    431: //DIBXResolution - Width of the DIB in pixels.
                    432: //
                    433: //DIBYResolution - Height of the DIB in pixels.
                    434: //
                    435: //DIBXlatOffset - Offset to the location of the translation vector
                    436: //    from DIB pixel values to 32-bit RGB (1 byte red, 1 byte green, 1 byte
                    437: //    blue, 1 byte empty). Maximum length 256. If NULL, the standard
                    438: //    VGA palette stored in this structure should be used.
                    439: //
                    440: //DIBXlatLength - Length of the RGB translation vector at DIBXlatOffset.
                    441: //
                    442: // For each of the offset fields, if an offset value is NULL, then there is
                    443: // no data for that offset.
                    444: // The length of a data area is:
                    445: //   1) the specific length given to it : plane length (planes) or XResolution *
                    446: //        Yresolution * BitsPerPel (DIB)
                    447: //   2) otherwise, the length = next_non-null_offset_value -
                    448: //                                   current_offset_value
                    449: //
                    450: 
                    451: //
                    452: //StateHeader - Pointer to the VIDEO_HARDWARE_STATE_HEADER structure.
                    453: //
                    454: //StateLength - Size of the VIDEO_HARDWARE_STATE_HEADER structure.
                    455: //
                    456: 
                    457: //
                    458: // VIDEO_IOCTL_QUERY_NUM_AVAIL_MODES - Returns number of different modes
                    459: //                                     available on the controller.
                    460: //
                    461: // Information used by this function is passed using the following structure:
                    462: //
                    463: 
                    464: typedef struct _VIDEO_NUM_MODES {
                    465:     ULONG NumModes;
                    466:     ULONG ModeInformationLength;
                    467: } VIDEO_NUM_MODES, *PVIDEO_NUM_MODES;
                    468: 
                    469: //
                    470: //NumModes - Returns the number of modes supported by the kernel driver.
                    471: //
                    472: //ModeInformationLength - Length of the VIDEO_MODE_INFORMATION structure
                    473: //    for the VIDEO_IOCTL QUERY_AVAILABLE_MODES IOCTL.
                    474: 
                    475: 
                    476: //
                    477: // VIDEO_IOCTL_SET_CURRENT_MODE - Is used to set the mode of the controller.
                    478: //
                    479: // Information used by this function is passed using the following structure:
                    480: //
                    481: 
                    482: typedef struct _VIDEO_MODE {
                    483:     ULONG RequestedMode;
                    484: } VIDEO_MODE, *PVIDEO_MODE;
                    485: 
                    486: #define VIDEO_MODE_NO_ZERO_MEMORY 0x80000000 // High order bit of the mode
                    487:                                              // determines if the set mode
                    488:                                              // should (0) or should not (1)
                    489:                                              // cause the video memory to be
                    490:                                              // zeroed out simultaneously to
                    491:                                              // the set mode operation.
                    492: 
                    493: //
                    494: //RequestedMode - Indicates in which mode the adapter should be initialized.
                    495: //
                    496: 
                    497: 
                    498: //
                    499: // VIDEO_IOCTL_RESET_DEVICE - Is used to reset the mode of the adapter when GDI
                    500: //                            gives up control of the device to allow a VDM to
                    501: //                            access the hardware. x86 only.
                    502: //                            The default mode should be whatever is the
                    503: //                            default mode when the machine is booted
                    504: //
                    505: // No information is needed fo this function.
                    506: //
                    507: 
                    508: 
                    509: 
                    510: //
                    511: // VIDEO_IOCTL_QUERY_AVAIL_MODES - Returns information about each available
                    512: //                                 mode on the controller.
                    513: //
                    514: // VIDEO_IOCTL_QUERY_CURRENT_MODE - Returns the information for the current
                    515: //                                  controller mode.
                    516: //
                    517: // Information used by this function is passed using the following structure:
                    518: //
                    519: // NOTE This structure is matched exactly with the DISP_MODE structure
                    520: // in winddi.h - every change to this structure MUST be made to the
                    521: // structure in winddi.h.
                    522: //
                    523: 
                    524: typedef struct _VIDEO_MODE_INFORMATION {
                    525:     ULONG Length;
                    526:     ULONG ModeIndex;
                    527:     ULONG VisScreenWidth;
                    528:     ULONG VisScreenHeight;
                    529:     ULONG ScreenStride;
                    530:     ULONG NumberOfPlanes;
                    531:     ULONG BitsPerPlane;
                    532:     ULONG Frequency;
                    533:     ULONG XMillimeter;
                    534:     ULONG YMillimeter;
                    535:     ULONG NumberRedBits;
                    536:     ULONG NumberGreenBits;
                    537:     ULONG NumberBlueBits;
                    538:     ULONG RedMask;
                    539:     ULONG GreenMask;
                    540:     ULONG BlueMask;
                    541:     ULONG AttributeFlags;
                    542:     ULONG VideoMemoryBitmapWidth;
                    543:     ULONG VideoMemoryBitmapHeight;
                    544: } VIDEO_MODE_INFORMATION, *PVIDEO_MODE_INFORMATION;
                    545: 
                    546: //
                    547: // Bit definitions for Attribute Flags
                    548: //
                    549: 
                    550: #define VIDEO_MODE_COLOR           0x0001  // 0 = Mono-compatible, 1 = Color
                    551: #define VIDEO_MODE_GRAPHICS        0x0002  // 0 = Text mode, 1 = Graphics
                    552: #define VIDEO_MODE_PALETTE_DRIVEN  0x0004  // 0 = Colors are direct
                    553:                                            // 1 = Colors are index to a palette
                    554: #define VIDEO_MODE_MANAGED_PALETTE 0x0008  // 0 = Palette is fixed (must be
                    555:                                            //     queried from miniport
                    556:                                            // 1 = Palette is settable.
                    557: #define VIDEO_MODE_INTERLACED      0x0010  // 1 = Mode is interlaced
                    558:                                            // 0 = non-interlaced
                    559: #define VIDEO_MODE_NO_OFF_SCREEN   0x0020  // 1 = Offscreen memory CAN NOT be
                    560:                                            //     used to store information.
                    561:                                            // 0 = Offscreen memory is available
                    562: 
                    563: //
                    564: //Length - Length of the structure in bytes. Also used to do verisioning.
                    565: //
                    566: //ModeIndex - Number used to set this mode when calling the miniport driver.
                    567: //
                    568: //VisScreenWidth - Number of visible horizontal pixels on a scan line
                    569: //
                    570: //VisScreenHeight - Number of visible lines (or scan lines)
                    571: //
                    572: //ScreenStride - Delta, in *BYTES*, between the start of two scan lines.
                    573: //
                    574: //    NOTE: the width and height are in pixels, but the stride is in bytes !!!
                    575: //
                    576: //NumberOfPlanes - Number of separate planes combined by the device.
                    577: //
                    578: //BitsPerPlane - Number of bits per pixel on a plane.
                    579: //
                    580: //Frequency - Screen Frequency, in Hertz.
                    581: //
                    582: //XMillimeter - Size of the horizontal active region on the output device,
                    583: //    in millimeters.
                    584: //
                    585: //YMillimeter - Size of the vertical active region on the output device,
                    586: //    in millimeters.
                    587: //
                    588: //NumberRedBits - Number of bits in the red DAC.
                    589: //
                    590: //NumberGreenBits - Number of bits in the green DAC.
                    591: //
                    592: //NumberBlueBits - Number of bits in the blue DAC.
                    593: //
                    594: //RedMask - Red color Mask for device with direct color modes. Bits turned
                    595: //    on indicate the bit is of color Red.
                    596: //
                    597: //GreenMask - Green color Mask for device with direct color modes. Bits
                    598: //    turned on indicate the bit is of color Green.
                    599: //
                    600: //BlueMask - Blue color Mask for device with direct color modes. Bits
                    601: //    turned on indicate the bit is of color Blue.
                    602: //
                    603: //AttributeFlags. Flags indicating certain behavior for the device.
                    604: //
                    605: //VideoMemoryBitmapWidth - Width of the video memory bitmap.
                    606: //    VisScreenWidth <= VideoMemoryBitmapWidth <= ScreenStride
                    607: //
                    608: //VideoMemoryBitmapHeight - Height of the video memory bitmap.
                    609: //   VisScreenHeight <= VideoMemoryBitmapHeight = VideoRamLength / ScreenStride
                    610: //
                    611: 
                    612: //
                    613: // VIDEO_IOCTL_QUERY_NUM_AVAIL_FONTS - Returns the number of ROM fonts
                    614: //                                     available on the card.
                    615: //
                    616: // Information used by this function is passed using the following structure:
                    617: //
                    618: 
                    619: typedef struct _VIDEO_NUM_FONTS {
                    620:     ULONG NumFonts;
                    621: } VIDEO_NUM_FONTS, *PVIDEO_NUM_FONTS;
                    622: 
                    623: //
                    624: //NumFonts - Returns the number of ROM fonts found on the device.
                    625: //
                    626: 
                    627: 
                    628: //
                    629: // VIDEO_IOCTL_QUERY_AVAIL_FONTS - Returns an array containing information
                    630: //                                 about each available font on the controller.
                    631: //
                    632: // Information used by this function is passed using the following structure:
                    633: //
                    634: 
                    635: typedef struct _VIDEO_FONT_INFORMATION {
                    636:     ULONG FontIndex;
                    637:     USHORT WidthInPixels;
                    638:     USHORT HeightInPixels;
                    639: } VIDEO_FONT_INFORMATION, *PVIDEO_FONT_INFORMATION;
                    640: 
                    641: //
                    642: //FontIndex - Index of the font in the controller's font table. For a
                    643: //    QUERY_CURRENT_FONT, 0 is returned if the font was a loadable-font.
                    644: //
                    645: //WidthInPixels - Width of the characters in the font, in pixels.
                    646: //
                    647: //HeigthInPixels - Heigth of the characters in the font, in pixels.
                    648: //
                    649: 
                    650: 
                    651: //
                    652: // VIDEO_IOCTL_SET_CURRENT_FONT -  Is used to load one of the ROM fonts found
                    653: //                                 on the controller.
                    654: //
                    655: // Information used by this function is passed using the following structure:
                    656: //
                    657: 
                    658: typedef struct _VIDEO_FONT {
                    659:     ULONG RequestedFont;
                    660: } VIDEO_FONT, *PVIDEO_FONT;
                    661: 
                    662: //
                    663: //RequestedFont - Indicates which ROM font from the device should be loaded.
                    664: //                Note that zero is not a valid font since it indicates the
                    665: //                font that is currently in the font generator.
                    666: //
                    667: 
                    668: 
                    669: //
                    670: // VIDEO_IOCTL_LOAD_AND_SET_FONT - Is used to load a user-defined font.
                    671: //
                    672: // VIDEO_IOCTL_QUERY_CURRENT_FONT - Returns the information for the current
                    673: //                                  controller font.
                    674: //
                    675: // Information used by this function is passed using the following structure:
                    676: //
                    677: 
                    678: typedef struct _VIDEO_LOAD_FONT_INFORMATION {
                    679:     USHORT WidthInPixels;
                    680:     USHORT HeightInPixels;
                    681:     ULONG FontSize;
                    682:     UCHAR Font[1];
                    683: } VIDEO_LOAD_FONT_INFORMATION, *PVIDEO_LOAD_FONT_INFORMATION;
                    684: 
                    685: //
                    686: //WidthInPixels - Width of the characters in the font, in pixels.
                    687: //
                    688: //HeigthInPixels - Heigth of the characters in the font, in pixels.
                    689: //
                    690: //FontSize - Size of the font buffer being passed in, in bytes.
                    691: //
                    692: //Font - Start of the font buffer.
                    693: //
                    694: 
                    695: 
                    696: //
                    697: // VIDEO_IOCTL_SET_PALETTE_REGISTERS - Takes buffer containing
                    698: //                                     VIDEO_PALETTE_DATA where Colors[]
                    699: //                                     specifies the array containing the
                    700: //                                     color values for the palette registers.
                    701: //
                    702: // Information used by this function is passed using the following structure:
                    703: //
                    704: // NOTE: This should only be used by the VGA type drivers
                    705: //
                    706: 
                    707: typedef struct _VIDEO_PALETTE_DATA {
                    708:     USHORT NumEntries;
                    709:     USHORT FirstEntry;
                    710:     USHORT Colors[1];
                    711: } VIDEO_PALETTE_DATA, *PVIDEO_PALETTE_DATA;
                    712: 
                    713: //
                    714: //NumEntries - Number of entries in the array of color values.
                    715: //
                    716: //FirstEntry - Location in the device palette to which the first entry in the
                    717: //    list of colors should be copied to. The other entries in the color list
                    718: //    should be copied sequentially, from this starting point into the device's
                    719: //    palette.
                    720: //
                    721: //Colors - Array of color entries to copy into the device's color palette.
                    722: //
                    723: 
                    724: //
                    725: // VIDEO_IOCTL_SET_COLOR_REGISTERS - Takes buffer containing VIDEO_CLUT.
                    726: //
                    727: // Information used by this function is passed using the following structure:
                    728: //
                    729: 
                    730: typedef struct _VIDEO_CLUTDATA {
                    731:     UCHAR Red;
                    732:     UCHAR Green;
                    733:     UCHAR Blue;
                    734:     UCHAR Unused;
                    735: } VIDEO_CLUTDATA, *PVIDEO_CLUTDATA;
                    736: 
                    737: //
                    738: //Red - Bits to be put in the Red portion of the color registers.
                    739: //
                    740: //Green - Bits to be put in the Green portion of the color registers.
                    741: //
                    742: //Blue - Bits to be put in the Blue portion of the color registers.
                    743: //
                    744: 
                    745: typedef struct {
                    746:     USHORT   NumEntries;
                    747:     USHORT   FirstEntry;
                    748:     union {
                    749:         VIDEO_CLUTDATA RgbArray;
                    750:         ULONG RgbLong;
                    751:     } LookupTable[1];
                    752: } VIDEO_CLUT, *PVIDEO_CLUT;
                    753: 
                    754: //
                    755: //NumEntries - Number of entries in the LookupTable of color values.
                    756: //
                    757: //FirstEntry - Location in the device palette to which the first entry in the
                    758: //    LookupTable of colors should be copied to. The other entries in the
                    759: //    LookupTable should be copied sequentially, from this starting point into
                    760: //    the device's palette.
                    761: //
                    762: //LookupTable - Array of color entries to copy into the device's color
                    763: //    registers/palette. The color entries can be accessed as a genric 32 bit
                    764: //    value or as Red/Green/Blue/Unused fields.
                    765: //
                    766: 
                    767: //
                    768: // NOTE: Cursor vs. Pointer:
                    769: //    A cursor is a rectangular set of pixels which are used to indicate the
                    770: //    location of input coming from the keyboard.
                    771: //
                    772: //    A pointer is the set of pixels that are used to paint the shape
                    773: //    associated with the mouse.
                    774: //
                    775: 
                    776: //
                    777: // VIDEO_IOCTL_QUERY_CURSOR_POSITION - Returns the location of the cursor on
                    778: //                                     the screen.
                    779: //
                    780: // VIDEO_IOCTL_SET_CURSOR_POSITION - Is used to set the location of the
                    781: //                                   cursor on the screen.
                    782: //
                    783: // Information used by this function is passed using the following structure:
                    784: //
                    785: 
                    786: typedef struct _VIDEO_CURSOR_POSITION {
                    787:     SHORT Column;
                    788:     SHORT Row;
                    789: } VIDEO_CURSOR_POSITION, *PVIDEO_CURSOR_POSITION;
                    790: 
                    791: //
                    792: //Column - Column on which the cursor is located from the top left, in pixels.
                    793: //
                    794: //Row - Row on which the cusor is located from the top left, in pixels.
                    795: //
                    796: 
                    797: 
                    798: //
                    799: // VIDEO_IOCTL_QUERY_CURSOR_ATTR - Returns all attributes of the cursor.
                    800: //
                    801: // VIDEO_IOCTL_SET_CURSOR_ATTR - Is used to set the attributes of the cursor.
                    802: //
                    803: // Information used by this function is passed using the following structure:
                    804: //
                    805: 
                    806: //
                    807: // For the VGA:
                    808: // TopScanLine will be stored in the height when an IOCTL is made
                    809: // BottomScanLine will be stored in the width when an IOCTL is made
                    810: //
                    811: 
                    812: typedef struct _VIDEO_CURSOR_ATTRIBUTES {
                    813:     USHORT Width;
                    814:     USHORT Height;
                    815:     SHORT Column;
                    816:     SHORT Row;
                    817:     UCHAR Rate;
                    818:     UCHAR Enable;
                    819: } VIDEO_CURSOR_ATTRIBUTES, *PVIDEO_CURSOR_ATTRIBUTES;
                    820: 
                    821: //
                    822: //Width - Width of the cursor, in pixels.
                    823: //
                    824: //Height - Height of the cursor, in scans.
                    825: //
                    826: //Column - Column on which the cursor is located from the top left, in pixels.
                    827: //
                    828: //Row - Row on which the cusor is located from the top left, in pixels.
                    829: //
                    830: //Rate - Rate at which the cursor whould flash.
                    831: //
                    832: //Enable - Non-zero to display cursor, 0 not to display.
                    833: //
                    834: 
                    835: //
                    836: // VIDEO_IOCTL_QUERY_POINTER_POSITION - Returns the location of the pointer
                    837: //                                      on the screen
                    838: //
                    839: // VIDEO_IOCTL_SET_POINTER_POSITION - Is used to set the location of the
                    840: //                                    pointer on the screen.
                    841: //
                    842: // Information used by this function is passed using the following structure:
                    843: //
                    844: 
                    845: typedef struct _VIDEO_POINTER_POSITION {
                    846:     SHORT Column;
                    847:     SHORT Row;
                    848: } VIDEO_POINTER_POSITION, *PVIDEO_POINTER_POSITION;
                    849: 
                    850: //
                    851: //Column - Column on which the cursor is located from the top left, in pixels.
                    852: //
                    853: //Row - Row on which the cusor is located from the top left, in pixels.
                    854: //
                    855: 
                    856: 
                    857: //
                    858: // VIDEO_IOCTL_QUERY_POINTER_ATTR - Returns all attributes of the pointer.
                    859: //
                    860: // VIDEO_IOCTL_SET_POINTER_ATTR - Is used to set the attributes of the
                    861: //                                pointer.
                    862: //
                    863: // Information used by this function is passed using the following structure:
                    864: //
                    865: 
                    866: typedef struct _VIDEO_POINTER_ATTRIBUTES {
                    867:     ULONG Flags;
                    868:     ULONG Width;
                    869:     ULONG Height;
                    870:     ULONG WidthInBytes;
                    871:     ULONG Enable;
                    872:     SHORT Column;
                    873:     SHORT Row;
                    874:     UCHAR Pixels[1];
                    875: } VIDEO_POINTER_ATTRIBUTES, *PVIDEO_POINTER_ATTRIBUTES;
                    876: 
                    877: //
                    878: //Flags - color or mono pointer, same as for query pointer capabilities.
                    879: //
                    880: //Width - Width of the pointer, in pixels.
                    881: //
                    882: //Height - Height of the pointer, in scans.
                    883: //
                    884: //WidthInBytes - Width of the pointer, in bytes.
                    885: //
                    886: //Enable - Non-zero to display pointer, 0 not to display.
                    887: //
                    888: //Column - Column on which the cursor is located from the top left, in pixels.
                    889: //
                    890: //Row - Row on which the cusor is located from the top left, in pixels.
                    891: //
                    892: //Pixels - Start of pointer data, in device-compatible DIB format.
                    893: //    (Mask data is always in 1-bpp DIB format.)
                    894: //
                    895: 
                    896: 
                    897: //
                    898: // VIDEO_IOCTL_QUERY_POINTER_CAPABILITIES - Returns capabilities of miniport
                    899: //                                          hardware cursor
                    900: //
                    901: 
                    902: typedef struct _VIDEO_POINTER_CAPABILITIES {
                    903:     ULONG Flags;
                    904:     ULONG MaxWidth;
                    905:     ULONG MaxHeight;
                    906:     ULONG HWPtrBitmapStart;
                    907:     ULONG HWPtrBitmapEnd;
                    908: } VIDEO_POINTER_CAPABILITIES, *PVIDEO_POINTER_CAPABILITIES;
                    909: 
                    910: //
                    911: // Flag bit definitions
                    912: //
                    913: 
                    914: #define VIDEO_MODE_ASYNC_POINTER  0x01 // 1 if the cursor can be updated
                    915:                                        // asynchronously to drawing operations.
                    916: #define VIDEO_MODE_MONO_POINTER   0x02 // 1 if a monochrome hardware pointer
                    917:                                        // is supported.
                    918: #define VIDEO_MODE_COLOR_POINTER  0x04 // 1 if a color hardware pointer is
                    919:                                        // supported.
                    920: #define VIDEO_MODE_ANIMATE_START  0x08 // The pointer being passed down has
                    921: #define VIDEO_MODE_ANIMATE_UPDATE 0x10 // the same hotspot as the previous
                    922:                                        // pointer
                    923: 
                    924: //
                    925: //MaxWidth - Widest pointer bitmap the miniport should be requested to load
                    926: //    for either monochrome or color pointer.
                    927: //
                    928: //MaxHeight - widest pointer bitmap the miniport should be requested to load
                    929: //    for either monochrome color pointer handled.
                    930: //
                    931: //HWPtrBitmapStart = first offset in bitmap of memory used to store hardware
                    932: //    pointer bitmap, in CPU-addressable units (-1 if not applicable). For
                    933: //    planar modes (like VGA mode 12h), this is a planar offset; for linear
                    934: //    modes (like VGA mode 13h), this is a linear offset. The CPU-addressable
                    935: //    translation in HC planar mode is assumed to be linearaddress/4,
                    936: //    because there are four planes at each address.
                    937: //
                    938: //HWPtrBitmapEnd = last offset in bitmap of memory used to store hardware
                    939: //    pointer bitmap (-1 if not applicable).
                    940: //
                    941: // Note: Miniport has options to reject any call to set a pointer.
                    942: //
                    943: 
                    944: 
                    945: //
                    946: // VIDEO_IOCTL_GET_BANK_SELECT_CODE - Called by the Windows display driver
                    947: //                                    to get a block of executable code used
                    948: //                                    to perform bank-switching in high
                    949: //                                    resolution SVGA drivers.
                    950: //
                    951: // Gets information needed to implement banking control for a selected mode.
                    952: //
                    953: // Information used by this function is passed using the following structures:
                    954: //
                    955: 
                    956: //
                    957: // The input from the caller in the input buffer is a VIDEO_MODE structure, as
                    958: // described under VIDEO_IOCTL_SET_CURRENT_MODE.
                    959: //
                    960: // RequestedMode - mode index for which banking information is desired.
                    961: //
                    962: 
                    963: //
                    964: // Returned in output buffer.
                    965: //
                    966: 
                    967: typedef struct _VIDEO_BANK_SELECT {
                    968:     ULONG Length;
                    969:     ULONG Size;
                    970:     ULONG BankingFlags;
                    971:     ULONG BankingType;
                    972:     ULONG PlanarHCBankingType;
                    973:     ULONG BitmapWidthInBytes;
                    974:     ULONG BitmapSize;
                    975:     ULONG Granularity;
                    976:     ULONG PlanarHCGranularity;
                    977:     ULONG CodeOffset;
                    978:     ULONG PlanarHCBankCodeOffset;
                    979:     ULONG PlanarHCEnableCodeOffset;
                    980:     ULONG PlanarHCDisableCodeOffset;
                    981: } VIDEO_BANK_SELECT, *PVIDEO_BANK_SELECT;
                    982: 
                    983: //
                    984: // Stored in the BankType and PlanarHCBankintType fields
                    985: //
                    986: 
                    987: typedef enum _VIDEO_BANK_TYPE {
                    988:     VideoNotBanked = 0,
                    989:     VideoBanked1RW,
                    990:     VideoBanked1R1W,
                    991:     VideoBanked2RW,
                    992:     NumVideoBankTypes
                    993: } VIDEO_BANK_TYPE, *PVIDEO_BANK_TYPE;
                    994: 
                    995: //
                    996: // Defines for BankingFlags.
                    997: //
                    998: 
                    999: #define PLANAR_HC               0x00000001
                   1000: 
                   1001: //
                   1002: //Note: planar high-color ("planar HC") mode is a special 8-bpp-and-up
                   1003: //    CPU addressing mode in which four bytes can be accessed at
                   1004: //    once by using the VGA's planar hardware.  This mode is enabled
                   1005: //    by turning off the Chain4 bit (bit 3 in Sequence Controller
                   1006: //    register 4), so it is also known as non-Chain4 mode.  Planar HC
                   1007: //    mode can greatly accelerate operations such as solid fills,
                   1008: //    some pattern fills, and some blits.
                   1009: //
                   1010: //Note: the term "CPU-addressable bytes" means offsets measured
                   1011: //    in bytes as accessed by the CPU.  In 16-color modes, this
                   1012: //    merely means "measured in bytes" rather than "measured in
                   1013: //    pixels," where each byte contains 8 pixels, as usual.
                   1014: //    In normal high-color modes, "CPU-addressable bytes"
                   1015: //    is exactly what you'd expect; it's the number of pixels in 256
                   1016: //    color modes, pixels*2 in 16-bpp modes, and so on.  However, in
                   1017: //    planar HC modes, there are four display memory bytes at every CPU-
                   1018: //    addressable byte, because four planes are at each address, so
                   1019: //    in 256 color modes the number of CPU-addressable bytes is
                   1020: //    pixels/4, in 16-bpp modes CPU-addressable bytes = pixels/2, and
                   1021: //    so on.  Basically, "CPU-addressable bytes" just means the
                   1022: //    offsets the CPU needs to address banks properly in the
                   1023: //    specified mode.
                   1024: //
                   1025: //Note: the start address must be set to 0 (displayed pixels must
                   1026: //    start at offset 0 in display memory), and the banking windows
                   1027: //    must fit within the 64K area starting at A000:0; no 128K
                   1028: //    mappings, please, because there may be a monochrome adapter
                   1029: //    in the system.
                   1030: //
                   1031: //Length - Length of the basic structure. Used for versioning by checking the
                   1032: //    Length of the struct is at least as large as the valuegiven by sizeof().
                   1033: //
                   1034: //Size - number of bytes required to hold all banking information for
                   1035: //    this mode, including the VIDEO_BANK_SELECT structure and all
                   1036: //    bank-switch code.  This is the size of the buffer that
                   1037: //    VgaGetBankSelectCode requires in order properly to return info.
                   1038: //
                   1039: //BankingFlags - indicate the type of banking supported in this mode.
                   1040: //    PLANAR_HC - if set, indicates that planar high-color (HC) mode
                   1041: //          (non-Chain4 8-, 15-, 16-, 24-, and 32-bpp) is supported.
                   1042: //          If this bit is set, the following fields must be filled in:
                   1043: //              PlanarHCGranularity, pPlanarHCBankCode,
                   1044: //              pPlanarHCEnableCode, pPlanarHCDisableCode.
                   1045: //          This bit is ignored by the 16-color driver, as are the
                   1046: //          associated fields.
                   1047: //
                   1048: //BankingType - These are the banking types supported by the adapter
                   1049: //    when it is ina standard mode.
                   1050: //
                   1051: //    VideoNotBanked - this mode does not support or require banking.
                   1052: //    VideoBanked1RW - this mode supports a single RW (readable and
                   1053: //        writable) banking window.  The window is assumed to be
                   1054: //        64K in size.
                   1055: //    VideoBanked1R1W - this mode supports a single window, but the
                   1056: //        window can be mapped to different areas of display memory
                   1057: //        for reads and for writes.  The window is assumed to be
                   1058: //        64K in size.
                   1059: //    VideoBanked2RW - this mode supports two independently mappable
                   1060: //        banking windows, each RW.  Each window is assumed to be
                   1061: //        32K in size.  The second window is assumed
                   1062: //        to start immediately after the end of the first, at
                   1063: //        A000:8000.
                   1064: //
                   1065: //PlanarHCBankingType - These are the banking types supported by the
                   1066: //    adapter when it is in a PLANAR HC mode.
                   1067: //
                   1068: //    See BankingType for defintions of each banking type.
                   1069: //
                   1070: //
                   1071: //BitmapWidthInBytes - distance from start of one scan line to start
                   1072: //    of next, counted in CPU-addressable bytes (not pixels).  The
                   1073: //    CPU-addressable distance from one scan line to the next is
                   1074: //    assumed to be BitmapWidthInBytes/4 in planar HC modes, because
                   1075: //    there are four planes at each address.
                   1076: //
                   1077: //BitmapSize - size of display memory in CPU-addressable bytes (for
                   1078: //    example, 256K on a 1 Mb SVGA in 16-color mode, because there
                   1079: //    are four bytes at each address).  The CPU-addressable bitmap
                   1080: //    size is assumed to be BitmapSize/4 in planar HC modes, because
                   1081: //    there are four planes at each address.
                   1082: //
                   1083: //Granularity - granularity with which display memory may be mapped
                   1084: //    into a banking window.  (That is, resolution with which the
                   1085: //    display memory address mapped to the start of a window may be
                   1086: //    set; anywhere from 1K to 64K, depending on the adapter.  If
                   1087: //    Granularity < window size (either 64K or 32K), then adjacent
                   1088: //    banks can overlap, and broken rasters can always be avoided.
                   1089: //    If Granularity == window size, then banks are disjoint, and
                   1090: //    display memory is basically segmented into banks.)  Granularity
                   1091: //    is measured in CPU-addressable bytes.
                   1092: //
                   1093: //PlanarHCGranularity - granularity with which display memory may be
                   1094: //    mapped into a banking window in planar HC mode.
                   1095: //    PlanarHCGranularity is measured in CPU-addressable bytes, and
                   1096: //    is typically but not always Granularity/4.  Ignored in
                   1097: //    16-color modes.
                   1098: //
                   1099: //CodeOffset - base of the code section in the structure.
                   1100: //
                   1101: //PlanarHCBankCodeOffset - offset from Code of executable code
                   1102: //    that performs planar HC mode bank switching.  Ignored in
                   1103: //    16-color modes.
                   1104: //
                   1105: //PlanarHCEnableCodeOffset - offset from Code of executable code
                   1106: //    that enables planar HC mode.  Ignored in 16-color modes.
                   1107: //
                   1108: //PlanarHCDisableCodeOffset - offset from Code of executable code
                   1109: //    that disables planar HC mode.  Ignored in 16-color modes.
                   1110: //
                   1111: //Specification for bank switch code at Code:
                   1112: //    Executes requested bank mappings.
                   1113: //
                   1114: //    Input:
                   1115: //      EAX = bank number to which to map window #0
                   1116: //      EBX = bank number to which to map window #1
                   1117: //      interpreted according to BankingType as follows:
                   1118: //        VideoBanked1RW - the single window is mapped to bank EAX,
                   1119: //            EBX is ignored.
                   1120: //        VideoBanked1RW - the read window is mapped to bank EAX,
                   1121: //            the write window is mapped to bank EBX
                   1122: //        VideoBanked1R1W - the window at A000:0 is mapped to bank EAX,
                   1123: //            the window at A800:0 is mapped to bank EBX
                   1124: //
                   1125: //    Output: none
                   1126: //
                   1127: // Note: the definition of "bank n" is the bank that starts at
                   1128: //    display memory offset Granularity*n.  In other words,
                   1129: //    banks are assumed to start every Granularity CPU-addressable
                   1130: //    bytes, and are numbered from 0 to number of banks-1.
                   1131: //
                   1132: //Specification for planar HC executable code:
                   1133: //    ***To be filled in when we get to planar HC modes***
                   1134: //
                   1135: 
                   1136: 
                   1137: //
                   1138: // VIDEO_IOCTL_MAP_VIDEO_MEMORY - Maps the frame buffer into the callers
                   1139: //                                address space.
                   1140: // VIDEO_IOCTL_UNMAP_VIDEO_MEMORY - Unmaps the frame buffer from the callers
                   1141: //                                  address space.
                   1142: //
                   1143: // Information used by this function is passed using the following structure:
                   1144: //
                   1145: 
                   1146: typedef struct _VIDEO_MEMORY {
                   1147:     PVOID RequestedVirtualAddress;
                   1148: } VIDEO_MEMORY, *PVIDEO_MEMORY;
                   1149: 
                   1150: //
                   1151: //RequestedVirtualAddress - For MAP: Requested virtual address for the video
                   1152: //    memory. This value is optional. If zero is specified, the operating
                   1153: //    system will choose an appropriate location.  For UNMAP: Virtual Address
                   1154: //    of the base of video memory. The size is implicit since it can not
                   1155: //    change (you can not add video memory dynamically!).
                   1156: //
                   1157: 
                   1158: //
                   1159: // VIDEO_IOCTL_MAP_VIDEO_MEMORY - Returns the virtual address and size of
                   1160: //                                the frame buffer and video memory in the
                   1161: //                                caller's address space.
                   1162: //                                This IOCTL must be called after a call
                   1163: //                                to the MAP IOCTL has been made.
                   1164: //
                   1165: 
                   1166: typedef struct _VIDEO_MEMORY_INFORMATION {
                   1167:     PVOID VideoRamBase;
                   1168:     ULONG VideoRamLength;
                   1169:     PVOID FrameBufferBase;
                   1170:     ULONG FrameBufferLength;
                   1171: } VIDEO_MEMORY_INFORMATION, *PVIDEO_MEMORY_INFORMATION;
                   1172: 
                   1173: //
                   1174: //VideoRamBase - Virtual address of the Video RAM in the callers address space
                   1175: //    (only valid if the memory is mapped.
                   1176: //
                   1177: //VideoRamLength - Linear length of the Video RAM in the caller's virtual
                   1178: //    address space (memory accessible through a bank switch mechanism is not
                   1179: //    described by this value).
                   1180: //    This value must be equal to VideoMemoryBitmapHeight * ScreenStride
                   1181: //
                   1182: //FrameBufferBase - Virtual address of the Frame Buffer in the caller's
                   1183: //    address space. The Frame buffer is the actively displayed part of Video
                   1184: //    Ram.
                   1185: //
                   1186: //FrameBufferLength - Linear length of the Frame Buffer in the caller's
                   1187: //    virtual address space (memory accessible through a bank switch mechanism
                   1188: //    is not described by this value).
                   1189: //    This value must be equal to VisScreenWidth * ScreenStride
                   1190: //
                   1191: 
                   1192: 
                   1193: //
                   1194: // IOCTL_VIDEO_QUERY_PUBLIC_ACCESS_RANGES - Returns the access range used to
                   1195: //                                          program the hardware directly.
                   1196: //                                          An array of these is returned if
                   1197: //                                          multiple ranges exist.
                   1198: //
                   1199: // IOCTL_VIDEO_FREE_PUBLIC_ACCESS_RANGES - Frees up the access ranges that were
                   1200: //                                         allocated by the QUERY_ACCESS_RANGES
                   1201: //                                         call.
                   1202: //
                   1203: // Information used by this function is passed using the following structure:
                   1204: //
                   1205: 
                   1206: typedef struct _VIDEO_PUBLIC_ACCESS_RANGES {
                   1207:     ULONG InIoSpace;
                   1208:     ULONG MappedInIoSpace;
                   1209:     PVOID VirtualAddress;
                   1210: } VIDEO_PUBLIC_ACCESS_RANGES, *PVIDEO_PUBLIC_ACCESS_RANGES;
                   1211: 
                   1212: //
                   1213: //InIoSpace - Indicates if the hardware registers or ports are in IO space
                   1214: //    or in memory space.
                   1215: //
                   1216: //MappedInIoSpace - Indicates if under the current platform the registers or
                   1217: //    ports are mapped in IO Space or memory space.
                   1218: //
                   1219: //VirtualAddress - Location of the registers or IO ports as mapped under the
                   1220: //    current architecture.
                   1221: //
                   1222: 
                   1223: 
                   1224: //
                   1225: // IOCTL_VIDEO_QUERY_COLOR_CAPABILITIES - Returns the color information
                   1226: //                                        found in the monitors VDDPs
                   1227: //                                        description file.
                   1228: //
                   1229: // NOTE: This structure must be filled out completely. A subset of the
                   1230: //         values can not be returned.
                   1231: //
                   1232: 
                   1233: typedef struct _VIDEO_COLOR_CAPABILITIES {
                   1234:     ULONG Length;
                   1235:     ULONG AttributeFlags;
                   1236:     LONG  RedPhosphoreDecay;
                   1237:     LONG  GreenPhosphoreDecay;
                   1238:     LONG  BluePhosphoreDecay;
                   1239:     LONG  WhiteChromaticity_x;
                   1240:     LONG  WhiteChromaticity_y;
                   1241:     LONG  WhiteChromaticity_Y;
                   1242:     LONG  RedChromaticity_x;
                   1243:     LONG  RedChromaticity_y;
                   1244:     LONG  GreenChromaticity_x;
                   1245:     LONG  GreenChromaticity_y;
                   1246:     LONG  BlueChromaticity_x;
                   1247:     LONG  BlueChromaticity_y;
                   1248:     LONG  WhiteGamma;
                   1249:     LONG  RedGamma;
                   1250:     LONG  GreenGamma;
                   1251:     LONG  BlueGamma;
                   1252: } VIDEO_COLOR_CAPABILITIES, *PVIDEO_COLOR_CAPABILITIES;
                   1253: 
                   1254: //
                   1255: // Flag Bit definitions
                   1256: //
                   1257: 
                   1258: #define VIDEO_DEVICE_COLOR          0x1   // Is this device support color (1)
                   1259:                                           // or monochrome only
                   1260: #define VIDEO_OPTIONAL_GAMMET_TABLE 0x2   // Indicates that a gammet table can
                   1261:                                           // be queried/set for the device
                   1262:                                           // use other IOCTLs for that purpose.
                   1263: //
                   1264: //Length - Length of the basic structure. Used for versioning by checking the
                   1265: //    Length of the struct is at least as large as the value given by sizeof().
                   1266: //
                   1267: //AttributesFlag - List of falgs determining some of the properties of the
                   1268: //    device.
                   1269: //
                   1270: //See the VDDP documentation for the details on the various fields
                   1271: //
                   1272: //RedPhosphoreDecay
                   1273: //GreenPhosphoreDecay
                   1274: //BluePhosphoreDecay -
                   1275: //
                   1276: //WhiteChromaticity_x
                   1277: //WhiteChromaticity_y
                   1278: //WhiteChromaticity_Y -
                   1279: //
                   1280: //RedChromaticity_x
                   1281: //RedChromaticity_y
                   1282: //GreenChromaticity_x
                   1283: //GreenChromaticity_y
                   1284: //BlueChromaticity_x
                   1285: //BlueChromaticity_y -
                   1286: //
                   1287: //WhiteGamma -
                   1288: //
                   1289: //RedGamma
                   1290: //GreenGamma
                   1291: //BlueGamma -
                   1292: //
                   1293: //All values returned in this structure are integers.
                   1294: //The values returned must be floating point values * 10,000; i.e:
                   1295: //a gamma of 2.34 would be returned as 23400.
                   1296: //

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.