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