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