]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/GraphicsOutput.h
Formalize comments for Protocols and PPIs.
[mirror_edk2.git] / MdePkg / Include / Protocol / GraphicsOutput.h
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 - 2008, Intel Corporation
7 All rights reserved. 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 PixelRedGreenBlueReserved8BitPerColor,
36 PixelBlueGreenRedReserved8BitPerColor,
37 PixelBitMask,
38 PixelBltOnly,
39 PixelFormatMax
40 } EFI_GRAPHICS_PIXEL_FORMAT;
41
42 typedef struct {
43 UINT32 Version;
44 UINT32 HorizontalResolution;
45 UINT32 VerticalResolution;
46 EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;
47 EFI_PIXEL_BITMASK PixelInformation;
48 UINT32 PixelsPerScanLine;
49 } EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;
50
51 /**
52 Return the current video mode information.
53
54 @param This Protocol instance pointer.
55 @param ModeNumber The mode number to return information on.
56 @param SizeOfInfo A pointer to the size, in bytes, of the Info buffer.
57 @param Info A pointer to callee allocated buffer that returns information about ModeNumber.
58
59 @retval EFI_SUCCESS Mode information returned.
60 @retval EFI_BUFFER_TOO_SMALL The Info buffer was too small.
61 @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode.
62 @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
63 @retval EFI_INVALID_PARAMETER One of the input args was NULL.
64
65 **/
66 typedef
67 EFI_STATUS
68 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE)(
69 IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
70 IN UINT32 ModeNumber,
71 OUT UINTN *SizeOfInfo,
72 OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
73 );
74
75 /**
76 Return the current video mode information.
77
78 @param This Protocol instance pointer.
79 @param ModeNumber The mode number to be set.
80
81 @retval EFI_SUCCESS Graphics mode was changed.
82 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
83 @retval EFI_UNSUPPORTED ModeNumber is not supported by this device.
84
85 **/
86 typedef
87 EFI_STATUS
88 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE)(
89 IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
90 IN UINT32 ModeNumber
91 );
92
93 typedef struct {
94 UINT8 Blue;
95 UINT8 Green;
96 UINT8 Red;
97 UINT8 Reserved;
98 } EFI_GRAPHICS_OUTPUT_BLT_PIXEL;
99
100 typedef union {
101 EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;
102 UINT32 Raw;
103 } EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;
104
105 ///
106 /// actions for BltOperations
107 ///
108 typedef enum {
109 ///
110 /// Write data from the BltBuffer pixel (SourceX, SourceY)
111 /// directly to every pixel of the video display rectangle
112 /// (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
113 /// Only one pixel will be used from the BltBuffer. Delta is NOT used.
114 ///
115 EfiBltVideoFill,
116
117 ///
118 /// Read data from the video display rectangle
119 /// (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
120 /// the BltBuffer rectangle (DestinationX, DestinationY )
121 /// (DestinationX + Width, DestinationY + Height). If DestinationX or
122 /// DestinationY is not zero then Delta must be set to the length in bytes
123 /// of a row in the BltBuffer.
124 ///
125 EfiBltVideoToBltBuffer,
126
127 ///
128 /// Write data from the BltBuffer rectangle
129 /// (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
130 /// video display rectangle (DestinationX, DestinationY)
131 /// (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
132 /// not zero then Delta must be set to the length in bytes of a row in the
133 /// BltBuffer.
134 ///
135 EfiBltBufferToVideo,
136
137 ///
138 /// Copy from the video display rectangle (SourceX, SourceY)
139 /// (SourceX + Width, SourceY + Height) .to the video display rectangle
140 /// (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
141 /// The BltBuffer and Delta are not used in this mode.
142 /// EfiBltVideoToVideo,
143 ///
144 EfiBltVideoToVideo,
145
146 EfiGraphicsOutputBltOperationMax
147 } EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
148
149 /**
150 Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer.
151
152 @param This Protocol instance pointer.
153 @param BltBuffer Buffer containing data to blit into video buffer. This
154 buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
155 @param BltOperation Operation to perform on BlitBuffer and video memory
156 @param SourceX X coordinate of source for the BltBuffer.
157 @param SourceY Y coordinate of source for the BltBuffer.
158 @param DestinationX X coordinate of destination for the BltBuffer.
159 @param DestinationY Y coordinate of destination for the BltBuffer.
160 @param Width Width of rectangle in BltBuffer in pixels.
161 @param Height Hight of rectangle in BltBuffer in pixels.
162 @param Delta OPTIONAL
163
164 @retval EFI_SUCCESS The Blt operation completed.
165 @retval EFI_INVALID_PARAMETER BltOperation is not valid.
166 @retval EFI_DEVICE_ERROR A hardware error occured writting to the video buffer.
167
168 **/
169 typedef
170 EFI_STATUS
171 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT)(
172 IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
173 IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
174 IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
175 IN UINTN SourceX,
176 IN UINTN SourceY,
177 IN UINTN DestinationX,
178 IN UINTN DestinationY,
179 IN UINTN Width,
180 IN UINTN Height,
181 IN UINTN Delta OPTIONAL
182 );
183
184 typedef struct {
185 UINT32 MaxMode;
186 UINT32 Mode;
187 EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
188 UINTN SizeOfInfo;
189 EFI_PHYSICAL_ADDRESS FrameBufferBase;
190 UINTN FrameBufferSize;
191 } EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;
192
193 ///
194 /// Provides a basic abstraction to set video modes and copy pixels to and from
195 /// the graphics controller's frame buffer. The linear address of the hardware
196 /// frame buffer is also exposed so software can write directly to the video hardware.
197 ///
198 struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {
199 EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode;
200 EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode;
201 EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt;
202 ///
203 /// Pointer to EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE data.
204 ///
205 EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;
206 };
207
208 extern EFI_GUID gEfiGraphicsOutputProtocolGuid;
209
210 #endif