]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/UgaDraw.h
b450cdc285e19c2bfc03c2280a1dac5db77a7225
[mirror_edk2.git] / MdePkg / Include / Protocol / UgaDraw.h
1 /** @file
2 UGA Draw protocol from the EFI 1.1 specification.
3
4 Abstraction of a very simple graphics device.
5
6 Copyright (c) 2006, 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 #define EFI_UGA_DRAW_PROTOCOL_GUID \
21 { \
22 0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 } \
23 }
24
25 typedef struct _EFI_UGA_DRAW_PROTOCOL EFI_UGA_DRAW_PROTOCOL;
26
27 /**
28 Return the current video mode information.
29
30 @param This Protocol instance pointer.
31 @param HorizontalResolution Current video horizontal resolution in pixels
32 @param VerticalResolution Current video vertical resolution in pixels
33 @param ColorDepth Current video color depth in bits per pixel
34 @param RefreshRate Current video refresh rate in Hz.
35
36 @retval EFI_SUCCESS Mode information returned.
37 @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
38 @retval EFI_INVALID_PARAMETER One of the input args was NULL.
39
40 **/
41 typedef
42 EFI_STATUS
43 (EFIAPI *EFI_UGA_DRAW_PROTOCOL_GET_MODE) (
44 IN EFI_UGA_DRAW_PROTOCOL *This,
45 OUT UINT32 *HorizontalResolution,
46 OUT UINT32 *VerticalResolution,
47 OUT UINT32 *ColorDepth,
48 OUT UINT32 *RefreshRate
49 )
50 ;
51
52 /**
53 Return the current video mode information.
54
55 @param This Protocol instance pointer.
56 @param HorizontalResolution Current video horizontal resolution in pixels
57 @param VerticalResolution Current video vertical resolution in pixels
58 @param ColorDepth Current video color depth in bits per pixel
59 @param RefreshRate Current video refresh rate in Hz.
60
61 @retval EFI_SUCCESS Mode information returned.
62 @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
63
64 **/
65 typedef
66 EFI_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 ;
75
76 typedef struct {
77 UINT8 Blue;
78 UINT8 Green;
79 UINT8 Red;
80 UINT8 Reserved;
81 } EFI_UGA_PIXEL;
82
83 typedef union {
84 EFI_UGA_PIXEL Pixel;
85 UINT32 Raw;
86 } EFI_UGA_PIXEL_UNION;
87
88 typedef enum {
89 EfiUgaVideoFill,
90 EfiUgaVideoToBltBuffer,
91 EfiUgaBltBufferToVideo,
92 EfiUgaVideoToVideo,
93 EfiUgaBltMax
94 } EFI_UGA_BLT_OPERATION;
95
96 /**
97 Type specifying a pointer to a function to perform an UGA Blt operation.
98
99 The following table defines actions for BltOperations:
100
101 <B>EfiUgaVideoFill</B> - Write data from the BltBuffer pixel (SourceX, SourceY)
102 directly to every pixel of the video display rectangle
103 (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
104 Only one pixel will be used from the BltBuffer. Delta is NOT used.
105
106 <B>EfiUgaVideoToBltBuffer</B> - Read data from the video display rectangle
107 (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
108 the BltBuffer rectangle (DestinationX, DestinationY )
109 (DestinationX + Width, DestinationY + Height). If DestinationX or
110 DestinationY is not zero then Delta must be set to the length in bytes
111 of a row in the BltBuffer.
112
113 <B>EfiUgaBltBufferToVideo</B> - Write data from the BltBuffer rectangle
114 (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
115 video display rectangle (DestinationX, DestinationY)
116 (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
117 not zero then Delta must be set to the length in bytes of a row in the
118 BltBuffer.
119
120 <B>EfiUgaVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
121 (SourceX + Width, SourceY + Height) .to the video display rectangle
122 (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
123 The BltBuffer and Delta are not used in this mode.
124
125
126 @param[in] This - Protocol instance pointer.
127 @param[in] BltBuffer - Buffer containing data to blit into video buffer. This
128 buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)
129 @param[in] BltOperation - Operation to perform on BlitBuffer and video memory
130 @param[in] SourceX - X coordinate of source for the BltBuffer.
131 @param[in] SourceY - Y coordinate of source for the BltBuffer.
132 @param[in] DestinationX - X coordinate of destination for the BltBuffer.
133 @param[in] DestinationY - Y coordinate of destination for the BltBuffer.
134 @param[in] Width - Width of rectangle in BltBuffer in pixels.
135 @param[in] Height - Hight of rectangle in BltBuffer in pixels.
136 @param[in] Delta - OPTIONAL
137
138 @retval EFI_SUCCESS - The Blt operation completed.
139 @retval EFI_INVALID_PARAMETER - BltOperation is not valid.
140 @retval EFI_DEVICE_ERROR - A hardware error occured writting to the video buffer.
141
142 --*/
143 typedef
144 EFI_STATUS
145 (EFIAPI *EFI_UGA_DRAW_PROTOCOL_BLT) (
146 IN EFI_UGA_DRAW_PROTOCOL * This,
147 IN EFI_UGA_PIXEL * BltBuffer, OPTIONAL
148 IN EFI_UGA_BLT_OPERATION BltOperation,
149 IN UINTN SourceX,
150 IN UINTN SourceY,
151 IN UINTN DestinationX,
152 IN UINTN DestinationY,
153 IN UINTN Width,
154 IN UINTN Height,
155 IN UINTN Delta OPTIONAL
156 );
157
158 struct _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
164 extern EFI_GUID gEfiUgaDrawProtocolGuid;
165
166 #endif