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