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