]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/C/Include/Protocol/GraphicsOutput.h
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Source / C / Include / Protocol / GraphicsOutput.h
CommitLineData
30fdf114
LG
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
f7496d71 6 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
30fdf114 7\r
2e351cbe 8 SPDX-License-Identifier: BSD-2-Clause-Patent\r
30fdf114 9\r
30fdf114
LG
10**/\r
11\r
12#ifndef __GRAPHICS_OUTPUT_H__\r
13#define __GRAPHICS_OUTPUT_H__\r
14\r
15#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \\r
16 { \\r
17 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } \\r
18 }\r
19\r
20typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL;\r
21\r
22typedef struct {\r
23 UINT32 RedMask;\r
24 UINT32 GreenMask;\r
25 UINT32 BlueMask;\r
26 UINT32 ReservedMask;\r
27} EFI_PIXEL_BITMASK;\r
28\r
29typedef enum {\r
30 PixelRedGreenBlueReserved8BitPerColor,\r
31 PixelBlueGreenRedReserved8BitPerColor,\r
32 PixelBitMask,\r
33 PixelBltOnly,\r
34 PixelFormatMax\r
35} EFI_GRAPHICS_PIXEL_FORMAT;\r
36\r
37typedef struct {\r
38 UINT32 Version;\r
39 UINT32 HorizontalResolution;\r
40 UINT32 VerticalResolution;\r
41 EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;\r
42 EFI_PIXEL_BITMASK PixelInformation;\r
43 UINT32 PixelsPerScanLine;\r
44} EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;\r
45\r
46/**\r
47 Return the current video mode information.\r
48\r
49 @param This Protocol instance pointer.\r
50 @param ModeNumber The mode number to return information on.\r
51 @param SizeOfInfo A pointer to the size, in bytes, of the Info buffer.\r
52 @param Info A pointer to callee allocated buffer that returns information about ModeNumber.\r
53\r
54 @retval EFI_SUCCESS Mode information returned.\r
55 @retval EFI_BUFFER_TOO_SMALL The Info buffer was too small.\r
56 @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode.\r
57 @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()\r
58 @retval EFI_INVALID_PARAMETER One of the input args was NULL.\r
59\r
60**/\r
61typedef\r
62EFI_STATUS\r
63(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) (\r
64 IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
65 IN UINT32 ModeNumber,\r
66 OUT UINTN *SizeOfInfo,\r
67 OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info\r
68 )\r
69;\r
70\r
71/**\r
72 Return the current video mode information.\r
73\r
74 @param This Protocol instance pointer.\r
75 @param ModeNumber The mode number to be set.\r
76\r
77 @retval EFI_SUCCESS Graphics mode was changed.\r
78 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
79 @retval EFI_UNSUPPORTED ModeNumber is not supported by this device.\r
80\r
81**/\r
82typedef\r
83EFI_STATUS\r
84(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) (\r
85 IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
86 IN UINT32 ModeNumber\r
87 )\r
88;\r
89\r
90typedef struct {\r
91 UINT8 Blue;\r
92 UINT8 Green;\r
93 UINT8 Red;\r
94 UINT8 Reserved;\r
95} EFI_GRAPHICS_OUTPUT_BLT_PIXEL;\r
96\r
97typedef union {\r
98 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;\r
99 UINT32 Raw;\r
100} EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;\r
101\r
102typedef enum {\r
103 EfiBltVideoFill,\r
104 EfiBltVideoToBltBuffer,\r
f7496d71 105 EfiBltBufferToVideo,\r
30fdf114
LG
106 EfiBltVideoToVideo,\r
107 EfiGraphicsOutputBltOperationMax\r
108} EFI_GRAPHICS_OUTPUT_BLT_OPERATION;\r
109\r
110/**\r
111 The following table defines actions for BltOperations:\r
112\r
f7496d71
LG
113 <B>EfiBltVideoFill</B> - Write data from the BltBuffer pixel (SourceX, SourceY)\r
114 directly to every pixel of the video display rectangle\r
115 (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).\r
30fdf114
LG
116 Only one pixel will be used from the BltBuffer. Delta is NOT used.\r
117\r
f7496d71
LG
118 <B>EfiBltVideoToBltBuffer</B> - Read data from the video display rectangle\r
119 (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in\r
120 the BltBuffer rectangle (DestinationX, DestinationY )\r
121 (DestinationX + Width, DestinationY + Height). If DestinationX or\r
122 DestinationY is not zero then Delta must be set to the length in bytes\r
30fdf114
LG
123 of a row in the BltBuffer.\r
124\r
f7496d71
LG
125 <B>EfiBltBufferToVideo</B> - Write data from the BltBuffer rectangle\r
126 (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the\r
127 video display rectangle (DestinationX, DestinationY)\r
128 (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is\r
129 not zero then Delta must be set to the length in bytes of a row in the\r
30fdf114
LG
130 BltBuffer.\r
131\r
132 <B>EfiBltVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)\r
f7496d71
LG
133 (SourceX + Width, SourceY + Height) .to the video display rectangle\r
134 (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).\r
30fdf114
LG
135 The BltBuffer and Delta are not used in this mode.\r
136\r
137 @param This Protocol instance pointer.\r
138 @param BltBuffer Buffer containing data to blit into video buffer. This\r
139 buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
140 @param BltOperation Operation to perform on BlitBuffer and video memory\r
141 @param SourceX X coordinate of source for the BltBuffer.\r
142 @param SourceY Y coordinate of source for the BltBuffer.\r
143 @param DestinationX X coordinate of destination for the BltBuffer.\r
144 @param DestinationY Y coordinate of destination for the BltBuffer.\r
145 @param Width Width of rectangle in BltBuffer in pixels.\r
fb0b35e0 146 @param Height Height of rectangle in BltBuffer in pixels.\r
30fdf114
LG
147 @param Delta OPTIONAL\r
148\r
149 @retval EFI_SUCCESS The Blt operation completed.\r
150 @retval EFI_INVALID_PARAMETER BltOperation is not valid.\r
fb0b35e0 151 @retval EFI_DEVICE_ERROR A hardware error occurred writing to the video buffer.\r
30fdf114
LG
152\r
153**/\r
154typedef\r
155EFI_STATUS\r
156(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) (\r
157 IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
158 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL\r
159 IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,\r
160 IN UINTN SourceX,\r
161 IN UINTN SourceY,\r
162 IN UINTN DestinationX,\r
163 IN UINTN DestinationY,\r
164 IN UINTN Width,\r
165 IN UINTN Height,\r
166 IN UINTN Delta OPTIONAL\r
167 );\r
168\r
169typedef struct {\r
170 UINT32 MaxMode;\r
171 UINT32 Mode;\r
172 EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r
173 UINTN SizeOfInfo;\r
174 EFI_PHYSICAL_ADDRESS FrameBufferBase;\r
175 UINTN FrameBufferSize;\r
176} EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;\r
177\r
178struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {\r
179 EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode;\r
180 EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode;\r
181 EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt;\r
182 EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;\r
183};\r
184\r
185extern EFI_GUID gEfiGraphicsOutputProtocolGuid;\r
186\r
187#endif\r