]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterGraphics.c
1.fixed one bug to 'reconnect -r' when running 4 times.
[mirror_edk2.git] / MdeModulePkg / Universal / Console / ConSplitterDxe / ConSplitterGraphics.c
index d67fdb2f50a48cd119d5c81c1a42226fd1f58274..63deaf598670ad79a0a6c0f8bbf94b6764057e16 100644 (file)
@@ -16,7 +16,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 \r
-\r
 #include "ConSplitter.h"\r
 \r
 \r
@@ -25,16 +24,17 @@ CHAR16 mCrLfString[3] = { CHAR_CARRIAGE_RETURN, CHAR_LINEFEED, CHAR_NULL };
 \r
 /**\r
   Return the current video mode information. Also returns info about existence\r
-  of Graphics Output devices or UGA Draw devices in system, and if the Std In device is locked. All the\r
-  arguments are optional and only returned if a non NULL pointer is passed in.\r
+  of Graphics Output devices or UGA Draw devices in system, and whether the Std\r
+  In device is locked. GopUgaExists and StdInLocked parameters are optional, and\r
+  only returned if a non NULL pointer is passed in.\r
 \r
   @param  This                    Protocol instance pointer.\r
-  @param  Mode                    Are we in text of grahics mode.\r
-  @param  GopUgaExists            TRUE if Console Spliter has found a GOP or UGA device\r
+  @param  Mode                    Current video mode.\r
+  @param  GopUgaExists            TRUE if GOP Spliter has found a GOP/UGA device\r
   @param  StdInLocked             TRUE if StdIn device is keyboard locked\r
 \r
-  @retval EFI_SUCCESS             Mode information returned.\r
-  @retval EFI_INVALID_PARAMETER   Invalid parameters.\r
+  @retval EFI_SUCCESS             Video mode information is returned.\r
+  @retval EFI_INVALID_PARAMETER   Invalid parameters if Mode == NULL.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -76,15 +76,15 @@ ConSpliterConsoleControlGetMode (
 \r
 \r
 /**\r
-  Set the current mode to either text or graphics. Graphics is\r
+  Set the current video mode to either text or graphics. Graphics is\r
   for Quiet Boot.\r
 \r
-  @param  This                    Protocol instance pointer.\r
-  @param  Mode                    Mode to set the\r
+  @param  This                    Console Control Protocol instance pointer.\r
+  @param  Mode                    Video mode is to be set.\r
 \r
-  @retval EFI_SUCCESS             Mode information returned.\r
-  @retval EFI_INVALID_PARAMETER   Invalid parameter.\r
-  @retval EFI_UNSUPPORTED         Operation unsupported.\r
+  @retval EFI_SUCCESS             Mode is set successfully.\r
+  @retval EFI_INVALID_PARAMETER   Mode is not the valid mode value.\r
+  @retval EFI_UNSUPPORTED         Mode is unsupported by console device.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -151,21 +151,20 @@ ConSpliterConsoleControlSetMode (
 \r
 \r
 /**\r
-  Return the current video mode information.\r
+  Returns information for an available graphics mode that the graphics device\r
+  and the set of active video output devices supports.\r
 \r
-  @param  This                    Protocol instance pointer.\r
-  @param  ModeNumber              The mode number to return information on.\r
-  @param  SizeOfInfo              A pointer to the size, in bytes, of the Info\r
-                                  buffer.\r
-  @param  Info                    Caller allocated buffer that returns information\r
-                                  about ModeNumber.\r
+  @param  This                  The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.\r
+  @param  ModeNumber            The mode number to return information on.\r
+  @param  SizeOfInfo            A pointer to the size, in bytes, of the Info buffer.\r
+  @param  Info                  A pointer to callee allocated buffer that returns information about ModeNumber.\r
 \r
-  @retval EFI_SUCCESS             Mode information returned.\r
-  @retval EFI_BUFFER_TOO_SMALL    The Info buffer was too small.\r
-  @retval EFI_DEVICE_ERROR        A hardware error occurred trying to retrieve the\r
-                                  video mode.\r
-  @retval EFI_NOT_STARTED         Video display is not initialized. Call SetMode ()\r
-  @retval EFI_INVALID_PARAMETER   One of the input args was NULL.\r
+  @retval EFI_SUCCESS           Mode information returned.\r
+  @retval EFI_BUFFER_TOO_SMALL  The Info buffer was too small.\r
+  @retval EFI_DEVICE_ERROR      A hardware error occurred trying to retrieve the video mode.\r
+  @retval EFI_NOT_STARTED       Video display is not initialized. Call SetMode ()\r
+  @retval EFI_INVALID_PARAMETER One of the input args was NULL.\r
+  @retval EFI_OUT_OF_RESOURCES  No resource available.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -193,7 +192,6 @@ ConSpliterGraphicsOutputQueryMode (
   }\r
 \r
   *Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));\r
-\r
   if (*Info == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -207,15 +205,16 @@ ConSpliterGraphicsOutputQueryMode (
 \r
 \r
 /**\r
-  Graphics output protocol interface to set video mode.\r
+  Set the video device into the specified mode and clears the visible portions of\r
+  the output display to black.\r
 \r
-  @param  This                    Protocol instance pointer.\r
-  @param  ModeNumber              The mode number to be set.\r
+  @param  This                  The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.\r
+  @param  ModeNumber            Abstraction that defines the current video mode.\r
 \r
-  @retval EFI_SUCCESS             Graphics mode was changed.\r
-  @retval EFI_DEVICE_ERROR        The device had an error and could not complete\r
-                                  the request.\r
-  @retval EFI_UNSUPPORTED         ModeNumber is not supported by this device.\r
+  @retval EFI_SUCCESS           The graphics mode specified by ModeNumber was selected.\r
+  @retval EFI_DEVICE_ERROR      The device had an error and could not complete the request.\r
+  @retval EFI_UNSUPPORTED       ModeNumber is not supported by this device.\r
+  @retval EFI_OUT_OF_RESOURCES  No resource available.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -292,9 +291,7 @@ ConSpliterGraphicsOutputSetMode (
       if (EFI_ERROR (Status)) {\r
         ReturnStatus = Status;\r
       }\r
-    }\r
-\r
-    if (EFI_ERROR (ReturnStatus) && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+    } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
       UgaDraw = Private->TextOutList[Index].UgaDraw;\r
       if (UgaDraw != NULL) {\r
         Status = UgaDraw->SetMode (\r
@@ -364,7 +361,7 @@ ConSpliterGraphicsOutputSetMode (
   @param  DestinationX            X coordinate of destination for the BltBuffer.\r
   @param  DestinationY            Y coordinate of destination for the BltBuffer.\r
   @param  Width                   Width of rectangle in BltBuffer in pixels.\r
-  @param  Height                  Hight of rectangle in BltBuffer in pixels. \r
+  @param  Height                  Hight of rectangle in BltBuffer in pixels.\r
   @param  Delta                   OPTIONAL.\r
 \r
   @retval EFI_SUCCESS             The Blt operation completed.\r
@@ -528,7 +525,7 @@ DevNullGraphicsOutputBlt (
   @param  DestinationX            X coordinate of destination for the BltBuffer.\r
   @param  DestinationY            Y coordinate of destination for the BltBuffer.\r
   @param  Width                   Width of rectangle in BltBuffer in pixels.\r
-  @param  Height                  Hight of rectangle in BltBuffer in pixels. \r
+  @param  Height                  Hight of rectangle in BltBuffer in pixels.\r
   @param  Delta                   OPTIONAL.\r
 \r
   @retval EFI_SUCCESS             The Blt operation completed.\r
@@ -637,7 +634,7 @@ ConSpliterGraphicsOutputBlt (
 }\r
 \r
 /**\r
-  Write data from the buffer to video display based on Graphics Output setting. \r
+  Write data from the buffer to video display based on Graphics Output setting.\r
 \r
   @param  Private                 Consplitter Text Out pointer.\r
   @param  GraphicsOutput          Graphics Output protocol pointer.\r
@@ -647,7 +644,7 @@ ConSpliterGraphicsOutputBlt (
   @retval EFI_SUCCESS             The Blt operation completed.\r
   @retval EFI_INVALID_PARAMETER   BltOperation is not valid.\r
   @retval EFI_DEVICE_ERROR        A hardware error occured writting to the video buffer.\r
-                 \r
+\r
 \r
 **/\r
 EFI_STATUS\r
@@ -670,7 +667,7 @@ DevNullGopSync (
                       Private->GraphicsOutput.Mode->Info->VerticalResolution,\r
                       0\r
                       );\r
-  } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+  } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
     return UgaDraw->Blt (\r
                       UgaDraw,\r
                       (EFI_UGA_PIXEL *) Private->GraphicsOutputBlt,\r
@@ -688,19 +685,18 @@ DevNullGopSync (
   }\r
 }\r
 \r
-\r
 /**\r
   Return the current video mode information.\r
 \r
-  @param  This                    Protocol instance pointer.\r
-  @param  HorizontalResolution    Current video horizontal resolution in pixels\r
-  @param  VerticalResolution      Current video vertical resolution in pixels\r
-  @param  ColorDepth              Current video color depth in bits per pixel\r
-  @param  RefreshRate             Current video refresh rate in Hz.\r
+  @param  This                  The EFI_UGA_DRAW_PROTOCOL instance.\r
+  @param  HorizontalResolution  The size of video screen in pixels in the X dimension.\r
+  @param  VerticalResolution    The size of video screen in pixels in the Y dimension.\r
+  @param  ColorDepth            Number of bits per pixel, currently defined to be 32.\r
+  @param  RefreshRate           The refresh rate of the monitor in Hertz.\r
 \r
-  @retval EFI_SUCCESS             Mode information returned.\r
-  @retval EFI_NOT_STARTED         Video display is not initialized. Call SetMode ()\r
-  @retval EFI_INVALID_PARAMETER   One of the input args was NULL.\r
+  @retval EFI_SUCCESS           Mode information returned.\r
+  @retval EFI_NOT_STARTED       Video display is not initialized. Call SetMode ()\r
+  @retval EFI_INVALID_PARAMETER One of the input args was NULL.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -716,9 +712,9 @@ ConSpliterUgaDrawGetMode (
   TEXT_OUT_SPLITTER_PRIVATE_DATA  *Private;\r
 \r
   if ((HorizontalResolution == NULL) ||\r
-         (VerticalResolution   == NULL) ||\r
-         (RefreshRate          == NULL) ||\r
-         (ColorDepth           == NULL)) {\r
+      (VerticalResolution   == NULL) ||\r
+      (RefreshRate          == NULL) ||\r
+      (ColorDepth           == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
   //\r
@@ -736,17 +732,17 @@ ConSpliterUgaDrawGetMode (
 \r
 \r
 /**\r
-  Return the current video mode information.\r
+  Set the current video mode information.\r
 \r
-  @param  This                    Protocol instance pointer.\r
-  @param  HorizontalResolution    Current video horizontal resolution in pixels\r
-  @param  VerticalResolution      Current video vertical resolution in pixels\r
-  @param  ColorDepth              Current video color depth in bits per pixel\r
-  @param  RefreshRate             Current video refresh rate in Hz.\r
+  @param  This                 The EFI_UGA_DRAW_PROTOCOL instance.\r
+  @param  HorizontalResolution The size of video screen in pixels in the X dimension.\r
+  @param  VerticalResolution   The size of video screen in pixels in the Y dimension.\r
+  @param  ColorDepth           Number of bits per pixel, currently defined to be 32.\r
+  @param  RefreshRate          The refresh rate of the monitor in Hertz.\r
 \r
-  @retval EFI_SUCCESS             Mode information returned.\r
-  @retval EFI_NOT_STARTED         Video display is not initialized. Call SetMode ()\r
-  @retval EFI_OUT_OF_RESOURCES    Out of resources.\r
+  @retval EFI_SUCCESS          Mode information returned.\r
+  @retval EFI_NOT_STARTED      Video display is not initialized. Call SetMode ()\r
+  @retval EFI_OUT_OF_RESOURCES Out of resources.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -811,41 +807,37 @@ ConSpliterUgaDrawSetMode (
 \r
     ReturnStatus = EFI_UNSUPPORTED;\r
 \r
-    if (FeaturePcdGet (PcdUgaConsumeSupport)) {\r
-      UgaDraw = Private->TextOutList[Index].UgaDraw;\r
-      if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
-        Status = UgaDraw->SetMode (\r
-                            UgaDraw,\r
-                            HorizontalResolution,\r
-                            VerticalResolution,\r
-                            ColorDepth,\r
-                            RefreshRate\r
-                            );\r
+    GraphicsOutput = Private->TextOutList[Index].GraphicsOutput;\r
+    if (GraphicsOutput != NULL) {\r
+      //\r
+      // Find corresponding ModeNumber of this GraphicsOutput instance\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
-          ReturnStatus = Status;\r
+          return Status;\r
         }\r
-      }\r
-    }\r
-\r
-    if (EFI_ERROR (ReturnStatus)) {\r
-      GraphicsOutput = Private->TextOutList[Index].GraphicsOutput;\r
-      if (GraphicsOutput != NULL) {\r
-        //\r
-        // Find corresponding ModeNumber of this GraphicsOutput instance\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 == HorizontalResolution) && (Info->VerticalResolution == VerticalResolution)) {\r
-            FreePool (Info);\r
-            break;\r
-          }\r
+        if ((Info->HorizontalResolution == HorizontalResolution) && (Info->VerticalResolution == VerticalResolution)) {\r
           FreePool (Info);\r
+          break;\r
         }\r
+        FreePool (Info);\r
+      }\r
 \r
-        Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32) NumberIndex);\r
+      Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32) NumberIndex);\r
+      if (EFI_ERROR (Status)) {\r
+        ReturnStatus = Status;\r
+      }\r
+    } else if (FeaturePcdGet (PcdUgaConsumeSupport)){\r
+      UgaDraw = Private->TextOutList[Index].UgaDraw;\r
+      if (UgaDraw != NULL) {\r
+        Status = UgaDraw->SetMode (\r
+                          UgaDraw,\r
+                          HorizontalResolution,\r
+                          VerticalResolution,\r
+                          ColorDepth,\r
+                          RefreshRate\r
+                          );\r
         if (EFI_ERROR (Status)) {\r
           ReturnStatus = Status;\r
         }\r
@@ -857,32 +849,38 @@ ConSpliterUgaDrawSetMode (
 }\r
 \r
 /**\r
-  The following table defines actions for BltOperations.\r
+  Blt a rectangle of pixels on the graphics screen.\r
 \r
-  EfiBltVideoFill - Write data from the  BltBuffer pixel (SourceX, SourceY)\r
-  directly to every pixel of the video display rectangle\r
-  (DestinationX, DestinationY)\r
-  (DestinationX + Width, DestinationY + Height).\r
-  Only one pixel will be used from the BltBuffer. Delta is NOT used.\r
-  EfiBltVideoToBltBuffer - Read data from the video display rectangle\r
-  (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in\r
-  the BltBuffer rectangle (DestinationX, DestinationY )\r
-  (DestinationX + Width, DestinationY + Height). If DestinationX or\r
-  DestinationY is not zero then Delta must be set to the length in bytes\r
-  of a row in the BltBuffer.\r
-  EfiBltBufferToVideo - Write data from the  BltBuffer rectangle\r
-  (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the\r
-  video display rectangle (DestinationX, DestinationY)\r
-  (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is\r
-  not zero then Delta must be set to the length in bytes of a row in the\r
-  BltBuffer.\r
-  EfiBltVideoToVideo - Copy from the video display rectangle\r
-  (SourceX, SourceY) (SourceX + Width, SourceY + Height) .\r
-  to the video display rectangle (DestinationX, DestinationY)\r
-  (DestinationX + Width, DestinationY + Height).\r
-  The BltBuffer and Delta  are not used in this mode.\r
+  The following table defines actions for BltOperations.\r
 \r
-  @param  Private                 Protocol instance pointer.\r
+  EfiUgaVideoFill:\r
+    Write data from the  BltBuffer pixel (SourceX, SourceY)\r
+    directly to every pixel of the video display rectangle\r
+    (DestinationX, DestinationY)\r
+    (DestinationX + Width, DestinationY + Height).\r
+    Only one pixel will be used from the BltBuffer. Delta is NOT used.\r
+  EfiUgaVideoToBltBuffer:\r
+    Read data from the video display rectangle\r
+    (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in\r
+    the BltBuffer rectangle (DestinationX, DestinationY )\r
+    (DestinationX + Width, DestinationY + Height). If DestinationX or\r
+    DestinationY is not zero then Delta must be set to the length in bytes\r
+    of a row in the BltBuffer.\r
+  EfiUgaBltBufferToVideo:\r
+    Write data from the  BltBuffer rectangle\r
+    (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the\r
+    video display rectangle (DestinationX, DestinationY)\r
+    (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is\r
+    not zero then Delta must be set to the length in bytes of a row in the\r
+    BltBuffer.\r
+  EfiUgaVideoToVideo:\r
+    Copy from the video display rectangle\r
+    (SourceX, SourceY) (SourceX + Width, SourceY + Height) .\r
+    to the video display rectangle (DestinationX, DestinationY)\r
+    (DestinationX + Width, DestinationY + Height).\r
+    The BltBuffer and Delta  are not used in this mode.\r
+\r
+  @param  Private                 Text Out Splitter pointer.\r
   @param  BltBuffer               Buffer containing data to blit into video buffer.\r
                                   This buffer has a size of\r
                                   Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
@@ -893,7 +891,7 @@ ConSpliterUgaDrawSetMode (
   @param  DestinationX            X coordinate of destination for the BltBuffer.\r
   @param  DestinationY            Y coordinate of destination for the BltBuffer.\r
   @param  Width                   Width of rectangle in BltBuffer in pixels.\r
-  @param  Height                  Hight of rectangle in BltBuffer in pixels. \r
+  @param  Height                  Hight of rectangle in BltBuffer in pixels.\r
   @param  Delta                   OPTIONAL.\r
 \r
   @retval EFI_SUCCESS             The Blt operation completed.\r
@@ -1019,51 +1017,53 @@ DevNullUgaBlt (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
-  The following table defines actions for BltOperations.\r
-\r
-  EfiUgaVideoFill - Write data from the  BltBuffer pixel (SourceX, SourceY)\r
-  directly to every pixel of the video display rectangle\r
-  (DestinationX, DestinationY)\r
-  (DestinationX + Width, DestinationY + Height).\r
-  Only one pixel will be used from the BltBuffer. Delta is NOT used.\r
-  EfiUgaVideoToBltBuffer - Read data from the video display rectangle\r
-  (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in\r
-  the BltBuffer rectangle (DestinationX, DestinationY )\r
-  (DestinationX + Width, DestinationY + Height). If DestinationX or\r
-  DestinationY is not zero then Delta must be set to the length in bytes\r
-  of a row in the BltBuffer.\r
-  EfiUgaBltBufferToVideo - Write data from the  BltBuffer rectangle\r
-  (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the\r
-  video display rectangle (DestinationX, DestinationY)\r
-  (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is\r
-  not zero then Delta must be set to the length in bytes of a row in the\r
-  BltBuffer.\r
-  EfiUgaVideoToVideo - Copy from the video display rectangle\r
-  (SourceX, SourceY) (SourceX + Width, SourceY + Height) .\r
-  to the video display rectangle (DestinationX, DestinationY)\r
-  (DestinationX + Width, DestinationY + Height).\r
-  The BltBuffer and Delta  are not used in this mode.\r
+  Blt a rectangle of pixels on the graphics screen.\r
 \r
-  @param  This                    Protocol instance pointer.\r
-  @param  BltBuffer               Buffer containing data to blit into video buffer.\r
-                                  This buffer has a size of\r
-                                  Width*Height*sizeof(EFI_UGA_PIXEL)\r
-  @param  BltOperation            Operation to perform on BlitBuffer and video\r
-                                  memory\r
-  @param  SourceX                 X coordinate of source for the BltBuffer.\r
-  @param  SourceY                 Y coordinate of source for the BltBuffer.\r
-  @param  DestinationX            X coordinate of destination for the BltBuffer.\r
-  @param  DestinationY            Y coordinate of destination for the BltBuffer.\r
-  @param  Width                   Width of rectangle in BltBuffer in pixels.\r
-  @param  Height                  Hight of rectangle in BltBuffer in pixels.\r
-  @param  Delta                   OPTIONAL.\r
+  The following table defines actions for BltOperations.\r
 \r
-  @retval EFI_SUCCESS             The Blt operation completed.\r
-  @retval EFI_INVALID_PARAMETER   BltOperation is not valid.\r
-  @retval EFI_DEVICE_ERROR        A hardware error occured writting to the video\r
-                                  buffer.\r
+  EfiUgaVideoFill:\r
+    Write data from the  BltBuffer pixel (SourceX, SourceY)\r
+    directly to every pixel of the video display rectangle\r
+    (DestinationX, DestinationY)\r
+    (DestinationX + Width, DestinationY + Height).\r
+    Only one pixel will be used from the BltBuffer. Delta is NOT used.\r
+  EfiUgaVideoToBltBuffer:\r
+    Read data from the video display rectangle\r
+    (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in\r
+    the BltBuffer rectangle (DestinationX, DestinationY )\r
+    (DestinationX + Width, DestinationY + Height). If DestinationX or\r
+    DestinationY is not zero then Delta must be set to the length in bytes\r
+    of a row in the BltBuffer.\r
+  EfiUgaBltBufferToVideo:\r
+    Write data from the  BltBuffer rectangle\r
+    (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the\r
+    video display rectangle (DestinationX, DestinationY)\r
+    (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is\r
+    not zero then Delta must be set to the length in bytes of a row in the\r
+    BltBuffer.\r
+  EfiUgaVideoToVideo:\r
+    Copy from the video display rectangle\r
+    (SourceX, SourceY) (SourceX + Width, SourceY + Height) .\r
+    to the video display rectangle (DestinationX, DestinationY)\r
+    (DestinationX + Width, DestinationY + Height).\r
+    The BltBuffer and Delta  are not used in this mode.\r
+\r
+  @param  This           Protocol instance pointer.\r
+  @param  BltBuffer      Buffer containing data to blit into video buffer. This\r
+                         buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)\r
+  @param  BltOperation   Operation to perform on BlitBuffer and video memory\r
+  @param  SourceX        X coordinate of source for the BltBuffer.\r
+  @param  SourceY        Y coordinate of source for the BltBuffer.\r
+  @param  DestinationX   X coordinate of destination for the BltBuffer.\r
+  @param  DestinationY   Y coordinate of destination for the BltBuffer.\r
+  @param  Width          Width of rectangle in BltBuffer in pixels.\r
+  @param  Height         Hight of rectangle in BltBuffer in pixels.\r
+  @param  Delta          OPTIONAL\r
+\r
+  @retval EFI_SUCCESS            The Blt operation completed.\r
+  @retval EFI_INVALID_PARAMETER  BltOperation is not valid.\r
+  @retval EFI_DEVICE_ERROR       A hardware error occured writting to the video buffer.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1163,7 +1163,7 @@ ConSpliterUgaDrawBlt (
 }\r
 \r
 /**\r
-  Write data from the buffer to video display based on UGA Draw setting. \r
+  Write data from the buffer to video display based on UGA Draw setting.\r
 \r
   @param  Private                 Consplitter Text Out pointer.\r
   @param  GraphicsOutput          Graphics Output protocol pointer.\r
@@ -1173,7 +1173,7 @@ ConSpliterUgaDrawBlt (
   @retval EFI_SUCCESS             The Blt operation completed.\r
   @retval EFI_INVALID_PARAMETER   BltOperation is not valid.\r
   @retval EFI_DEVICE_ERROR        A hardware error occured writting to the video buffer.\r
-                  \r
+\r
 **/\r
 EFI_STATUS\r
 DevNullUgaSync (\r
@@ -1182,31 +1182,31 @@ DevNullUgaSync (
   IN  EFI_UGA_DRAW_PROTOCOL           *UgaDraw\r
   )\r
 {\r
-  if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
-    return UgaDraw->Blt (\r
-                      UgaDraw,\r
-                      Private->UgaBlt,\r
-                      EfiUgaBltBufferToVideo,\r
+  if (GraphicsOutput != NULL) {\r
+    return GraphicsOutput->Blt (\r
+                      GraphicsOutput,\r
+                      (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) Private->UgaBlt,\r
+                      EfiBltBufferToVideo,\r
                       0,\r
                       0,\r
                       0,\r
                       0,\r
                       Private->UgaHorizontalResolution,\r
                       Private->UgaVerticalResolution,\r
-                      Private->UgaHorizontalResolution * sizeof (EFI_UGA_PIXEL)\r
+                      0\r
                       );\r
-  } else if (GraphicsOutput != NULL) {\r
-    return GraphicsOutput->Blt (\r
-                      GraphicsOutput,\r
-                      (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) Private->UgaBlt,\r
-                      EfiBltBufferToVideo,\r
+  } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
+    return UgaDraw->Blt (\r
+                      UgaDraw,\r
+                      Private->UgaBlt,\r
+                      EfiUgaBltBufferToVideo,\r
                       0,\r
                       0,\r
                       0,\r
                       0,\r
                       Private->UgaHorizontalResolution,\r
                       Private->UgaVerticalResolution,\r
-                      0\r
+                      Private->UgaHorizontalResolution * sizeof (EFI_UGA_PIXEL)\r
                       );\r
   } else {\r
     return EFI_UNSUPPORTED;\r
@@ -1261,7 +1261,7 @@ DevNullTextOutOutputString (
   LastRow         = Private->DevNullRows - 1;\r
   MaxColumn       = Private->DevNullColumns;\r
 \r
-  if (Mode->Attribute & EFI_WIDE_ATTRIBUTE) {\r
+  if ((Mode->Attribute & EFI_WIDE_ATTRIBUTE) != 0) {\r
     CurrentWidth = 2;\r
   } else {\r
     CurrentWidth = 1;\r
@@ -1435,7 +1435,7 @@ DevNullTextOutOutputString (
 /**\r
   Sets the output device(s) to a specified mode.\r
 \r
-  @param  Private                 Private data structure pointer.\r
+  @param  Private                 Text Out Splitter pointer.\r
   @param  ModeNumber              The mode number to set.\r
 \r
   @retval EFI_SUCCESS             The requested text mode was set.\r
@@ -1471,7 +1471,7 @@ DevNullTextOutSetMode (
   Row     = Mode->Rows;\r
   Column  = Mode->Columns;\r
 \r
-  if (Row <= 0 && Column <= 0) {\r
+  if (Row == 0 || Column == 0) {\r
     return EFI_UNSUPPORTED;\r
   }\r
 \r
@@ -1512,7 +1512,7 @@ DevNullTextOutSetMode (
   Clears the output device(s) display to the currently selected background\r
   color.\r
 \r
-  @param  Private                 Protocol instance pointer.\r
+  @param  Private                 Text Out Splitter pointer.\r
 \r
   @retval EFI_SUCCESS             The operation completed successfully.\r
   @retval EFI_DEVICE_ERROR        The device had an error and could not complete\r
@@ -1558,20 +1558,17 @@ DevNullTextOutClearScreen (
 \r
 \r
 /**\r
-  Sets the current coordinates of the cursor position.\r
+  Sets the current coordinates of the cursor position on NULL device.\r
 \r
-  @param  Private                 Protocol instance pointer.\r
-  @param  Column                  \r
-  @param  Row                     the position to set the cursor to. Must be\r
-                                  greater than or equal to zero and less than the\r
-                                  number of columns and rows by QueryMode ().\r
+  @param  Private                  Text Out Splitter pointer.\r
+  @param  Column                   The column position to set the cursor to. Must be\r
+                                   greater than or equal to zero and less than the\r
+                                   number of columns by QueryMode ().\r
+  @param  Row                      The row position to set the cursor to. Must be\r
+                                   greater than or equal to zero and less than the\r
+                                   number of rows by QueryMode ().\r
 \r
-  @retval EFI_SUCCESS             The operation completed successfully.\r
-  @retval EFI_DEVICE_ERROR        The device had an error and could not complete\r
-                                  the request.\r
-  @retval EFI_UNSUPPORTED         The output device is not in a valid text mode, or\r
-                                  the cursor position is invalid for the current\r
-                                  mode.\r
+  @retval EFI_SUCCESS              Always returned.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1594,14 +1591,13 @@ DevNullTextOutSetCursorPosition (
 \r
 \r
 /**\r
-  Implements SIMPLE_TEXT_OUTPUT.EnableCursor().\r
-  In this driver, the cursor cannot be hidden.\r
+  Set cursor visibility property on NULL device.\r
 \r
-  @param  Private                 Indicates the calling context.\r
+  @param  Private                 Text Out Splitter pointer.\r
   @param  Visible                 If TRUE, the cursor is set to be visible, If\r
                                   FALSE, the cursor is set to be invisible.\r
 \r
-  @retval EFI_SUCCESS             The request is valid.\r
+  @retval EFI_SUCCESS             Always returned.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1620,7 +1616,7 @@ DevNullTextOutEnableCursor (
   Take the DevNull TextOut device and update the Simple Text Out on every\r
   UGA device.\r
 \r
-  @param  Private                 Indicates the calling context.\r
+  @param  Private                 Text Out Splitter pointer.\r
 \r
   @retval EFI_SUCCESS             The request is valid.\r
   @retval other                   Return status of TextOut->OutputString ()\r