]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/UgaDraw.h
Update CopyRight to 2008
[mirror_edk2.git] / MdePkg / Include / Protocol / UgaDraw.h
1 /** @file
2 UGA Draw protocol from the EFI 1.10 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 __UGA_DRAW_H__
18 #define __UGA_DRAW_H__
19
20 #include <PiDxe.h>
21
22
23 #define EFI_UGA_DRAW_PROTOCOL_GUID \
24 { \
25 0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 } \
26 }
27
28 typedef struct _EFI_UGA_DRAW_PROTOCOL EFI_UGA_DRAW_PROTOCOL;
29
30 /**
31 Return the current video mode information.
32
33 @param This Protocol instance pointer.
34 @param HorizontalResolution Current video horizontal resolution in pixels
35 @param VerticalResolution Current video vertical resolution in pixels
36 @param ColorDepth Current video color depth in bits per pixel
37 @param RefreshRate Current video refresh rate in Hz.
38
39 @retval EFI_SUCCESS Mode information returned.
40 @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
41 @retval EFI_INVALID_PARAMETER One of the input args was NULL.
42
43 **/
44 typedef
45 EFI_STATUS
46 (EFIAPI *EFI_UGA_DRAW_PROTOCOL_GET_MODE)(
47 IN EFI_UGA_DRAW_PROTOCOL *This,
48 OUT UINT32 *HorizontalResolution,
49 OUT UINT32 *VerticalResolution,
50 OUT UINT32 *ColorDepth,
51 OUT UINT32 *RefreshRate
52 )
53 ;
54
55 /**
56 Set the current video mode information.
57
58 @param This Protocol instance pointer.
59 @param HorizontalResolution Current video horizontal resolution in pixels
60 @param VerticalResolution Current video vertical resolution in pixels
61 @param ColorDepth Current video color depth in bits per pixel
62 @param RefreshRate Current video refresh rate in Hz.
63
64 @retval EFI_SUCCESS Mode information returned.
65 @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
66
67 **/
68 typedef
69 EFI_STATUS
70 (EFIAPI *EFI_UGA_DRAW_PROTOCOL_SET_MODE)(
71 IN EFI_UGA_DRAW_PROTOCOL *This,
72 IN UINT32 HorizontalResolution,
73 IN UINT32 VerticalResolution,
74 IN UINT32 ColorDepth,
75 IN UINT32 RefreshRate
76 )
77 ;
78
79 typedef struct {
80 UINT8 Blue;
81 UINT8 Green;
82 UINT8 Red;
83 UINT8 Reserved;
84 } EFI_UGA_PIXEL;
85
86 typedef union {
87 EFI_UGA_PIXEL Pixel;
88 UINT32 Raw;
89 } EFI_UGA_PIXEL_UNION;
90
91 typedef enum {
92 EfiUgaVideoFill,
93 EfiUgaVideoToBltBuffer,
94 EfiUgaBltBufferToVideo,
95 EfiUgaVideoToVideo,
96 EfiUgaBltMax
97 } EFI_UGA_BLT_OPERATION;
98
99 /**
100 Type specifying a pointer to a function to perform an UGA Blt operation.
101
102 The following table defines actions for BltOperations:
103
104 <B>EfiUgaVideoFill</B> - Write data from the BltBuffer pixel (SourceX, SourceY)
105 directly to every pixel of the video display rectangle
106 (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
107 Only one pixel will be used from the BltBuffer. Delta is NOT used.
108
109 <B>EfiUgaVideoToBltBuffer</B> - Read data from the video display rectangle
110 (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
111 the BltBuffer rectangle (DestinationX, DestinationY )
112 (DestinationX + Width, DestinationY + Height). If DestinationX or
113 DestinationY is not zero then Delta must be set to the length in bytes
114 of a row in the BltBuffer.
115
116 <B>EfiUgaBltBufferToVideo</B> - Write data from the BltBuffer rectangle
117 (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
118 video display rectangle (DestinationX, DestinationY)
119 (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
120 not zero then Delta must be set to the length in bytes of a row in the
121 BltBuffer.
122
123 <B>EfiUgaVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
124 (SourceX + Width, SourceY + Height) .to the video display rectangle
125 (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
126 The BltBuffer and Delta are not used in this mode.
127
128
129 @param[in] This - Protocol instance pointer.
130 @param[in] BltBuffer - Buffer containing data to blit into video buffer. This
131 buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)
132 @param[in] BltOperation - Operation to perform on BlitBuffer and video memory
133 @param[in] SourceX - X coordinate of source for the BltBuffer.
134 @param[in] SourceY - Y coordinate of source for the BltBuffer.
135 @param[in] DestinationX - X coordinate of destination for the BltBuffer.
136 @param[in] DestinationY - Y coordinate of destination for the BltBuffer.
137 @param[in] Width - Width of rectangle in BltBuffer in pixels.
138 @param[in] Height - Hight of rectangle in BltBuffer in pixels.
139 @param[in] Delta - OPTIONAL
140
141 @retval EFI_SUCCESS - The Blt operation completed.
142 @retval EFI_INVALID_PARAMETER - BltOperation is not valid.
143 @retval EFI_DEVICE_ERROR - A hardware error occured writting to the video buffer.
144
145 --*/
146 typedef
147 EFI_STATUS
148 (EFIAPI *EFI_UGA_DRAW_PROTOCOL_BLT)(
149 IN EFI_UGA_DRAW_PROTOCOL * This,
150 IN EFI_UGA_PIXEL * BltBuffer, OPTIONAL
151 IN EFI_UGA_BLT_OPERATION BltOperation,
152 IN UINTN SourceX,
153 IN UINTN SourceY,
154 IN UINTN DestinationX,
155 IN UINTN DestinationY,
156 IN UINTN Width,
157 IN UINTN Height,
158 IN UINTN Delta OPTIONAL
159 );
160
161 /**
162 This protocol provides a basic abstraction to set video modes and
163 copy pixels to and from the graphics controller's frame buffer.
164
165 @par Protocol Description:
166 The EFI_UGA_DRAW_PROTOCOL provides a software abstraction to allow pixels to be drawn
167 directly to the frame buffer. The EFI_UGA_DRAW_PROTOCOL is designed to be lightweight and
168 to support the basic needs of graphics output prior to Operating System boot.
169
170 @param GetMode
171 Returns information about the geometry and configuration of the
172 graphics controller's current frame buffer configuration.
173
174 @param SetMode
175 Set the graphics device into a given mode and clears the frame buffer to black.
176
177 @param Blt
178 Software abstraction to draw on the video device's frame buffer.
179 **/
180 struct _EFI_UGA_DRAW_PROTOCOL {
181 EFI_UGA_DRAW_PROTOCOL_GET_MODE GetMode;
182 EFI_UGA_DRAW_PROTOCOL_SET_MODE SetMode;
183 EFI_UGA_DRAW_PROTOCOL_BLT Blt;
184 };
185
186 extern EFI_GUID gEfiUgaDrawProtocolGuid;
187
188 #endif