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