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