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