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