]>
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 | |
4ca9b6c4 | 6 | Copyright (c) 2006 - 2008, Intel Corporation \r |
d1f95000 | 7 | All rights reserved. This program and the accompanying materials \r |
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 |
104 | @retval EFI_SUCCESS Mode information returned.\r | |
105 | @retval EFI_BUFFER_TOO_SMALL The Info buffer was too small.\r | |
106 | @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode.\r | |
107 | @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()\r | |
108 | @retval EFI_INVALID_PARAMETER One of the input args was NULL.\r | |
109 | \r | |
110 | **/\r | |
111 | typedef\r | |
112 | EFI_STATUS\r | |
8b13229b | 113 | (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE)(\r |
d1f95000 | 114 | IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r |
115 | IN UINT32 ModeNumber,\r | |
116 | OUT UINTN *SizeOfInfo,\r | |
117 | OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info\r | |
ed66e1bc | 118 | );\r |
d1f95000 | 119 | \r |
120 | /**\r | |
bcb85cda | 121 | Set the video device into the specified mode and clears the visible portions of \r |
122 | the output display to black.\r | |
d1f95000 | 123 | \r |
bcb85cda | 124 | @param This The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.\r |
125 | @param ModeNumber Abstraction that defines the current video mode.\r | |
d1f95000 | 126 | \r |
bcb85cda | 127 | @retval EFI_SUCCESS The graphics mode specified by ModeNumber was selected.\r |
d1f95000 | 128 | @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r |
129 | @retval EFI_UNSUPPORTED ModeNumber is not supported by this device.\r | |
130 | \r | |
131 | **/\r | |
132 | typedef\r | |
133 | EFI_STATUS\r | |
8b13229b | 134 | (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE)(\r |
d1f95000 | 135 | IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r |
136 | IN UINT32 ModeNumber\r | |
ed66e1bc | 137 | );\r |
d1f95000 | 138 | \r |
139 | typedef struct {\r | |
140 | UINT8 Blue;\r | |
141 | UINT8 Green;\r | |
142 | UINT8 Red;\r | |
143 | UINT8 Reserved;\r | |
144 | } EFI_GRAPHICS_OUTPUT_BLT_PIXEL;\r | |
145 | \r | |
146 | typedef union {\r | |
147 | EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;\r | |
148 | UINT32 Raw;\r | |
149 | } EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;\r | |
150 | \r | |
a4e0b060 | 151 | ///\r |
152 | /// actions for BltOperations\r | |
153 | ///\r | |
d1f95000 | 154 | typedef enum {\r |
a4e0b060 | 155 | ///\r |
156 | /// Write data from the BltBuffer pixel (SourceX, SourceY) \r | |
157 | /// directly to every pixel of the video display rectangle \r | |
158 | /// (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). \r | |
159 | /// Only one pixel will be used from the BltBuffer. Delta is NOT used. \r | |
160 | ///\r | |
d1f95000 | 161 | EfiBltVideoFill,\r |
a4e0b060 | 162 | \r |
163 | ///\r | |
164 | /// Read data from the video display rectangle \r | |
165 | /// (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in \r | |
166 | /// the BltBuffer rectangle (DestinationX, DestinationY ) \r | |
167 | /// (DestinationX + Width, DestinationY + Height). If DestinationX or \r | |
168 | /// DestinationY is not zero then Delta must be set to the length in bytes \r | |
169 | /// of a row in the BltBuffer. \r | |
170 | ///\r | |
d1f95000 | 171 | EfiBltVideoToBltBuffer,\r |
a4e0b060 | 172 | \r |
173 | ///\r | |
174 | /// Write data from the BltBuffer rectangle \r | |
175 | /// (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the \r | |
176 | /// video display rectangle (DestinationX, DestinationY) \r | |
177 | /// (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is \r | |
178 | /// not zero then Delta must be set to the length in bytes of a row in the \r | |
179 | /// BltBuffer.\r | |
180 | ///\r | |
d1f95000 | 181 | EfiBltBufferToVideo, \r |
a4e0b060 | 182 | \r |
183 | ///\r | |
184 | /// Copy from the video display rectangle (SourceX, SourceY)\r | |
185 | /// (SourceX + Width, SourceY + Height) .to the video display rectangle \r | |
186 | /// (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). \r | |
187 | /// The BltBuffer and Delta are not used in this mode.\r | |
188 | /// EfiBltVideoToVideo,\r | |
189 | ///\r | |
d1f95000 | 190 | EfiBltVideoToVideo,\r |
a4e0b060 | 191 | \r |
d1f95000 | 192 | EfiGraphicsOutputBltOperationMax\r |
193 | } EFI_GRAPHICS_OUTPUT_BLT_OPERATION;\r | |
194 | \r | |
195 | /**\r | |
a4e0b060 | 196 | Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer.\r |
197 | \r | |
d1f95000 | 198 | @param This Protocol instance pointer.\r |
199 | @param BltBuffer Buffer containing data to blit into video buffer. This\r | |
200 | buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r | |
201 | @param BltOperation Operation to perform on BlitBuffer and video memory\r | |
202 | @param SourceX X coordinate of source for the BltBuffer.\r | |
203 | @param SourceY Y coordinate of source for the BltBuffer.\r | |
204 | @param DestinationX X coordinate of destination for the BltBuffer.\r | |
205 | @param DestinationY Y coordinate of destination for the BltBuffer.\r | |
206 | @param Width Width of rectangle in BltBuffer in pixels.\r | |
207 | @param Height Hight of rectangle in BltBuffer in pixels.\r | |
208 | @param Delta OPTIONAL\r | |
209 | \r | |
210 | @retval EFI_SUCCESS The Blt operation completed.\r | |
211 | @retval EFI_INVALID_PARAMETER BltOperation is not valid.\r | |
212 | @retval EFI_DEVICE_ERROR A hardware error occured writting to the video buffer.\r | |
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 LG |
252 | ///\r |
253 | /// Size of the frame buffer represented by FrameBufferBase in bytes.\r | |
254 | ///\r | |
d1f95000 | 255 | UINTN FrameBufferSize;\r |
256 | } EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;\r | |
257 | \r | |
44717a39 | 258 | ///\r |
259 | /// Provides a basic abstraction to set video modes and copy pixels to and from \r | |
260 | /// the graphics controller's frame buffer. The linear address of the hardware \r | |
261 | /// frame buffer is also exposed so software can write directly to the video hardware.\r | |
262 | ///\r | |
d1f95000 | 263 | struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {\r |
264 | EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode;\r | |
265 | EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode;\r | |
266 | EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt;\r | |
44717a39 | 267 | ///\r |
268 | /// Pointer to EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE data.\r | |
269 | ///\r | |
d1f95000 | 270 | EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;\r |
271 | };\r | |
272 | \r | |
273 | extern EFI_GUID gEfiGraphicsOutputProtocolGuid;\r | |
274 | \r | |
275 | #endif\r |