]>
Commit | Line | Data |
---|---|---|
fb0b259e | 1 | /** @file\r |
9937b365 | 2 | Support for Graphics output spliter.\r |
3 | \r | |
e5eed7d3 HT |
4 | Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r |
5 | This program and the accompanying materials\r | |
95276127 | 6 | are licensed and made available under the terms and conditions of the BSD License\r |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
a4d608d1 | 13 | \r |
fb0b259e | 14 | **/\r |
95276127 | 15 | \r |
95276127 | 16 | #include "ConSplitter.h"\r |
17 | \r | |
95276127 | 18 | \r |
fe1e36e5 | 19 | CHAR16 mCrLfString[3] = { CHAR_CARRIAGE_RETURN, CHAR_LINEFEED, CHAR_NULL };\r |
a4d608d1 | 20 | \r |
a4d608d1 | 21 | /**\r |
2da292f6 | 22 | Returns information for an available graphics mode that the graphics device\r |
23 | and the set of active video output devices supports.\r | |
a4d608d1 | 24 | \r |
2da292f6 | 25 | @param This The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.\r |
26 | @param ModeNumber The mode number to return information on.\r | |
27 | @param SizeOfInfo A pointer to the size, in bytes, of the Info buffer.\r | |
28 | @param Info A pointer to callee allocated buffer that returns information about ModeNumber.\r | |
a4d608d1 | 29 | \r |
2da292f6 | 30 | @retval EFI_SUCCESS Mode information returned.\r |
31 | @retval EFI_BUFFER_TOO_SMALL The Info buffer was too small.\r | |
32 | @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode.\r | |
33 | @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()\r | |
34 | @retval EFI_INVALID_PARAMETER One of the input args was NULL.\r | |
35 | @retval EFI_OUT_OF_RESOURCES No resource available.\r | |
a4d608d1 | 36 | \r |
37 | **/\r | |
95276127 | 38 | EFI_STATUS\r |
39 | EFIAPI\r | |
d6e11f22 | 40 | ConSplitterGraphicsOutputQueryMode (\r |
95276127 | 41 | IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r |
42 | IN UINT32 ModeNumber,\r | |
43 | OUT UINTN *SizeOfInfo,\r | |
44 | OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info\r | |
45 | )\r | |
95276127 | 46 | {\r |
47 | TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r | |
95276127 | 48 | \r |
49 | if (This == NULL || Info == NULL || SizeOfInfo == NULL || ModeNumber >= This->Mode->MaxMode) {\r | |
50 | return EFI_INVALID_PARAMETER;\r | |
51 | }\r | |
52 | \r | |
53 | //\r | |
54 | // retrieve private data\r | |
55 | //\r | |
56 | Private = GRAPHICS_OUTPUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r | |
57 | \r | |
58 | if (Private->HardwareNeedsStarting) {\r | |
59 | return EFI_NOT_STARTED;\r | |
60 | }\r | |
61 | \r | |
62 | *Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));\r | |
95276127 | 63 | if (*Info == NULL) {\r |
64 | return EFI_OUT_OF_RESOURCES;\r | |
65 | }\r | |
66 | \r | |
67 | *SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);\r | |
68 | \r | |
aec072ad | 69 | CopyMem (*Info, &Private->GraphicsOutputModeBuffer[ModeNumber], *SizeOfInfo);\r |
95276127 | 70 | \r |
71 | return EFI_SUCCESS;\r | |
72 | }\r | |
73 | \r | |
a4d608d1 | 74 | \r |
75 | /**\r | |
ed055f1b | 76 | Set the video device into the specified mode and clears the visible portions of\r |
2da292f6 | 77 | the output display to black.\r |
a4d608d1 | 78 | \r |
2da292f6 | 79 | @param This The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.\r |
80 | @param ModeNumber Abstraction that defines the current video mode.\r | |
a4d608d1 | 81 | \r |
2da292f6 | 82 | @retval EFI_SUCCESS The graphics mode specified by ModeNumber was selected.\r |
83 | @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r | |
84 | @retval EFI_UNSUPPORTED ModeNumber is not supported by this device.\r | |
85 | @retval EFI_OUT_OF_RESOURCES No resource available.\r | |
a4d608d1 | 86 | \r |
87 | **/\r | |
95276127 | 88 | EFI_STATUS\r |
89 | EFIAPI\r | |
d6e11f22 | 90 | ConSplitterGraphicsOutputSetMode (\r |
95276127 | 91 | IN EFI_GRAPHICS_OUTPUT_PROTOCOL * This,\r |
92 | IN UINT32 ModeNumber\r | |
93 | )\r | |
95276127 | 94 | {\r |
95 | EFI_STATUS Status;\r | |
96 | TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r | |
97 | UINTN Index;\r | |
98 | EFI_STATUS ReturnStatus;\r | |
aec072ad | 99 | EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Mode;\r |
95276127 | 100 | EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r |
101 | UINTN NumberIndex;\r | |
102 | UINTN SizeOfInfo;\r | |
103 | EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r | |
104 | EFI_UGA_DRAW_PROTOCOL *UgaDraw;\r | |
105 | \r | |
106 | if (ModeNumber >= This->Mode->MaxMode) {\r | |
107 | return EFI_UNSUPPORTED;\r | |
108 | }\r | |
109 | \r | |
95276127 | 110 | Private = GRAPHICS_OUTPUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r |
95276127 | 111 | Mode = &Private->GraphicsOutputModeBuffer[ModeNumber];\r |
95276127 | 112 | \r |
9937b365 | 113 | ReturnStatus = EFI_SUCCESS;\r |
95276127 | 114 | //\r |
115 | // return the worst status met\r | |
116 | //\r | |
117 | for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {\r | |
118 | GraphicsOutput = Private->TextOutList[Index].GraphicsOutput;\r | |
119 | if (GraphicsOutput != NULL) {\r | |
120 | //\r | |
121 | // Find corresponding ModeNumber of this GraphicsOutput instance\r | |
122 | //\r | |
123 | for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex ++) {\r | |
124 | Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) NumberIndex, &SizeOfInfo, &Info);\r | |
125 | if (EFI_ERROR (Status)) {\r | |
126 | return Status;\r | |
127 | }\r | |
128 | if ((Info->HorizontalResolution == Mode->HorizontalResolution) && (Info->VerticalResolution == Mode->VerticalResolution)) {\r | |
129 | FreePool (Info);\r | |
130 | break;\r | |
131 | }\r | |
132 | FreePool (Info);\r | |
133 | }\r | |
134 | \r | |
135 | Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32) NumberIndex);\r | |
136 | if (EFI_ERROR (Status)) {\r | |
137 | ReturnStatus = Status;\r | |
138 | }\r | |
2da292f6 | 139 | } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r |
d0c64728 | 140 | UgaDraw = Private->TextOutList[Index].UgaDraw;\r |
141 | if (UgaDraw != NULL) {\r | |
142 | Status = UgaDraw->SetMode (\r | |
143 | UgaDraw,\r | |
144 | Mode->HorizontalResolution,\r | |
145 | Mode->VerticalResolution,\r | |
146 | 32,\r | |
147 | 60\r | |
148 | );\r | |
149 | if (EFI_ERROR (Status)) {\r | |
150 | ReturnStatus = Status;\r | |
151 | }\r | |
95276127 | 152 | }\r |
153 | }\r | |
154 | }\r | |
155 | \r | |
156 | This->Mode->Mode = ModeNumber;\r | |
157 | \r | |
aec072ad | 158 | CopyMem (This->Mode->Info, &Private->GraphicsOutputModeBuffer[ModeNumber], This->Mode->SizeOfInfo);\r |
95276127 | 159 | \r |
160 | //\r | |
161 | // Information is not enough here, so the following items remain unchanged:\r | |
162 | // GraphicsOutputMode->Info->Version, GraphicsOutputMode->Info->PixelFormat\r | |
163 | // GraphicsOutputMode->SizeOfInfo, GraphicsOutputMode->FrameBufferBase, GraphicsOutputMode->FrameBufferSize\r | |
164 | // These items will be initialized/updated when a new GOP device is added into ConsoleSplitter.\r | |
165 | //\r | |
166 | \r | |
167 | Private->HardwareNeedsStarting = FALSE;\r | |
168 | \r | |
169 | return ReturnStatus;\r | |
170 | }\r | |
171 | \r | |
95276127 | 172 | \r |
a4d608d1 | 173 | \r |
174 | /**\r | |
175 | The following table defines actions for BltOperations.\r | |
176 | \r | |
177 | EfiBltVideoFill - Write data from the BltBuffer pixel (SourceX, SourceY)\r | |
178 | directly to every pixel of the video display rectangle\r | |
179 | (DestinationX, DestinationY)\r | |
180 | (DestinationX + Width, DestinationY + Height).\r | |
181 | Only one pixel will be used from the BltBuffer. Delta is NOT used.\r | |
182 | EfiBltVideoToBltBuffer - Read data from the video display rectangle\r | |
183 | (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in\r | |
184 | the BltBuffer rectangle (DestinationX, DestinationY )\r | |
185 | (DestinationX + Width, DestinationY + Height). If DestinationX or\r | |
186 | DestinationY is not zero then Delta must be set to the length in bytes\r | |
187 | of a row in the BltBuffer.\r | |
188 | EfiBltBufferToVideo - Write data from the BltBuffer rectangle\r | |
189 | (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the\r | |
190 | video display rectangle (DestinationX, DestinationY)\r | |
191 | (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is\r | |
192 | not zero then Delta must be set to the length in bytes of a row in the\r | |
193 | BltBuffer.\r | |
194 | EfiBltVideoToVideo - Copy from the video display rectangle\r | |
195 | (SourceX, SourceY) (SourceX + Width, SourceY + Height) .\r | |
196 | to the video display rectangle (DestinationX, DestinationY)\r | |
197 | (DestinationX + Width, DestinationY + Height).\r | |
198 | The BltBuffer and Delta are not used in this mode.\r | |
199 | \r | |
200 | @param This Protocol instance pointer.\r | |
201 | @param BltBuffer Buffer containing data to blit into video buffer.\r | |
202 | This buffer has a size of\r | |
203 | Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r | |
204 | @param BltOperation Operation to perform on BlitBuffer and video\r | |
205 | memory\r | |
206 | @param SourceX X coordinate of source for the BltBuffer.\r | |
207 | @param SourceY Y coordinate of source for the BltBuffer.\r | |
208 | @param DestinationX X coordinate of destination for the BltBuffer.\r | |
209 | @param DestinationY Y coordinate of destination for the BltBuffer.\r | |
210 | @param Width Width of rectangle in BltBuffer in pixels.\r | |
ed055f1b | 211 | @param Height Hight of rectangle in BltBuffer in pixels.\r |
33019a71 | 212 | @param Delta OPTIONAL.\r |
a4d608d1 | 213 | \r |
214 | @retval EFI_SUCCESS The Blt operation completed.\r | |
215 | @retval EFI_INVALID_PARAMETER BltOperation is not valid.\r | |
216 | @retval EFI_DEVICE_ERROR A hardware error occured writting to the video\r | |
217 | buffer.\r | |
218 | \r | |
219 | **/\r | |
95276127 | 220 | EFI_STATUS\r |
221 | EFIAPI\r | |
d6e11f22 | 222 | ConSplitterGraphicsOutputBlt (\r |
95276127 | 223 | IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r |
224 | IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL\r | |
225 | IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,\r | |
226 | IN UINTN SourceX,\r | |
227 | IN UINTN SourceY,\r | |
228 | IN UINTN DestinationX,\r | |
229 | IN UINTN DestinationY,\r | |
230 | IN UINTN Width,\r | |
231 | IN UINTN Height,\r | |
232 | IN UINTN Delta OPTIONAL\r | |
233 | )\r | |
95276127 | 234 | {\r |
235 | EFI_STATUS Status;\r | |
7389f649 | 236 | EFI_STATUS ReturnStatus;\r |
95276127 | 237 | TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r |
238 | UINTN Index;\r | |
95276127 | 239 | EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r |
240 | EFI_UGA_DRAW_PROTOCOL *UgaDraw;\r | |
241 | \r | |
97c74782 | 242 | if (This == NULL || ((UINTN) BltOperation) >= EfiGraphicsOutputBltOperationMax) {\r |
243 | return EFI_INVALID_PARAMETER;\r | |
244 | }\r | |
245 | \r | |
95276127 | 246 | Private = GRAPHICS_OUTPUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r |
247 | \r | |
7389f649 | 248 | ReturnStatus = EFI_SUCCESS;\r |
249 | \r | |
95276127 | 250 | //\r |
251 | // return the worst status met\r | |
252 | //\r | |
253 | for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {\r | |
254 | GraphicsOutput = Private->TextOutList[Index].GraphicsOutput;\r | |
255 | if (GraphicsOutput != NULL) {\r | |
256 | Status = GraphicsOutput->Blt (\r | |
257 | GraphicsOutput,\r | |
258 | BltBuffer,\r | |
259 | BltOperation,\r | |
260 | SourceX,\r | |
261 | SourceY,\r | |
262 | DestinationX,\r | |
263 | DestinationY,\r | |
264 | Width,\r | |
265 | Height,\r | |
266 | Delta\r | |
267 | );\r | |
268 | if (EFI_ERROR (Status)) {\r | |
269 | ReturnStatus = Status;\r | |
270 | } else if (BltOperation == EfiBltVideoToBltBuffer) {\r | |
271 | //\r | |
272 | // Only need to read the data into buffer one time\r | |
273 | //\r | |
274 | return EFI_SUCCESS;\r | |
275 | }\r | |
276 | }\r | |
277 | \r | |
278 | UgaDraw = Private->TextOutList[Index].UgaDraw;\r | |
8541adab | 279 | if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r |
95276127 | 280 | Status = UgaDraw->Blt (\r |
281 | UgaDraw,\r | |
282 | (EFI_UGA_PIXEL *) BltBuffer,\r | |
283 | (EFI_UGA_BLT_OPERATION) BltOperation,\r | |
284 | SourceX,\r | |
285 | SourceY,\r | |
286 | DestinationX,\r | |
287 | DestinationY,\r | |
288 | Width,\r | |
289 | Height,\r | |
290 | Delta\r | |
291 | );\r | |
292 | if (EFI_ERROR (Status)) {\r | |
293 | ReturnStatus = Status;\r | |
294 | } else if (BltOperation == EfiBltVideoToBltBuffer) {\r | |
295 | //\r | |
296 | // Only need to read the data into buffer one time\r | |
297 | //\r | |
298 | return EFI_SUCCESS;\r | |
299 | }\r | |
300 | }\r | |
301 | }\r | |
302 | \r | |
303 | return ReturnStatus;\r | |
304 | }\r | |
305 | \r | |
a4d608d1 | 306 | /**\r |
307 | Return the current video mode information.\r | |
308 | \r | |
2da292f6 | 309 | @param This The EFI_UGA_DRAW_PROTOCOL instance.\r |
310 | @param HorizontalResolution The size of video screen in pixels in the X dimension.\r | |
311 | @param VerticalResolution The size of video screen in pixels in the Y dimension.\r | |
312 | @param ColorDepth Number of bits per pixel, currently defined to be 32.\r | |
313 | @param RefreshRate The refresh rate of the monitor in Hertz.\r | |
a4d608d1 | 314 | \r |
2da292f6 | 315 | @retval EFI_SUCCESS Mode information returned.\r |
316 | @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()\r | |
317 | @retval EFI_INVALID_PARAMETER One of the input args was NULL.\r | |
a4d608d1 | 318 | \r |
319 | **/\r | |
d0c64728 | 320 | EFI_STATUS\r |
321 | EFIAPI\r | |
d6e11f22 | 322 | ConSplitterUgaDrawGetMode (\r |
d0c64728 | 323 | IN EFI_UGA_DRAW_PROTOCOL *This,\r |
324 | OUT UINT32 *HorizontalResolution,\r | |
325 | OUT UINT32 *VerticalResolution,\r | |
326 | OUT UINT32 *ColorDepth,\r | |
327 | OUT UINT32 *RefreshRate\r | |
328 | )\r | |
d0c64728 | 329 | {\r |
330 | TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r | |
331 | \r | |
a4d608d1 | 332 | if ((HorizontalResolution == NULL) ||\r |
2da292f6 | 333 | (VerticalResolution == NULL) ||\r |
334 | (RefreshRate == NULL) ||\r | |
335 | (ColorDepth == NULL)) {\r | |
d0c64728 | 336 | return EFI_INVALID_PARAMETER;\r |
337 | }\r | |
338 | //\r | |
339 | // retrieve private data\r | |
340 | //\r | |
341 | Private = UGA_DRAW_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r | |
342 | \r | |
343 | *HorizontalResolution = Private->UgaHorizontalResolution;\r | |
344 | *VerticalResolution = Private->UgaVerticalResolution;\r | |
345 | *ColorDepth = Private->UgaColorDepth;\r | |
346 | *RefreshRate = Private->UgaRefreshRate;\r | |
347 | \r | |
348 | return EFI_SUCCESS;\r | |
349 | }\r | |
350 | \r | |
a4d608d1 | 351 | \r |
352 | /**\r | |
2da292f6 | 353 | Set the current video mode information.\r |
a4d608d1 | 354 | \r |
2da292f6 | 355 | @param This The EFI_UGA_DRAW_PROTOCOL instance.\r |
356 | @param HorizontalResolution The size of video screen in pixels in the X dimension.\r | |
357 | @param VerticalResolution The size of video screen in pixels in the Y dimension.\r | |
358 | @param ColorDepth Number of bits per pixel, currently defined to be 32.\r | |
359 | @param RefreshRate The refresh rate of the monitor in Hertz.\r | |
a4d608d1 | 360 | \r |
2da292f6 | 361 | @retval EFI_SUCCESS Mode information returned.\r |
362 | @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()\r | |
363 | @retval EFI_OUT_OF_RESOURCES Out of resources.\r | |
a4d608d1 | 364 | \r |
365 | **/\r | |
d0c64728 | 366 | EFI_STATUS\r |
367 | EFIAPI\r | |
d6e11f22 | 368 | ConSplitterUgaDrawSetMode (\r |
d0c64728 | 369 | IN EFI_UGA_DRAW_PROTOCOL *This,\r |
370 | IN UINT32 HorizontalResolution,\r | |
371 | IN UINT32 VerticalResolution,\r | |
372 | IN UINT32 ColorDepth,\r | |
373 | IN UINT32 RefreshRate\r | |
374 | )\r | |
d0c64728 | 375 | {\r |
376 | EFI_STATUS Status;\r | |
377 | TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r | |
378 | UINTN Index;\r | |
379 | EFI_STATUS ReturnStatus;\r | |
d0c64728 | 380 | EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r |
381 | UINTN NumberIndex;\r | |
382 | UINTN SizeOfInfo;\r | |
383 | EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r | |
384 | EFI_UGA_DRAW_PROTOCOL *UgaDraw;\r | |
385 | \r | |
386 | Private = UGA_DRAW_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r | |
387 | \r | |
d0c64728 | 388 | ReturnStatus = EFI_SUCCESS;\r |
389 | \r | |
d0c64728 | 390 | //\r |
391 | // Update the Mode data\r | |
392 | //\r | |
393 | Private->UgaHorizontalResolution = HorizontalResolution;\r | |
394 | Private->UgaVerticalResolution = VerticalResolution;\r | |
395 | Private->UgaColorDepth = ColorDepth;\r | |
396 | Private->UgaRefreshRate = RefreshRate;\r | |
397 | \r | |
d0c64728 | 398 | //\r |
399 | // return the worst status met\r | |
400 | //\r | |
401 | for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {\r | |
8541adab | 402 | \r |
2da292f6 | 403 | GraphicsOutput = Private->TextOutList[Index].GraphicsOutput;\r |
404 | if (GraphicsOutput != NULL) {\r | |
405 | //\r | |
406 | // Find corresponding ModeNumber of this GraphicsOutput instance\r | |
407 | //\r | |
408 | for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex ++) {\r | |
409 | Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) NumberIndex, &SizeOfInfo, &Info);\r | |
8541adab | 410 | if (EFI_ERROR (Status)) {\r |
2da292f6 | 411 | return Status;\r |
8541adab | 412 | }\r |
2da292f6 | 413 | if ((Info->HorizontalResolution == HorizontalResolution) && (Info->VerticalResolution == VerticalResolution)) {\r |
d0c64728 | 414 | FreePool (Info);\r |
2da292f6 | 415 | break;\r |
d0c64728 | 416 | }\r |
2da292f6 | 417 | FreePool (Info);\r |
418 | }\r | |
d0c64728 | 419 | \r |
2da292f6 | 420 | Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32) NumberIndex);\r |
421 | if (EFI_ERROR (Status)) {\r | |
422 | ReturnStatus = Status;\r | |
423 | }\r | |
424 | } else if (FeaturePcdGet (PcdUgaConsumeSupport)){\r | |
425 | UgaDraw = Private->TextOutList[Index].UgaDraw;\r | |
426 | if (UgaDraw != NULL) {\r | |
427 | Status = UgaDraw->SetMode (\r | |
428 | UgaDraw,\r | |
429 | HorizontalResolution,\r | |
430 | VerticalResolution,\r | |
431 | ColorDepth,\r | |
432 | RefreshRate\r | |
433 | );\r | |
d0c64728 | 434 | if (EFI_ERROR (Status)) {\r |
435 | ReturnStatus = Status;\r | |
436 | }\r | |
437 | }\r | |
ed055f1b | 438 | }\r |
d0c64728 | 439 | }\r |
440 | \r | |
441 | return ReturnStatus;\r | |
442 | }\r | |
443 | \r | |
d0c64728 | 444 | \r |
a4d608d1 | 445 | /**\r |
2da292f6 | 446 | Blt a rectangle of pixels on the graphics screen.\r |
a4d608d1 | 447 | \r |
2da292f6 | 448 | The following table defines actions for BltOperations.\r |
a4d608d1 | 449 | \r |
2da292f6 | 450 | EfiUgaVideoFill:\r |
451 | Write data from the BltBuffer pixel (SourceX, SourceY)\r | |
452 | directly to every pixel of the video display rectangle\r | |
453 | (DestinationX, DestinationY)\r | |
454 | (DestinationX + Width, DestinationY + Height).\r | |
455 | Only one pixel will be used from the BltBuffer. Delta is NOT used.\r | |
ed055f1b | 456 | EfiUgaVideoToBltBuffer:\r |
2da292f6 | 457 | Read data from the video display rectangle\r |
458 | (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in\r | |
459 | the BltBuffer rectangle (DestinationX, DestinationY )\r | |
460 | (DestinationX + Width, DestinationY + Height). If DestinationX or\r | |
461 | DestinationY is not zero then Delta must be set to the length in bytes\r | |
462 | of a row in the BltBuffer.\r | |
463 | EfiUgaBltBufferToVideo:\r | |
464 | Write data from the BltBuffer rectangle\r | |
465 | (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the\r | |
466 | video display rectangle (DestinationX, DestinationY)\r | |
467 | (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is\r | |
468 | not zero then Delta must be set to the length in bytes of a row in the\r | |
469 | BltBuffer.\r | |
470 | EfiUgaVideoToVideo:\r | |
471 | Copy from the video display rectangle\r | |
472 | (SourceX, SourceY) (SourceX + Width, SourceY + Height) .\r | |
473 | to the video display rectangle (DestinationX, DestinationY)\r | |
474 | (DestinationX + Width, DestinationY + Height).\r | |
475 | The BltBuffer and Delta are not used in this mode.\r | |
476 | \r | |
477 | @param This Protocol instance pointer.\r | |
478 | @param BltBuffer Buffer containing data to blit into video buffer. This\r | |
479 | buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)\r | |
480 | @param BltOperation Operation to perform on BlitBuffer and video memory\r | |
481 | @param SourceX X coordinate of source for the BltBuffer.\r | |
482 | @param SourceY Y coordinate of source for the BltBuffer.\r | |
483 | @param DestinationX X coordinate of destination for the BltBuffer.\r | |
484 | @param DestinationY Y coordinate of destination for the BltBuffer.\r | |
485 | @param Width Width of rectangle in BltBuffer in pixels.\r | |
486 | @param Height Hight of rectangle in BltBuffer in pixels.\r | |
487 | @param Delta OPTIONAL\r | |
488 | \r | |
489 | @retval EFI_SUCCESS The Blt operation completed.\r | |
490 | @retval EFI_INVALID_PARAMETER BltOperation is not valid.\r | |
491 | @retval EFI_DEVICE_ERROR A hardware error occured writting to the video buffer.\r | |
a4d608d1 | 492 | \r |
493 | **/\r | |
d0c64728 | 494 | EFI_STATUS\r |
495 | EFIAPI\r | |
d6e11f22 | 496 | ConSplitterUgaDrawBlt (\r |
d0c64728 | 497 | IN EFI_UGA_DRAW_PROTOCOL *This,\r |
498 | IN EFI_UGA_PIXEL *BltBuffer, OPTIONAL\r | |
499 | IN EFI_UGA_BLT_OPERATION BltOperation,\r | |
500 | IN UINTN SourceX,\r | |
501 | IN UINTN SourceY,\r | |
502 | IN UINTN DestinationX,\r | |
503 | IN UINTN DestinationY,\r | |
504 | IN UINTN Width,\r | |
505 | IN UINTN Height,\r | |
506 | IN UINTN Delta OPTIONAL\r | |
507 | )\r | |
d0c64728 | 508 | {\r |
509 | EFI_STATUS Status;\r | |
510 | TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;\r | |
511 | UINTN Index;\r | |
512 | EFI_STATUS ReturnStatus;\r | |
513 | EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r | |
514 | \r | |
515 | Private = UGA_DRAW_SPLITTER_PRIVATE_DATA_FROM_THIS (This);\r | |
516 | \r | |
9937b365 | 517 | ReturnStatus = EFI_SUCCESS;\r |
d0c64728 | 518 | //\r |
519 | // return the worst status met\r | |
520 | //\r | |
521 | for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {\r | |
522 | GraphicsOutput = Private->TextOutList[Index].GraphicsOutput;\r | |
523 | if (GraphicsOutput != NULL) {\r | |
524 | Status = GraphicsOutput->Blt (\r | |
525 | GraphicsOutput,\r | |
526 | (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) BltBuffer,\r | |
527 | (EFI_GRAPHICS_OUTPUT_BLT_OPERATION) BltOperation,\r | |
528 | SourceX,\r | |
529 | SourceY,\r | |
530 | DestinationX,\r | |
531 | DestinationY,\r | |
532 | Width,\r | |
533 | Height,\r | |
534 | Delta\r | |
535 | );\r | |
536 | if (EFI_ERROR (Status)) {\r | |
537 | ReturnStatus = Status;\r | |
538 | } else if (BltOperation == EfiBltVideoToBltBuffer) {\r | |
539 | //\r | |
540 | // Only need to read the data into buffer one time\r | |
541 | //\r | |
542 | return EFI_SUCCESS;\r | |
543 | }\r | |
544 | }\r | |
545 | \r | |
8541adab | 546 | if (Private->TextOutList[Index].UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r |
d0c64728 | 547 | Status = Private->TextOutList[Index].UgaDraw->Blt (\r |
548 | Private->TextOutList[Index].UgaDraw,\r | |
549 | BltBuffer,\r | |
550 | BltOperation,\r | |
551 | SourceX,\r | |
552 | SourceY,\r | |
553 | DestinationX,\r | |
554 | DestinationY,\r | |
555 | Width,\r | |
556 | Height,\r | |
557 | Delta\r | |
558 | );\r | |
559 | if (EFI_ERROR (Status)) {\r | |
560 | ReturnStatus = Status;\r | |
561 | } else if (BltOperation == EfiUgaVideoToBltBuffer) {\r | |
562 | //\r | |
563 | // Only need to read the data into buffer one time\r | |
564 | //\r | |
565 | return EFI_SUCCESS;\r | |
566 | }\r | |
567 | }\r | |
568 | }\r | |
569 | \r | |
570 | return ReturnStatus;\r | |
571 | }\r | |
572 | \r | |
a4d608d1 | 573 | /**\r |
574 | Sets the output device(s) to a specified mode.\r | |
575 | \r | |
2da292f6 | 576 | @param Private Text Out Splitter pointer.\r |
a4d608d1 | 577 | @param ModeNumber The mode number to set.\r |
578 | \r | |
a4d608d1 | 579 | **/\r |
9937b365 | 580 | VOID\r |
581 | TextOutSetMode (\r | |
95276127 | 582 | IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,\r |
583 | IN UINTN ModeNumber\r | |
584 | )\r | |
95276127 | 585 | {\r |
586 | //\r | |
587 | // No need to do extra check here as whether (Column, Row) is valid has\r | |
588 | // been checked in ConSplitterTextOutSetCursorPosition. And (0, 0) should\r | |
589 | // always be supported.\r | |
590 | //\r | |
9937b365 | 591 | Private->TextOutMode.Mode = (INT32) ModeNumber;\r |
592 | Private->TextOutMode.CursorColumn = 0;\r | |
593 | Private->TextOutMode.CursorRow = 0;\r | |
594 | Private->TextOutMode.CursorVisible = TRUE;\r | |
a4d608d1 | 595 | \r |
9937b365 | 596 | return;\r |
95276127 | 597 | }\r |