]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Remove some unnecessary clear screen from console drivers.
authorli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 18 Jun 2010 09:19:29 +0000 (09:19 +0000)
committerli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 18 Jun 2010 09:19:29 +0000 (09:19 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10590 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c

index 181a2348049cae6de8ae1d9a3095cd48b4e46acd..12deda7bb777098b785c02f6dd9c8892c079bda0 100644 (file)
@@ -2630,6 +2630,7 @@ ConSplitterAddGraphicsOutputMode (
 \r
   Index        = 0;\r
   CurrentIndex = 0;\r
+  Status       = EFI_SUCCESS;\r
 \r
   if (Private->CurrentNumberOfUgaDraw != 0) {\r
     //\r
@@ -2834,21 +2835,48 @@ Done:
   // regardless whether the console is in EfiConsoleControlScreenGraphics or EfiConsoleControlScreenText mode\r
   //\r
   Private->HardwareNeedsStarting = TRUE;\r
-  //\r
-  // Current mode number may need update now, so set it to an invalid mode number\r
-  //\r
-  CurrentGraphicsOutputMode->Mode = 0xffff;\r
-  //\r
-  // Graphics console can ensure all GOP devices have the same mode which can be taken as current mode.\r
-  //\r
-  Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, (UINT32) CurrentIndex);\r
-  if (EFI_ERROR(Status)) {\r
+  \r
+  Mode = &Private->GraphicsOutputModeBuffer[CurrentIndex];\r
+  if ((GraphicsOutput != NULL) &&\r
+      (Mode->HorizontalResolution == CurrentGraphicsOutputMode->Info->HorizontalResolution) &&\r
+      (Mode->VerticalResolution == CurrentGraphicsOutputMode->Info->VerticalResolution)) {\r
+    CurrentGraphicsOutputMode->Mode = (UINT32) CurrentIndex;\r
+    if ((Mode->HorizontalResolution != GraphicsOutput->Mode->Info->HorizontalResolution) ||\r
+        (Mode->VerticalResolution != GraphicsOutput->Mode->Info->VerticalResolution)) {\r
+      //\r
+      // If all existing video device has been set to common mode, only set new GOP device to\r
+      // the common mode\r
+      //\r
+      for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex ++) {\r
+        Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) NumberIndex, &SizeOfInfo, &Info);\r
+        if (EFI_ERROR (Status)) {\r
+          return Status;\r
+        }\r
+        if ((Info->HorizontalResolution == Mode->HorizontalResolution) && (Info->VerticalResolution == Mode->VerticalResolution)) {\r
+          FreePool (Info);\r
+          break;\r
+        }\r
+        FreePool (Info);\r
+      }\r
+      Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32) NumberIndex);\r
+    }\r
+  } else {\r
+    //\r
+    // Current mode number may need update now, so set it to an invalid mode number\r
     //\r
-    // If user defined mode is not valid for display device, set to the default mode 800x600.\r
+    CurrentGraphicsOutputMode->Mode = 0xffff;\r
     //\r
-    (Private->GraphicsOutputModeBuffer[0]).HorizontalResolution = 800;\r
-    (Private->GraphicsOutputModeBuffer[0]).VerticalResolution   = 600;\r
-    Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, 0);\r
+    // Graphics console can ensure all GOP devices have the same mode which can be taken as current mode.\r
+    //\r
+    Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, (UINT32) CurrentIndex);\r
+    if (EFI_ERROR(Status)) {\r
+      //\r
+      // If user defined mode is not valid for display device, set to the default mode 800x600.\r
+      //\r
+      (Private->GraphicsOutputModeBuffer[0]).HorizontalResolution = 800;\r
+      (Private->GraphicsOutputModeBuffer[0]).VerticalResolution   = 600;\r
+      Status = Private->GraphicsOutput.SetMode (&Private->GraphicsOutput, 0);\r
+    }\r
   }\r
 \r
   return Status;\r
@@ -3067,11 +3095,6 @@ ConSplitterTextOutAddDevice (
     }\r
   }\r
 \r
-  //\r
-  // If ConOut, then set the mode to Mode #0 which us 80 x 25\r
-  //\r
-  Private->TextOut.SetMode (&Private->TextOut, 0);\r
-\r
   //\r
   // After adding new console device, all existing console devices should be\r
   // synced to the current shared mode.\r
@@ -4387,14 +4410,6 @@ ConSplitterTextOutSetMode (
                                                     Private->TextOutList[Index].TextOut,\r
                                                     TextOutModeMap[Index]\r
                                                     );\r
-    //\r
-    // If this console device is based on a GOP or UGA device, then sync up the bitmap from\r
-    // the GOP/UGA splitter and reclear the text portion of the display in the new mode.\r
-    //\r
-    if ((Private->TextOutList[Index].GraphicsOutput != NULL) || (Private->TextOutList[Index].UgaDraw != NULL)) {\r
-      Private->TextOutList[Index].TextOut->ClearScreen (Private->TextOutList[Index].TextOut);\r
-    }\r
-\r
     if (EFI_ERROR (Status)) {\r
       ReturnStatus = Status;\r
     }\r
index 8e612c899c5c56813fe46716cf371cccb1ee6daa..1ff37facc56af704d0946877c29f7350fff3ab6f 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This is the main routine for initializing the Graphics Console support routines.\r
 \r
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -640,10 +640,18 @@ CheckModeSupported (
     if (!EFI_ERROR (Status)) {\r
       if ((Info->HorizontalResolution == HorizontalResolution) &&\r
           (Info->VerticalResolution == VerticalResolution)) {\r
-        Status = GraphicsOutput->SetMode (GraphicsOutput, ModeNumber);\r
-        if (!EFI_ERROR (Status)) {\r
-          FreePool (Info);\r
+        if ((GraphicsOutput->Mode->Info->HorizontalResolution == HorizontalResolution) &&\r
+            (GraphicsOutput->Mode->Info->VerticalResolution == VerticalResolution)) {\r
+          //\r
+          // If video device has been set to this mode, we do not need to SetMode again\r
+          //\r
           break;\r
+        } else {\r
+          Status = GraphicsOutput->SetMode (GraphicsOutput, ModeNumber);\r
+          if (!EFI_ERROR (Status)) {\r
+            FreePool (Info);\r
+            break;\r
+          }\r
         }\r
       }\r
       FreePool (Info);\r