]>
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 LG |
35 | ///\r |
36 | /// A pixel is 32-bits and byte zero represents red, byte one represents green, \r | |
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 LG |
43 | ///\r |
44 | /// A pixel is 32-bits and byte zero represents blue, byte one represents green, \r | |
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 | |
96 | Return the current video mode information.\r | |
97 | \r | |
98 | @param This Protocol instance pointer.\r | |
99 | @param ModeNumber The mode number to return information on.\r | |
100 | @param SizeOfInfo A pointer to the size, in bytes, of the Info buffer.\r | |
101 | @param Info A pointer to callee allocated buffer that returns information about ModeNumber.\r | |
102 | \r | |
103 | @retval EFI_SUCCESS Mode information returned.\r | |
104 | @retval EFI_BUFFER_TOO_SMALL The Info buffer was too small.\r | |
105 | @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode.\r | |
106 | @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()\r | |
107 | @retval EFI_INVALID_PARAMETER One of the input args was NULL.\r | |
108 | \r | |
109 | **/\r | |
110 | typedef\r | |
111 | EFI_STATUS\r | |
8b13229b | 112 | (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE)(\r |
d1f95000 | 113 | IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r |
114 | IN UINT32 ModeNumber,\r | |
115 | OUT UINTN *SizeOfInfo,\r | |
116 | OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info\r | |
ed66e1bc | 117 | );\r |
d1f95000 | 118 | \r |
119 | /**\r | |
120 | Return the current video mode information.\r | |
121 | \r | |
122 | @param This Protocol instance pointer.\r | |
123 | @param ModeNumber The mode number to be set.\r | |
124 | \r | |
125 | @retval EFI_SUCCESS Graphics mode was changed.\r | |
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 |
154 | /// Write data from the BltBuffer pixel (SourceX, SourceY) \r | |
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 | |
172 | /// Write data from the BltBuffer rectangle \r | |
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 | |
183 | /// (SourceX + Width, SourceY + Height) .to the video display rectangle \r | |
184 | /// (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). \r | |
185 | /// The BltBuffer and Delta are not used in this mode.\r | |
186 | /// EfiBltVideoToVideo,\r | |
187 | ///\r | |
d1f95000 | 188 | EfiBltVideoToVideo,\r |
a4e0b060 | 189 | \r |
d1f95000 | 190 | EfiGraphicsOutputBltOperationMax\r |
191 | } EFI_GRAPHICS_OUTPUT_BLT_OPERATION;\r | |
192 | \r | |
193 | /**\r | |
a4e0b060 | 194 | Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer.\r |
195 | \r | |
d1f95000 | 196 | @param This Protocol instance pointer.\r |
197 | @param BltBuffer Buffer containing data to blit into video buffer. This\r | |
198 | buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r | |
199 | @param BltOperation Operation to perform on BlitBuffer and video memory\r | |
200 | @param SourceX X coordinate of source for the BltBuffer.\r | |
201 | @param SourceY Y coordinate of source for the BltBuffer.\r | |
202 | @param DestinationX X coordinate of destination for the BltBuffer.\r | |
203 | @param DestinationY Y coordinate of destination for the BltBuffer.\r | |
204 | @param Width Width of rectangle in BltBuffer in pixels.\r | |
205 | @param Height Hight of rectangle in BltBuffer in pixels.\r | |
206 | @param Delta OPTIONAL\r | |
207 | \r | |
208 | @retval EFI_SUCCESS The Blt operation completed.\r | |
209 | @retval EFI_INVALID_PARAMETER BltOperation is not valid.\r | |
210 | @retval EFI_DEVICE_ERROR A hardware error occured writting to the video buffer.\r | |
211 | \r | |
212 | **/\r | |
213 | typedef\r | |
214 | EFI_STATUS\r | |
8b13229b | 215 | (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT)(\r |
d1f95000 | 216 | IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r |
217 | IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL\r | |
218 | IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,\r | |
219 | IN UINTN SourceX,\r | |
220 | IN UINTN SourceY,\r | |
221 | IN UINTN DestinationX,\r | |
222 | IN UINTN DestinationY,\r | |
223 | IN UINTN Width,\r | |
224 | IN UINTN Height,\r | |
225 | IN UINTN Delta OPTIONAL\r | |
226 | );\r | |
227 | \r | |
228 | typedef struct {\r | |
74fec708 LG |
229 | ///\r |
230 | /// The number of modes supported by QueryMode() and SetMode().\r | |
231 | ///\r | |
d1f95000 | 232 | UINT32 MaxMode;\r |
74fec708 LG |
233 | ///\r |
234 | /// Current Mode of the graphics device. Valid mode numbers are 0 to MaxMode -1.\r | |
235 | ///\r | |
d1f95000 | 236 | UINT32 Mode;\r |
74fec708 LG |
237 | ///\r |
238 | /// Pointer to read-only EFI_GRAPHICS_OUTPUT_MODE_INFORMATION data.\r | |
239 | ///\r | |
d1f95000 | 240 | EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r |
74fec708 LG |
241 | ///\r |
242 | /// Size of Info structure in bytes.\r | |
243 | ///\r | |
d1f95000 | 244 | UINTN SizeOfInfo;\r |
74fec708 LG |
245 | ///\r |
246 | /// Base address of graphics linear frame buffer.\r | |
247 | /// Offset zero in FrameBufferBase represents the upper left pixel of the display.\r | |
248 | ///\r | |
d1f95000 | 249 | EFI_PHYSICAL_ADDRESS FrameBufferBase;\r |
74fec708 LG |
250 | ///\r |
251 | /// Size of the frame buffer represented by FrameBufferBase in bytes.\r | |
252 | ///\r | |
d1f95000 | 253 | UINTN FrameBufferSize;\r |
254 | } EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;\r | |
255 | \r | |
44717a39 | 256 | ///\r |
257 | /// Provides a basic abstraction to set video modes and copy pixels to and from \r | |
258 | /// the graphics controller's frame buffer. The linear address of the hardware \r | |
259 | /// frame buffer is also exposed so software can write directly to the video hardware.\r | |
260 | ///\r | |
d1f95000 | 261 | struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {\r |
262 | EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode;\r | |
263 | EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode;\r | |
264 | EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt;\r | |
44717a39 | 265 | ///\r |
266 | /// Pointer to EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE data.\r | |
267 | ///\r | |
d1f95000 | 268 | EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;\r |
269 | };\r | |
270 | \r | |
271 | extern EFI_GUID gEfiGraphicsOutputProtocolGuid;\r | |
272 | \r | |
273 | #endif\r |