]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/GraphicsOutput.h
MdePkg/ProcessorBind: add defines for page allocation granularity
[mirror_edk2.git] / MdePkg / Include / Protocol / GraphicsOutput.h
... / ...
CommitLineData
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
6 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
7 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
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
25typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL;\r
26\r
27typedef 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
34typedef enum {\r
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
42 PixelRedGreenBlueReserved8BitPerColor,\r
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
50 PixelBlueGreenRedReserved8BitPerColor,\r
51 ///\r
52 /// The Pixel definition of the physical frame buffer.\r
53 ///\r
54 PixelBitMask,\r
55 ///\r
56 /// This mode does not support a physical frame buffer.\r
57 ///\r
58 PixelBltOnly,\r
59 ///\r
60 /// Valid EFI_GRAPHICS_PIXEL_FORMAT enum values are less than this value.\r
61 ///\r
62 PixelFormatMax\r
63} EFI_GRAPHICS_PIXEL_FORMAT;\r
64\r
65typedef struct {\r
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
70 UINT32 Version;\r
71 ///\r
72 /// The size of video screen in pixels in the X dimension.\r
73 ///\r
74 UINT32 HorizontalResolution;\r
75 ///\r
76 /// The size of video screen in pixels in the Y dimension.\r
77 ///\r
78 UINT32 VerticalResolution;\r
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
83 EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;\r
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
88 EFI_PIXEL_BITMASK PixelInformation;\r
89 ///\r
90 /// Defines the number of pixel elements per video memory line.\r
91 /// \r
92 UINT32 PixelsPerScanLine;\r
93} EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;\r
94\r
95/**\r
96 Returns information for an available graphics mode that the graphics device\r
97 and the set of active video output devices supports.\r
98\r
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
103\r
104 @retval EFI_SUCCESS Valid mode information was returned.\r
105 @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode.\r
106 @retval EFI_INVALID_PARAMETER ModeNumber is not valid.\r
107\r
108**/\r
109typedef\r
110EFI_STATUS\r
111(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE)(\r
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
116 );\r
117\r
118/**\r
119 Set the video device into the specified mode and clears the visible portions of \r
120 the output display to black.\r
121\r
122 @param This The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.\r
123 @param ModeNumber Abstraction that defines the current video mode.\r
124\r
125 @retval EFI_SUCCESS The graphics mode specified by ModeNumber was selected.\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
130typedef\r
131EFI_STATUS\r
132(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE)(\r
133 IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
134 IN UINT32 ModeNumber\r
135 );\r
136\r
137typedef 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
144typedef union {\r
145 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;\r
146 UINT32 Raw;\r
147} EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;\r
148\r
149///\r
150/// actions for BltOperations\r
151///\r
152typedef enum {\r
153 ///\r
154 /// Write data from the BltBuffer pixel (0, 0) \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
159 EfiBltVideoFill,\r
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
169 EfiBltVideoToBltBuffer,\r
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
179 EfiBltBufferToVideo, \r
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 ///\r
187 EfiBltVideoToVideo,\r
188 \r
189 EfiGraphicsOutputBltOperationMax\r
190} EFI_GRAPHICS_OUTPUT_BLT_OPERATION;\r
191\r
192/**\r
193 Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer.\r
194 \r
195 @param This Protocol instance pointer.\r
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
209\r
210 @retval EFI_SUCCESS BltBuffer was drawn to the graphics screen.\r
211 @retval EFI_INVALID_PARAMETER BltOperation is not valid.\r
212 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
213\r
214**/\r
215typedef\r
216EFI_STATUS\r
217(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT)(\r
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
230typedef struct {\r
231 ///\r
232 /// The number of modes supported by QueryMode() and SetMode().\r
233 ///\r
234 UINT32 MaxMode;\r
235 ///\r
236 /// Current Mode of the graphics device. Valid mode numbers are 0 to MaxMode -1.\r
237 ///\r
238 UINT32 Mode;\r
239 ///\r
240 /// Pointer to read-only EFI_GRAPHICS_OUTPUT_MODE_INFORMATION data.\r
241 ///\r
242 EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r
243 ///\r
244 /// Size of Info structure in bytes.\r
245 ///\r
246 UINTN SizeOfInfo;\r
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
251 EFI_PHYSICAL_ADDRESS FrameBufferBase;\r
252 ///\r
253 /// Amount of frame buffer needed to support the active mode as defined by \r
254 /// PixelsPerScanLine xVerticalResolution x PixelElementSize.\r
255 ///\r
256 UINTN FrameBufferSize;\r
257} EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;\r
258\r
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
264struct _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
268 ///\r
269 /// Pointer to EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE data.\r
270 ///\r
271 EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;\r
272};\r
273\r
274extern EFI_GUID gEfiGraphicsOutputProtocolGuid;\r
275\r
276#endif\r