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