blob: 17db38db086e865a86576ec97382c60847addea4 [file] [log] [blame]
Vishal Bhoj82c80712015-12-15 21:13:33 +05301/** @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. All rights reserved.<BR>
7 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
21#define EFI_UGA_DRAW_PROTOCOL_GUID \
22 { \
23 0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 } \
24 }
25
26typedef struct _EFI_UGA_DRAW_PROTOCOL EFI_UGA_DRAW_PROTOCOL;
27
28/**
29 Return the current video mode information.
30
31 @param This The EFI_UGA_DRAW_PROTOCOL instance.
32 @param HorizontalResolution The size of video screen in pixels in the X dimension.
33 @param VerticalResolution The size of video screen in pixels in the Y dimension.
34 @param ColorDepth Number of bits per pixel, currently defined to be 32.
35 @param RefreshRate The refresh rate of the monitor in Hertz.
36
37 @retval EFI_SUCCESS Mode information returned.
38 @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
39 @retval EFI_INVALID_PARAMETER One of the input args was NULL.
40
41**/
42typedef
43EFI_STATUS
44(EFIAPI *EFI_UGA_DRAW_PROTOCOL_GET_MODE)(
45 IN EFI_UGA_DRAW_PROTOCOL *This,
46 OUT UINT32 *HorizontalResolution,
47 OUT UINT32 *VerticalResolution,
48 OUT UINT32 *ColorDepth,
49 OUT UINT32 *RefreshRate
50 );
51
52/**
53 Set the current video mode information.
54
55 @param This The EFI_UGA_DRAW_PROTOCOL instance.
56 @param HorizontalResolution The size of video screen in pixels in the X dimension.
57 @param VerticalResolution The size of video screen in pixels in the Y dimension.
58 @param ColorDepth Number of bits per pixel, currently defined to be 32.
59 @param RefreshRate The refresh rate of the monitor in Hertz.
60
61 @retval EFI_SUCCESS Mode information returned.
62 @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
63
64**/
65typedef
66EFI_STATUS
67(EFIAPI *EFI_UGA_DRAW_PROTOCOL_SET_MODE)(
68 IN EFI_UGA_DRAW_PROTOCOL *This,
69 IN UINT32 HorizontalResolution,
70 IN UINT32 VerticalResolution,
71 IN UINT32 ColorDepth,
72 IN UINT32 RefreshRate
73 );
74
75typedef struct {
76 UINT8 Blue;
77 UINT8 Green;
78 UINT8 Red;
79 UINT8 Reserved;
80} EFI_UGA_PIXEL;
81
82typedef union {
83 EFI_UGA_PIXEL Pixel;
84 UINT32 Raw;
85} EFI_UGA_PIXEL_UNION;
86
87///
88/// Enumration value for actions of Blt operations.
89///
90typedef enum {
91 EfiUgaVideoFill, ///< Write data from the BltBuffer pixel (SourceX, SourceY)
92 ///< directly to every pixel of the video display rectangle
93 ///< (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
94 ///< Only one pixel will be used from the BltBuffer. Delta is NOT used.
95
96 EfiUgaVideoToBltBuffer, ///< Read data from the video display rectangle
97 ///< (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
98 ///< the BltBuffer rectangle (DestinationX, DestinationY )
99 ///< (DestinationX + Width, DestinationY + Height). If DestinationX or
100 ///< DestinationY is not zero then Delta must be set to the length in bytes
101 ///< of a row in the BltBuffer.
102
103 EfiUgaBltBufferToVideo, ///< Write data from the BltBuffer rectangle
104 ///< (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
105 ///< video display rectangle (DestinationX, DestinationY)
106 ///< (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
107 ///< not zero then Delta must be set to the length in bytes of a row in the
108 ///< BltBuffer.
109
110 EfiUgaVideoToVideo, ///< Copy from the video display rectangle (SourceX, SourceY)
111 ///< (SourceX + Width, SourceY + Height) .to the video display rectangle
112 ///< (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
113 ///< The BltBuffer and Delta are not used in this mode.
114
115 EfiUgaBltMax ///< Maxmimum value for enumration value of Blt operation. If a Blt operation
116 ///< larger or equal to this enumration value, it is invalid.
117} EFI_UGA_BLT_OPERATION;
118
119/**
120 Blt a rectangle of pixels on the graphics screen.
121
122 @param[in] This - Protocol instance pointer.
123 @param[in] BltBuffer - Buffer containing data to blit into video buffer. This
124 buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)
125 @param[in] BltOperation - Operation to perform on BlitBuffer and video memory
126 @param[in] SourceX - X coordinate of source for the BltBuffer.
127 @param[in] SourceY - Y coordinate of source for the BltBuffer.
128 @param[in] DestinationX - X coordinate of destination for the BltBuffer.
129 @param[in] DestinationY - Y coordinate of destination for the BltBuffer.
130 @param[in] Width - Width of rectangle in BltBuffer in pixels.
131 @param[in] Height - Hight of rectangle in BltBuffer in pixels.
132 @param[in] Delta - OPTIONAL
133
134 @retval EFI_SUCCESS - The Blt operation completed.
135 @retval EFI_INVALID_PARAMETER - BltOperation is not valid.
136 @retval EFI_DEVICE_ERROR - A hardware error occured writting to the video buffer.
137
138**/
139typedef
140EFI_STATUS
141(EFIAPI *EFI_UGA_DRAW_PROTOCOL_BLT)(
142 IN EFI_UGA_DRAW_PROTOCOL * This,
143 IN EFI_UGA_PIXEL * BltBuffer, OPTIONAL
144 IN EFI_UGA_BLT_OPERATION BltOperation,
145 IN UINTN SourceX,
146 IN UINTN SourceY,
147 IN UINTN DestinationX,
148 IN UINTN DestinationY,
149 IN UINTN Width,
150 IN UINTN Height,
151 IN UINTN Delta OPTIONAL
152 );
153
154///
155/// This protocol provides a basic abstraction to set video modes and
156/// copy pixels to and from the graphics controller's frame buffer.
157///
158struct _EFI_UGA_DRAW_PROTOCOL {
159 EFI_UGA_DRAW_PROTOCOL_GET_MODE GetMode;
160 EFI_UGA_DRAW_PROTOCOL_SET_MODE SetMode;
161 EFI_UGA_DRAW_PROTOCOL_BLT Blt;
162};
163
164extern EFI_GUID gEfiUgaDrawProtocolGuid;
165
166#endif