vesa.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. Copyright (c) 2000 by Juliusz Chroboczek
  3. Permission is hereby granted, free of charge, to any person obtaining a copy
  4. of this software and associated documentation files (the "Software"), to deal
  5. in the Software without restriction, including without limitation the rights
  6. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. copies of the Software, and to permit persons to whom the Software is
  8. furnished to do so, subject to the following conditions:
  9. The above copyright notice and this permission notice shall be included in
  10. all copies or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17. THE SOFTWARE.
  18. */
  19. #ifndef _VESA_H_
  20. #define _VESA_H_
  21. #include "kdrive.h"
  22. #include "shadow.h"
  23. #include "vm86.h"
  24. #include "randrstr.h"
  25. #define VESA_TEXT_SAVE (64*1024)
  26. #define MODE_SUPPORTED 0x01
  27. #define MODE_COLOUR 0x08
  28. #define MODE_GRAPHICS 0x10
  29. #define MODE_VGA 0x20
  30. #define MODE_LINEAR 0x80
  31. #define MODE_DIRECT 0x1
  32. #define MEMORY_TEXT 0
  33. #define MEMORY_CGA 1
  34. #define MEMORY_HERCULES 2
  35. #define MEMORY_PLANAR 3
  36. #define MEMORY_PSEUDO 4
  37. #define MEMORY_NONCHAIN 5
  38. #define MEMORY_DIRECT 6
  39. #define MEMORY_YUV 7
  40. typedef struct _VesaMode {
  41. int mode; /* mode number */
  42. int vbe; /* a VBE mode */
  43. int ModeAttributes; /* mode attributes */
  44. int NumberOfPlanes; /* number of memory planes */
  45. int BitsPerPixel; /* bits per pixel */
  46. int MemoryModel; /* memory model type */
  47. int RedMaskSize; /* size of direct color red mask in bits */
  48. int RedFieldPosition; /* bit position of lsb of red mask */
  49. int GreenMaskSize; /* size of direct color green mask in bits */
  50. int GreenFieldPosition; /* bit position of lsb of green mask */
  51. int BlueMaskSize; /* size of direct color blue mask in bits */
  52. int BlueFieldPosition; /* bit position of lsb of blue mask */
  53. int RsvdMaskSize; /* size of direct color reserved mask bits */
  54. int RsvdFieldPosition; /* bit position of lsb of reserved mask */
  55. int DirectColorModeInfo; /* direct color mode attributes */
  56. int XResolution; /* horizontal resolution */
  57. int YResolution; /* vertical resolution */
  58. int BytesPerScanLine; /* bytes per scan line */
  59. } VesaModeRec, *VesaModePtr;
  60. #include "vbe.h"
  61. #include "vga.h"
  62. typedef struct _VesaCardPriv {
  63. int vbe;
  64. VesaModePtr modes;
  65. int nmode;
  66. Vm86InfoPtr vi;
  67. int vga_palette;
  68. int old_vbe_mode;
  69. int old_vga_mode;
  70. VbeInfoPtr vbeInfo;
  71. char text[VESA_TEXT_SAVE];
  72. CARD8 cmap[256 * 4];
  73. } VesaCardPrivRec, *VesaCardPrivPtr;
  74. #define VESA_LINEAR 0
  75. #define VESA_WINDOWED 1
  76. #define VESA_PLANAR 2
  77. #define VESA_MONO 3
  78. typedef struct _VesaScreenPriv {
  79. VesaModeRec mode;
  80. Bool shadow;
  81. Rotation randr;
  82. int mapping;
  83. int origDepth;
  84. void *fb;
  85. int fb_size;
  86. CARD32 fb_phys;
  87. PixmapPtr pShadow;
  88. Bool mapped;
  89. } VesaScreenPrivRec, *VesaScreenPrivPtr;
  90. Bool vesaCardInit(KdCardInfo * card);
  91. Bool vesaScreenInit(KdScreenInfo * screen);
  92. PixmapPtr vesaGetPixmap(ScreenPtr pScreen);
  93. Bool vesaInitScreen(ScreenPtr pScreen);
  94. Bool vesaFinishInitScreen(ScreenPtr pScreen);
  95. Bool vesaCreateResources(ScreenPtr pScreen);
  96. Bool vesaEnable(ScreenPtr pScreen);
  97. Bool vesaDPMS(ScreenPtr pScreen, int mode);
  98. void vesaDisable(ScreenPtr pScreen);
  99. void vesaPreserve(KdCardInfo * card);
  100. void vesaRestore(KdCardInfo * card);
  101. void vesaCardFini(KdCardInfo * card);
  102. void vesaScreenFini(KdScreenInfo * screen);
  103. void vesaPutColors(ScreenPtr pScreen, int n, xColorItem * pdefs);
  104. void vesaGetColors(ScreenPtr pScreen, int n, xColorItem * pdefs);
  105. void vesaUseMsg(void);
  106. int vesaProcessArgument(int argc, char **argv, int i);
  107. #endif /* _VESA_H_ */