]>
Commit | Line | Data |
---|---|---|
d1f95000 | 1 | /** @file\r |
2 | Graphics Output Protocol from the UEFI 2.0 specification.\r | |
3 | \r | |
4 | Abstraction of a very simple graphics device.\r | |
5 | \r | |
9095d37b | 6 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
d1f95000 | 8 | \r |
d1f95000 | 9 | **/\r |
10 | \r | |
11 | #ifndef __GRAPHICS_OUTPUT_H__\r | |
12 | #define __GRAPHICS_OUTPUT_H__\r | |
13 | \r | |
14 | #define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \\r | |
15 | { \\r | |
16 | 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } \\r | |
17 | }\r | |
18 | \r | |
19 | typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL;\r | |
20 | \r | |
21 | typedef struct {\r | |
22 | UINT32 RedMask;\r | |
23 | UINT32 GreenMask;\r | |
24 | UINT32 BlueMask;\r | |
25 | UINT32 ReservedMask;\r | |
26 | } EFI_PIXEL_BITMASK;\r | |
27 | \r | |
28 | typedef enum {\r | |
74fec708 | 29 | ///\r |
9095d37b LG |
30 | /// A pixel is 32-bits and byte zero represents red, byte one represents green,\r |
31 | /// byte two represents blue, and byte three is reserved. This is the definition\r | |
32 | /// for the physical frame buffer. The byte values for the red, green, and blue\r | |
33 | /// components represent the color intensity. This color intensity value range\r | |
74fec708 LG |
34 | /// from a minimum intensity of 0 to maximum intensity of 255.\r |
35 | ///\r | |
d1f95000 | 36 | PixelRedGreenBlueReserved8BitPerColor,\r |
74fec708 | 37 | ///\r |
9095d37b LG |
38 | /// A pixel is 32-bits and byte zero represents blue, byte one represents green,\r |
39 | /// byte two represents red, and byte three is reserved. This is the definition\r | |
40 | /// for the physical frame buffer. The byte values for the red, green, and blue\r | |
41 | /// components represent the color intensity. This color intensity value range\r | |
74fec708 LG |
42 | /// from a minimum intensity of 0 to maximum intensity of 255.\r |
43 | ///\r | |
d1f95000 | 44 | PixelBlueGreenRedReserved8BitPerColor,\r |
74fec708 LG |
45 | ///\r |
46 | /// The Pixel definition of the physical frame buffer.\r | |
47 | ///\r | |
d1f95000 | 48 | PixelBitMask,\r |
74fec708 LG |
49 | ///\r |
50 | /// This mode does not support a physical frame buffer.\r | |
51 | ///\r | |
d1f95000 | 52 | PixelBltOnly,\r |
74fec708 LG |
53 | ///\r |
54 | /// Valid EFI_GRAPHICS_PIXEL_FORMAT enum values are less than this value.\r | |
55 | ///\r | |
d1f95000 | 56 | PixelFormatMax\r |
57 | } EFI_GRAPHICS_PIXEL_FORMAT;\r | |
58 | \r | |
59 | typedef struct {\r | |
74fec708 | 60 | ///\r |
9095d37b | 61 | /// The version of this data structure. A value of zero represents the\r |
74fec708 LG |
62 | /// EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure as defined in this specification.\r |
63 | ///\r | |
d1f95000 | 64 | UINT32 Version;\r |
74fec708 LG |
65 | ///\r |
66 | /// The size of video screen in pixels in the X dimension.\r | |
67 | ///\r | |
d1f95000 | 68 | UINT32 HorizontalResolution;\r |
74fec708 LG |
69 | ///\r |
70 | /// The size of video screen in pixels in the Y dimension.\r | |
71 | ///\r | |
d1f95000 | 72 | UINT32 VerticalResolution;\r |
74fec708 | 73 | ///\r |
9095d37b | 74 | /// Enumeration that defines the physical format of the pixel. A value of PixelBltOnly\r |
74fec708 LG |
75 | /// implies that a linear frame buffer is not available for this mode.\r |
76 | ///\r | |
d1f95000 | 77 | EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;\r |
74fec708 | 78 | ///\r |
9095d37b | 79 | /// This bit-mask is only valid if PixelFormat is set to PixelPixelBitMask.\r |
74fec708 LG |
80 | /// A bit being set defines what bits are used for what purpose such as Red, Green, Blue, or Reserved.\r |
81 | ///\r | |
d1f95000 | 82 | EFI_PIXEL_BITMASK PixelInformation;\r |
74fec708 LG |
83 | ///\r |
84 | /// Defines the number of pixel elements per video memory line.\r | |
9095d37b | 85 | ///\r |
d1f95000 | 86 | UINT32 PixelsPerScanLine;\r |
87 | } EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;\r | |
88 | \r | |
89 | /**\r | |
bcb85cda | 90 | Returns information for an available graphics mode that the graphics device\r |
91 | and the set of active video output devices supports.\r | |
d1f95000 | 92 | \r |
bcb85cda | 93 | @param This The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.\r |
94 | @param ModeNumber The mode number to return information on.\r | |
95 | @param SizeOfInfo A pointer to the size, in bytes, of the Info buffer.\r | |
96 | @param Info A pointer to callee allocated buffer that returns information about ModeNumber.\r | |
d1f95000 | 97 | \r |
60fde8aa | 98 | @retval EFI_SUCCESS Valid mode information was returned.\r |
d1f95000 | 99 | @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode.\r |
60fde8aa | 100 | @retval EFI_INVALID_PARAMETER ModeNumber is not valid.\r |
d1f95000 | 101 | \r |
102 | **/\r | |
103 | typedef\r | |
104 | EFI_STATUS\r | |
8b13229b | 105 | (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE)(\r |
d1f95000 | 106 | IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r |
107 | IN UINT32 ModeNumber,\r | |
108 | OUT UINTN *SizeOfInfo,\r | |
109 | OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info\r | |
ed66e1bc | 110 | );\r |
d1f95000 | 111 | \r |
112 | /**\r | |
9095d37b | 113 | Set the video device into the specified mode and clears the visible portions of\r |
bcb85cda | 114 | the output display to black.\r |
d1f95000 | 115 | \r |
bcb85cda | 116 | @param This The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.\r |
117 | @param ModeNumber Abstraction that defines the current video mode.\r | |
d1f95000 | 118 | \r |
bcb85cda | 119 | @retval EFI_SUCCESS The graphics mode specified by ModeNumber was selected.\r |
d1f95000 | 120 | @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r |
121 | @retval EFI_UNSUPPORTED ModeNumber is not supported by this device.\r | |
122 | \r | |
123 | **/\r | |
124 | typedef\r | |
125 | EFI_STATUS\r | |
8b13229b | 126 | (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE)(\r |
d1f95000 | 127 | IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r |
128 | IN UINT32 ModeNumber\r | |
ed66e1bc | 129 | );\r |
d1f95000 | 130 | \r |
131 | typedef struct {\r | |
132 | UINT8 Blue;\r | |
133 | UINT8 Green;\r | |
134 | UINT8 Red;\r | |
135 | UINT8 Reserved;\r | |
136 | } EFI_GRAPHICS_OUTPUT_BLT_PIXEL;\r | |
137 | \r | |
138 | typedef union {\r | |
139 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;\r | |
140 | UINT32 Raw;\r | |
141 | } EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;\r | |
142 | \r | |
a4e0b060 | 143 | ///\r |
144 | /// actions for BltOperations\r | |
145 | ///\r | |
d1f95000 | 146 | typedef enum {\r |
a4e0b060 | 147 | ///\r |
9095d37b LG |
148 | /// Write data from the BltBuffer pixel (0, 0)\r |
149 | /// directly to every pixel of the video display rectangle\r | |
150 | /// (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).\r | |
151 | /// Only one pixel will be used from the BltBuffer. Delta is NOT used.\r | |
a4e0b060 | 152 | ///\r |
d1f95000 | 153 | EfiBltVideoFill,\r |
9095d37b | 154 | \r |
a4e0b060 | 155 | ///\r |
9095d37b LG |
156 | /// Read data from the video display rectangle\r |
157 | /// (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in\r | |
158 | /// the BltBuffer rectangle (DestinationX, DestinationY )\r | |
159 | /// (DestinationX + Width, DestinationY + Height). If DestinationX or\r | |
160 | /// DestinationY is not zero then Delta must be set to the length in bytes\r | |
161 | /// of a row in the BltBuffer.\r | |
a4e0b060 | 162 | ///\r |
d1f95000 | 163 | EfiBltVideoToBltBuffer,\r |
9095d37b | 164 | \r |
a4e0b060 | 165 | ///\r |
9095d37b LG |
166 | /// Write data from the BltBuffer rectangle\r |
167 | /// (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the\r | |
168 | /// video display rectangle (DestinationX, DestinationY)\r | |
169 | /// (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is\r | |
170 | /// not zero then Delta must be set to the length in bytes of a row in the\r | |
a4e0b060 | 171 | /// BltBuffer.\r |
172 | ///\r | |
9095d37b LG |
173 | EfiBltBufferToVideo,\r |
174 | \r | |
a4e0b060 | 175 | ///\r |
176 | /// Copy from the video display rectangle (SourceX, SourceY)\r | |
9095d37b LG |
177 | /// (SourceX + Width, SourceY + Height) to the video display rectangle\r |
178 | /// (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).\r | |
60fde8aa | 179 | /// The BltBuffer and Delta are not used in this mode.\r |
a4e0b060 | 180 | ///\r |
d1f95000 | 181 | EfiBltVideoToVideo,\r |
9095d37b | 182 | \r |
d1f95000 | 183 | EfiGraphicsOutputBltOperationMax\r |
184 | } EFI_GRAPHICS_OUTPUT_BLT_OPERATION;\r | |
185 | \r | |
186 | /**\r | |
a4e0b060 | 187 | Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer.\r |
9095d37b | 188 | \r |
d1f95000 | 189 | @param This Protocol instance pointer.\r |
60fde8aa | 190 | @param BltBuffer The data to transfer to the graphics screen.\r |
191 | Size is at least Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL).\r | |
192 | @param BltOperation The operation to perform when copying BltBuffer on to the graphics screen.\r | |
193 | @param SourceX The X coordinate of source for the BltOperation.\r | |
194 | @param SourceY The Y coordinate of source for the BltOperation.\r | |
195 | @param DestinationX The X coordinate of destination for the BltOperation.\r | |
196 | @param DestinationY The Y coordinate of destination for the BltOperation.\r | |
197 | @param Width The width of a rectangle in the blt rectangle in pixels.\r | |
198 | @param Height The height of a rectangle in the blt rectangle in pixels.\r | |
199 | @param Delta Not used for EfiBltVideoFill or the EfiBltVideoToVideo operation.\r | |
200 | If a Delta of zero is used, the entire BltBuffer is being operated on.\r | |
201 | If a subrectangle of the BltBuffer is being used then Delta\r | |
202 | represents the number of bytes in a row of the BltBuffer.\r | |
d1f95000 | 203 | \r |
60fde8aa | 204 | @retval EFI_SUCCESS BltBuffer was drawn to the graphics screen.\r |
d1f95000 | 205 | @retval EFI_INVALID_PARAMETER BltOperation is not valid.\r |
60fde8aa | 206 | @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r |
d1f95000 | 207 | \r |
208 | **/\r | |
209 | typedef\r | |
210 | EFI_STATUS\r | |
8b13229b | 211 | (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT)(\r |
d1f95000 | 212 | IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r |
213 | IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL\r | |
214 | IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,\r | |
215 | IN UINTN SourceX,\r | |
216 | IN UINTN SourceY,\r | |
217 | IN UINTN DestinationX,\r | |
218 | IN UINTN DestinationY,\r | |
219 | IN UINTN Width,\r | |
220 | IN UINTN Height,\r | |
221 | IN UINTN Delta OPTIONAL\r | |
222 | );\r | |
223 | \r | |
224 | typedef struct {\r | |
74fec708 LG |
225 | ///\r |
226 | /// The number of modes supported by QueryMode() and SetMode().\r | |
227 | ///\r | |
d1f95000 | 228 | UINT32 MaxMode;\r |
74fec708 LG |
229 | ///\r |
230 | /// Current Mode of the graphics device. Valid mode numbers are 0 to MaxMode -1.\r | |
231 | ///\r | |
d1f95000 | 232 | UINT32 Mode;\r |
74fec708 LG |
233 | ///\r |
234 | /// Pointer to read-only EFI_GRAPHICS_OUTPUT_MODE_INFORMATION data.\r | |
235 | ///\r | |
d1f95000 | 236 | EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r |
74fec708 LG |
237 | ///\r |
238 | /// Size of Info structure in bytes.\r | |
239 | ///\r | |
d1f95000 | 240 | UINTN SizeOfInfo;\r |
74fec708 LG |
241 | ///\r |
242 | /// Base address of graphics linear frame buffer.\r | |
243 | /// Offset zero in FrameBufferBase represents the upper left pixel of the display.\r | |
244 | ///\r | |
d1f95000 | 245 | EFI_PHYSICAL_ADDRESS FrameBufferBase;\r |
74fec708 | 246 | ///\r |
9095d37b | 247 | /// Amount of frame buffer needed to support the active mode as defined by\r |
60fde8aa | 248 | /// PixelsPerScanLine xVerticalResolution x PixelElementSize.\r |
74fec708 | 249 | ///\r |
d1f95000 | 250 | UINTN FrameBufferSize;\r |
251 | } EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;\r | |
252 | \r | |
44717a39 | 253 | ///\r |
9095d37b LG |
254 | /// Provides a basic abstraction to set video modes and copy pixels to and from\r |
255 | /// the graphics controller's frame buffer. The linear address of the hardware\r | |
44717a39 | 256 | /// frame buffer is also exposed so software can write directly to the video hardware.\r |
257 | ///\r | |
d1f95000 | 258 | struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {\r |
259 | EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode;\r | |
260 | EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode;\r | |
261 | EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt;\r | |
44717a39 | 262 | ///\r |
263 | /// Pointer to EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE data.\r | |
264 | ///\r | |
d1f95000 | 265 | EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;\r |
266 | };\r | |
267 | \r | |
268 | extern EFI_GUID gEfiGraphicsOutputProtocolGuid;\r | |
269 | \r | |
270 | #endif\r |