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