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