GraphicsOutput.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. /** @file
  2. Graphics Output Protocol from the UEFI 2.0 specification.
  3. Abstraction of a very simple graphics device.
  4. Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
  5. This program and the accompanying materials are licensed and made available
  6. under the terms and conditions of the BSD License which accompanies this
  7. distribution. The full text of the license may be found at
  8. http://opensource.org/licenses/bsd-license.php
  9. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  11. **/
  12. #ifndef __GRAPHICS_OUTPUT_H__
  13. #define __GRAPHICS_OUTPUT_H__
  14. #define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
  15. { \
  16. 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } \
  17. }
  18. typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL;
  19. typedef struct {
  20. UINT32 RedMask;
  21. UINT32 GreenMask;
  22. UINT32 BlueMask;
  23. UINT32 ReservedMask;
  24. } EFI_PIXEL_BITMASK;
  25. typedef enum {
  26. PixelRedGreenBlueReserved8BitPerColor,
  27. PixelBlueGreenRedReserved8BitPerColor,
  28. PixelBitMask,
  29. PixelBltOnly,
  30. PixelFormatMax
  31. } EFI_GRAPHICS_PIXEL_FORMAT;
  32. typedef struct {
  33. UINT32 Version;
  34. UINT32 HorizontalResolution;
  35. UINT32 VerticalResolution;
  36. EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;
  37. EFI_PIXEL_BITMASK PixelInformation;
  38. UINT32 PixelsPerScanLine;
  39. } EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;
  40. /**
  41. Return the current video mode information.
  42. @param This Protocol instance pointer.
  43. @param ModeNumber The mode number to return information on.
  44. @param SizeOfInfo A pointer to the size, in bytes, of the Info buffer.
  45. @param Info A pointer to callee allocated buffer that returns information about ModeNumber.
  46. @retval EFI_SUCCESS Mode information returned.
  47. @retval EFI_BUFFER_TOO_SMALL The Info buffer was too small.
  48. @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode.
  49. @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
  50. @retval EFI_INVALID_PARAMETER One of the input args was NULL.
  51. **/
  52. typedef
  53. EFI_STATUS
  54. (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) (
  55. IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
  56. IN UINT32 ModeNumber,
  57. OUT UINTN *SizeOfInfo,
  58. OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
  59. )
  60. ;
  61. /**
  62. Return the current video mode information.
  63. @param This Protocol instance pointer.
  64. @param ModeNumber The mode number to be set.
  65. @retval EFI_SUCCESS Graphics mode was changed.
  66. @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
  67. @retval EFI_UNSUPPORTED ModeNumber is not supported by this device.
  68. **/
  69. typedef
  70. EFI_STATUS
  71. (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) (
  72. IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
  73. IN UINT32 ModeNumber
  74. )
  75. ;
  76. typedef struct {
  77. UINT8 Blue;
  78. UINT8 Green;
  79. UINT8 Red;
  80. UINT8 Reserved;
  81. } EFI_GRAPHICS_OUTPUT_BLT_PIXEL;
  82. typedef union {
  83. EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;
  84. UINT32 Raw;
  85. } EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;
  86. typedef enum {
  87. EfiBltVideoFill,
  88. EfiBltVideoToBltBuffer,
  89. EfiBltBufferToVideo,
  90. EfiBltVideoToVideo,
  91. EfiGraphicsOutputBltOperationMax
  92. } EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
  93. /**
  94. The following table defines actions for BltOperations:
  95. <B>EfiBltVideoFill</B> - Write data from the BltBuffer pixel (SourceX, SourceY)
  96. directly to every pixel of the video display rectangle
  97. (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
  98. Only one pixel will be used from the BltBuffer. Delta is NOT used.
  99. <B>EfiBltVideoToBltBuffer</B> - Read data from the video display rectangle
  100. (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
  101. the BltBuffer rectangle (DestinationX, DestinationY )
  102. (DestinationX + Width, DestinationY + Height). If DestinationX or
  103. DestinationY is not zero then Delta must be set to the length in bytes
  104. of a row in the BltBuffer.
  105. <B>EfiBltBufferToVideo</B> - Write data from the BltBuffer rectangle
  106. (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
  107. video display rectangle (DestinationX, DestinationY)
  108. (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
  109. not zero then Delta must be set to the length in bytes of a row in the
  110. BltBuffer.
  111. <B>EfiBltVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
  112. (SourceX + Width, SourceY + Height) .to the video display rectangle
  113. (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
  114. The BltBuffer and Delta are not used in this mode.
  115. @param This Protocol instance pointer.
  116. @param BltBuffer Buffer containing data to blit into video buffer. This
  117. buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
  118. @param BltOperation Operation to perform on BlitBuffer and video memory
  119. @param SourceX X coordinate of source for the BltBuffer.
  120. @param SourceY Y coordinate of source for the BltBuffer.
  121. @param DestinationX X coordinate of destination for the BltBuffer.
  122. @param DestinationY Y coordinate of destination for the BltBuffer.
  123. @param Width Width of rectangle in BltBuffer in pixels.
  124. @param Height Height of rectangle in BltBuffer in pixels.
  125. @param Delta OPTIONAL
  126. @retval EFI_SUCCESS The Blt operation completed.
  127. @retval EFI_INVALID_PARAMETER BltOperation is not valid.
  128. @retval EFI_DEVICE_ERROR A hardware error occurred writing to the video buffer.
  129. **/
  130. typedef
  131. EFI_STATUS
  132. (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) (
  133. IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
  134. IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
  135. IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
  136. IN UINTN SourceX,
  137. IN UINTN SourceY,
  138. IN UINTN DestinationX,
  139. IN UINTN DestinationY,
  140. IN UINTN Width,
  141. IN UINTN Height,
  142. IN UINTN Delta OPTIONAL
  143. );
  144. typedef struct {
  145. UINT32 MaxMode;
  146. UINT32 Mode;
  147. EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
  148. UINTN SizeOfInfo;
  149. EFI_PHYSICAL_ADDRESS FrameBufferBase;
  150. UINTN FrameBufferSize;
  151. } EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;
  152. struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {
  153. EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode;
  154. EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode;
  155. EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt;
  156. EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;
  157. };
  158. extern EFI_GUID gEfiGraphicsOutputProtocolGuid;
  159. #endif