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