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