\r
#include "LcdGraphicsOutputDxe.h"\r
\r
-extern BOOLEAN mDisplayInitialized;\r
+extern BOOLEAN mDisplayInitialized;\r
\r
//\r
// Function Definitions\r
IN UINTN DestinationY,\r
IN UINTN Width,\r
IN UINTN Height\r
-)\r
+ )\r
{\r
- EFI_STATUS Status;\r
- UINTN SourceLine;\r
- UINTN DestinationLine;\r
- UINTN WidthInBytes;\r
- UINTN LineCount;\r
- INTN Step;\r
- VOID *SourceAddr;\r
- VOID *DestinationAddr;\r
+ EFI_STATUS Status;\r
+ UINTN SourceLine;\r
+ UINTN DestinationLine;\r
+ UINTN WidthInBytes;\r
+ UINTN LineCount;\r
+ INTN Step;\r
+ VOID *SourceAddr;\r
+ VOID *DestinationAddr;\r
\r
Status = EFI_SUCCESS;\r
\r
- if( DestinationY <= SourceY ) {\r
+ if ( DestinationY <= SourceY ) {\r
// scrolling up (or horizontally but without overlap)\r
- SourceLine = SourceY;\r
- DestinationLine = DestinationY;\r
- Step = 1;\r
+ SourceLine = SourceY;\r
+ DestinationLine = DestinationY;\r
+ Step = 1;\r
} else {\r
// scrolling down\r
- SourceLine = SourceY + Height;\r
- DestinationLine = DestinationY + Height;\r
- Step = -1;\r
+ SourceLine = SourceY + Height;\r
+ DestinationLine = DestinationY + Height;\r
+ Step = -1;\r
}\r
\r
switch (BitsPerPixel) {\r
+ case LcdBitsPerPixel_24:\r
\r
- case LcdBitsPerPixel_24:\r
+ WidthInBytes = Width * 4;\r
\r
- WidthInBytes = Width * 4;\r
+ for ( LineCount = 0; LineCount < Height; LineCount++ ) {\r
+ // Update the start addresses of source & destination using 32bit pointer arithmetic\r
+ SourceAddr = (VOID *)((UINT32 *)FrameBufferBase + SourceLine * HorizontalResolution + SourceX);\r
+ DestinationAddr = (VOID *)((UINT32 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationX);\r
\r
- for( LineCount = 0; LineCount < Height; LineCount++ ) {\r
- // Update the start addresses of source & destination using 32bit pointer arithmetic\r
- SourceAddr = (VOID *)((UINT32 *)FrameBufferBase + SourceLine * HorizontalResolution + SourceX );\r
- DestinationAddr = (VOID *)((UINT32 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationX);\r
+ // Copy the entire line Y from video ram to the temp buffer\r
+ CopyMem (DestinationAddr, SourceAddr, WidthInBytes);\r
\r
- // Copy the entire line Y from video ram to the temp buffer\r
- CopyMem( DestinationAddr, SourceAddr, WidthInBytes);\r
+ // Update the line numbers\r
+ SourceLine += Step;\r
+ DestinationLine += Step;\r
+ }\r
\r
- // Update the line numbers\r
- SourceLine += Step;\r
- DestinationLine += Step;\r
- }\r
- break;\r
+ break;\r
\r
- case LcdBitsPerPixel_16_555:\r
- case LcdBitsPerPixel_16_565:\r
- case LcdBitsPerPixel_12_444:\r
+ case LcdBitsPerPixel_16_555:\r
+ case LcdBitsPerPixel_16_565:\r
+ case LcdBitsPerPixel_12_444:\r
\r
- WidthInBytes = Width * 2;\r
+ WidthInBytes = Width * 2;\r
\r
- for( LineCount = 0; LineCount < Height; LineCount++ ) {\r
- // Update the start addresses of source & destination using 16bit pointer arithmetic\r
- SourceAddr = (VOID *)((UINT16 *)FrameBufferBase + SourceLine * HorizontalResolution + SourceX );\r
- DestinationAddr = (VOID *)((UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationX);\r
+ for ( LineCount = 0; LineCount < Height; LineCount++ ) {\r
+ // Update the start addresses of source & destination using 16bit pointer arithmetic\r
+ SourceAddr = (VOID *)((UINT16 *)FrameBufferBase + SourceLine * HorizontalResolution + SourceX);\r
+ DestinationAddr = (VOID *)((UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationX);\r
\r
- // Copy the entire line Y from video ram to the temp buffer\r
- CopyMem( DestinationAddr, SourceAddr, WidthInBytes);\r
+ // Copy the entire line Y from video ram to the temp buffer\r
+ CopyMem (DestinationAddr, SourceAddr, WidthInBytes);\r
\r
- // Update the line numbers\r
- SourceLine += Step;\r
- DestinationLine += Step;\r
- }\r
- break;\r
-\r
- case LcdBitsPerPixel_8:\r
- case LcdBitsPerPixel_4:\r
- case LcdBitsPerPixel_2:\r
- case LcdBitsPerPixel_1:\r
- default:\r
- // Can't handle this case\r
- DEBUG((DEBUG_ERROR, "ArmVeGraphics_Blt: EfiBltVideoToVideo: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));\r
- Status = EFI_INVALID_PARAMETER;\r
- goto EXIT;\r
- // break;\r
+ // Update the line numbers\r
+ SourceLine += Step;\r
+ DestinationLine += Step;\r
+ }\r
\r
+ break;\r
+\r
+ case LcdBitsPerPixel_8:\r
+ case LcdBitsPerPixel_4:\r
+ case LcdBitsPerPixel_2:\r
+ case LcdBitsPerPixel_1:\r
+ default:\r
+ // Can't handle this case\r
+ DEBUG ((DEBUG_ERROR, "ArmVeGraphics_Blt: EfiBltVideoToVideo: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));\r
+ Status = EFI_INVALID_PARAMETER;\r
+ goto EXIT;\r
+ // break;\r
}\r
\r
- EXIT:\r
+EXIT:\r
return Status;\r
}\r
\r
IN UINTN DestinationY,\r
IN UINTN Width,\r
IN UINTN Height\r
-)\r
+ )\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
\r
- UINT32 *PixelBuffer32bit;\r
- UINT32 *SourcePixel32bit;\r
- UINT32 *DestinationPixel32bit;\r
+ UINT32 *PixelBuffer32bit;\r
+ UINT32 *SourcePixel32bit;\r
+ UINT32 *DestinationPixel32bit;\r
\r
- UINT16 *PixelBuffer16bit;\r
- UINT16 *SourcePixel16bit;\r
- UINT16 *DestinationPixel16bit;\r
+ UINT16 *PixelBuffer16bit;\r
+ UINT16 *SourcePixel16bit;\r
+ UINT16 *DestinationPixel16bit;\r
\r
- UINT32 SourcePixelY;\r
- UINT32 DestinationPixelY;\r
- UINTN SizeIn32Bits;\r
- UINTN SizeIn16Bits;\r
+ UINT32 SourcePixelY;\r
+ UINT32 DestinationPixelY;\r
+ UINTN SizeIn32Bits;\r
+ UINTN SizeIn16Bits;\r
\r
Status = EFI_SUCCESS;\r
\r
switch (BitsPerPixel) {\r
+ case LcdBitsPerPixel_24:\r
+ // Allocate a temporary buffer\r
\r
- case LcdBitsPerPixel_24:\r
- // Allocate a temporary buffer\r
-\r
- PixelBuffer32bit = (UINT32 *) AllocatePool((Height * Width) * sizeof(UINT32));\r
-\r
- if (PixelBuffer32bit == NULL) {\r
- Status = EFI_OUT_OF_RESOURCES;\r
- goto EXIT;\r
- }\r
-\r
- SizeIn32Bits = Width * 4;\r
-\r
- // Copy from the video ram (source region) to a temp buffer\r
- for (SourcePixelY = SourceY, DestinationPixel32bit = PixelBuffer32bit;\r
- SourcePixelY < SourceY + Height;\r
- SourcePixelY++, DestinationPixel32bit += Width)\r
- {\r
- // Update the start address of line Y (source)\r
- SourcePixel32bit = (UINT32 *)FrameBufferBase + SourcePixelY * HorizontalResolution + SourceX;\r
+ PixelBuffer32bit = (UINT32 *)AllocatePool ((Height * Width) * sizeof (UINT32));\r
\r
- // Copy the entire line Y from video ram to the temp buffer\r
- CopyMem( (VOID *)DestinationPixel32bit, (CONST VOID *)SourcePixel32bit, SizeIn32Bits);\r
- }\r
+ if (PixelBuffer32bit == NULL) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto EXIT;\r
+ }\r
\r
- // Copy from the temp buffer to the video ram (destination region)\r
- for (DestinationPixelY = DestinationY, SourcePixel32bit = PixelBuffer32bit;\r
- DestinationPixelY < DestinationY + Height;\r
- DestinationPixelY++, SourcePixel32bit += Width)\r
- {\r
- // Update the start address of line Y (target)\r
- DestinationPixel32bit = (UINT32 *)FrameBufferBase + DestinationPixelY * HorizontalResolution + DestinationX;\r
+ SizeIn32Bits = Width * 4;\r
\r
- // Copy the entire line Y from the temp buffer to video ram\r
- CopyMem( (VOID *)DestinationPixel32bit, (CONST VOID *)SourcePixel32bit, SizeIn32Bits);\r
- }\r
+ // Copy from the video ram (source region) to a temp buffer\r
+ for (SourcePixelY = SourceY, DestinationPixel32bit = PixelBuffer32bit;\r
+ SourcePixelY < SourceY + Height;\r
+ SourcePixelY++, DestinationPixel32bit += Width)\r
+ {\r
+ // Update the start address of line Y (source)\r
+ SourcePixel32bit = (UINT32 *)FrameBufferBase + SourcePixelY * HorizontalResolution + SourceX;\r
\r
- // Free up the allocated memory\r
- FreePool((VOID *) PixelBuffer32bit);\r
+ // Copy the entire line Y from video ram to the temp buffer\r
+ CopyMem ((VOID *)DestinationPixel32bit, (CONST VOID *)SourcePixel32bit, SizeIn32Bits);\r
+ }\r
\r
- break;\r
+ // Copy from the temp buffer to the video ram (destination region)\r
+ for (DestinationPixelY = DestinationY, SourcePixel32bit = PixelBuffer32bit;\r
+ DestinationPixelY < DestinationY + Height;\r
+ DestinationPixelY++, SourcePixel32bit += Width)\r
+ {\r
+ // Update the start address of line Y (target)\r
+ DestinationPixel32bit = (UINT32 *)FrameBufferBase + DestinationPixelY * HorizontalResolution + DestinationX;\r
\r
+ // Copy the entire line Y from the temp buffer to video ram\r
+ CopyMem ((VOID *)DestinationPixel32bit, (CONST VOID *)SourcePixel32bit, SizeIn32Bits);\r
+ }\r
\r
- case LcdBitsPerPixel_16_555:\r
- case LcdBitsPerPixel_16_565:\r
- case LcdBitsPerPixel_12_444:\r
- // Allocate a temporary buffer\r
- PixelBuffer16bit = (UINT16 *) AllocatePool((Height * Width) * sizeof(UINT16));\r
+ // Free up the allocated memory\r
+ FreePool ((VOID *)PixelBuffer32bit);\r
\r
- if (PixelBuffer16bit == NULL) {\r
- Status = EFI_OUT_OF_RESOURCES;\r
- goto EXIT;\r
- }\r
+ break;\r
\r
- // Access each pixel inside the source area of the Video Memory and copy it to the temp buffer\r
+ case LcdBitsPerPixel_16_555:\r
+ case LcdBitsPerPixel_16_565:\r
+ case LcdBitsPerPixel_12_444:\r
+ // Allocate a temporary buffer\r
+ PixelBuffer16bit = (UINT16 *)AllocatePool ((Height * Width) * sizeof (UINT16));\r
\r
- SizeIn16Bits = Width * 2;\r
+ if (PixelBuffer16bit == NULL) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto EXIT;\r
+ }\r
\r
- for (SourcePixelY = SourceY, DestinationPixel16bit = PixelBuffer16bit;\r
- SourcePixelY < SourceY + Height;\r
- SourcePixelY++, DestinationPixel16bit += Width)\r
- {\r
- // Calculate the source address:\r
- SourcePixel16bit = (UINT16 *)FrameBufferBase + SourcePixelY * HorizontalResolution + SourceX;\r
+ // Access each pixel inside the source area of the Video Memory and copy it to the temp buffer\r
\r
- // Copy the entire line Y from Video to the temp buffer\r
- CopyMem( (VOID *)DestinationPixel16bit, (CONST VOID *)SourcePixel16bit, SizeIn16Bits);\r
- }\r
+ SizeIn16Bits = Width * 2;\r
\r
- // Copy from the temp buffer into the destination area of the Video Memory\r
+ for (SourcePixelY = SourceY, DestinationPixel16bit = PixelBuffer16bit;\r
+ SourcePixelY < SourceY + Height;\r
+ SourcePixelY++, DestinationPixel16bit += Width)\r
+ {\r
+ // Calculate the source address:\r
+ SourcePixel16bit = (UINT16 *)FrameBufferBase + SourcePixelY * HorizontalResolution + SourceX;\r
\r
- for (DestinationPixelY = DestinationY, SourcePixel16bit = PixelBuffer16bit;\r
- DestinationPixelY < DestinationY + Height;\r
- DestinationPixelY++, SourcePixel16bit += Width)\r
- {\r
- // Calculate the target address:\r
- DestinationPixel16bit = (UINT16 *)FrameBufferBase + (DestinationPixelY * HorizontalResolution + DestinationX);\r
+ // Copy the entire line Y from Video to the temp buffer\r
+ CopyMem ((VOID *)DestinationPixel16bit, (CONST VOID *)SourcePixel16bit, SizeIn16Bits);\r
+ }\r
\r
- // Copy the entire line Y from the temp buffer to Video\r
- CopyMem( (VOID *)DestinationPixel16bit, (CONST VOID *)SourcePixel16bit, SizeIn16Bits);\r
- }\r
+ // Copy from the temp buffer into the destination area of the Video Memory\r
\r
- // Free the allocated memory\r
- FreePool((VOID *) PixelBuffer16bit);\r
+ for (DestinationPixelY = DestinationY, SourcePixel16bit = PixelBuffer16bit;\r
+ DestinationPixelY < DestinationY + Height;\r
+ DestinationPixelY++, SourcePixel16bit += Width)\r
+ {\r
+ // Calculate the target address:\r
+ DestinationPixel16bit = (UINT16 *)FrameBufferBase + (DestinationPixelY * HorizontalResolution + DestinationX);\r
\r
- break;\r
+ // Copy the entire line Y from the temp buffer to Video\r
+ CopyMem ((VOID *)DestinationPixel16bit, (CONST VOID *)SourcePixel16bit, SizeIn16Bits);\r
+ }\r
\r
+ // Free the allocated memory\r
+ FreePool ((VOID *)PixelBuffer16bit);\r
\r
- case LcdBitsPerPixel_8:\r
- case LcdBitsPerPixel_4:\r
- case LcdBitsPerPixel_2:\r
- case LcdBitsPerPixel_1:\r
- default:\r
- // Can't handle this case\r
- DEBUG((DEBUG_ERROR, "ArmVeGraphics_Blt: EfiBltVideoToVideo: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));\r
- Status = EFI_INVALID_PARAMETER;\r
- goto EXIT;\r
- // break;\r
+ break;\r
\r
+ case LcdBitsPerPixel_8:\r
+ case LcdBitsPerPixel_4:\r
+ case LcdBitsPerPixel_2:\r
+ case LcdBitsPerPixel_1:\r
+ default:\r
+ // Can't handle this case\r
+ DEBUG ((DEBUG_ERROR, "ArmVeGraphics_Blt: EfiBltVideoToVideo: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));\r
+ Status = EFI_INVALID_PARAMETER;\r
+ goto EXIT;\r
+ // break;\r
}\r
\r
EXIT:\r
STATIC\r
EFI_STATUS\r
BltVideoFill (\r
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *EfiSourcePixel OPTIONAL,\r
- IN UINTN SourceX,\r
- IN UINTN SourceY,\r
- IN UINTN DestinationX,\r
- IN UINTN DestinationY,\r
- IN UINTN Width,\r
- IN UINTN Height,\r
- IN UINTN Delta OPTIONAL // Number of BYTES in a row of the BltBuffer\r
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
+ IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *EfiSourcePixel OPTIONAL,\r
+ IN UINTN SourceX,\r
+ IN UINTN SourceY,\r
+ IN UINTN DestinationX,\r
+ IN UINTN DestinationY,\r
+ IN UINTN Width,\r
+ IN UINTN Height,\r
+ IN UINTN Delta OPTIONAL // Number of BYTES in a row of the BltBuffer\r
)\r
{\r
- EFI_PIXEL_BITMASK* PixelInformation;\r
+ EFI_PIXEL_BITMASK *PixelInformation;\r
EFI_STATUS Status;\r
UINT32 HorizontalResolution;\r
LCD_BPP BitsPerPixel;\r
- VOID *FrameBufferBase;\r
- VOID *DestinationAddr;\r
- UINT16 *DestinationPixel16bit;\r
- UINT16 Pixel16bit;\r
- UINT32 DestinationPixelX;\r
- UINT32 DestinationLine;\r
- UINTN WidthInBytes;\r
-\r
- Status = EFI_SUCCESS;\r
- PixelInformation = &This->Mode->Info->PixelInformation;\r
- FrameBufferBase = (UINTN *)((UINTN)(This->Mode->FrameBufferBase));\r
+ VOID *FrameBufferBase;\r
+ VOID *DestinationAddr;\r
+ UINT16 *DestinationPixel16bit;\r
+ UINT16 Pixel16bit;\r
+ UINT32 DestinationPixelX;\r
+ UINT32 DestinationLine;\r
+ UINTN WidthInBytes;\r
+\r
+ Status = EFI_SUCCESS;\r
+ PixelInformation = &This->Mode->Info->PixelInformation;\r
+ FrameBufferBase = (UINTN *)((UINTN)(This->Mode->FrameBufferBase));\r
HorizontalResolution = This->Mode->Info->HorizontalResolution;\r
\r
- LcdPlatformGetBpp (This->Mode->Mode,&BitsPerPixel);\r
+ LcdPlatformGetBpp (This->Mode->Mode, &BitsPerPixel);\r
\r
switch (BitsPerPixel) {\r
- case LcdBitsPerPixel_24:\r
- WidthInBytes = Width * 4;\r
-\r
- // Copy the SourcePixel into every pixel inside the target rectangle\r
- for (DestinationLine = DestinationY;\r
- DestinationLine < DestinationY + Height;\r
- DestinationLine++)\r
- {\r
- // Calculate the target address using 32bit pointer arithmetic:\r
- DestinationAddr = (VOID *)((UINT32 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationX);\r
-\r
- // Fill the entire line\r
- SetMem32 (DestinationAddr, WidthInBytes, *((UINT32 *)EfiSourcePixel));\r
- }\r
- break;\r
-\r
- case LcdBitsPerPixel_16_555:\r
- // Convert the EFI pixel at the start of the BltBuffer(0,0) into a video display pixel\r
- Pixel16bit = (UINT16) (\r
- ( (EfiSourcePixel->Red << 7) & PixelInformation->RedMask )\r
- | ( (EfiSourcePixel->Green << 2) & PixelInformation->GreenMask )\r
- | ( (EfiSourcePixel->Blue >> 3) & PixelInformation->BlueMask )\r
-// | ( 0 & PixelInformation->ReservedMask )\r
- );\r
-\r
- // Copy the SourcePixel into every pixel inside the target rectangle\r
- for (DestinationLine = DestinationY;\r
- DestinationLine < DestinationY + Height;\r
- DestinationLine++)\r
- {\r
- for (DestinationPixelX = DestinationX;\r
- DestinationPixelX < DestinationX + Width;\r
- DestinationPixelX++)\r
+ case LcdBitsPerPixel_24:\r
+ WidthInBytes = Width * 4;\r
+\r
+ // Copy the SourcePixel into every pixel inside the target rectangle\r
+ for (DestinationLine = DestinationY;\r
+ DestinationLine < DestinationY + Height;\r
+ DestinationLine++)\r
{\r
- // Calculate the target address:\r
- DestinationPixel16bit = (UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationPixelX;\r
+ // Calculate the target address using 32bit pointer arithmetic:\r
+ DestinationAddr = (VOID *)((UINT32 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationX);\r
\r
- // Copy the pixel into the new target\r
- *DestinationPixel16bit = Pixel16bit;\r
+ // Fill the entire line\r
+ SetMem32 (DestinationAddr, WidthInBytes, *((UINT32 *)EfiSourcePixel));\r
}\r
- }\r
- break;\r
-\r
- case LcdBitsPerPixel_16_565:\r
- // Convert the EFI pixel at the start of the BltBuffer(0,0) into a video display pixel\r
- Pixel16bit = (UINT16) (\r
- ( (EfiSourcePixel->Red << 8) & PixelInformation->RedMask )\r
- | ( (EfiSourcePixel->Green << 3) & PixelInformation->GreenMask )\r
- | ( (EfiSourcePixel->Blue >> 3) & PixelInformation->BlueMask )\r
- );\r
-\r
- // Copy the SourcePixel into every pixel inside the target rectangle\r
- for (DestinationLine = DestinationY;\r
- DestinationLine < DestinationY + Height;\r
- DestinationLine++)\r
- {\r
- for (DestinationPixelX = DestinationX;\r
- DestinationPixelX < DestinationX + Width;\r
- DestinationPixelX++)\r
- {\r
- // Calculate the target address:\r
- DestinationPixel16bit = (UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationPixelX;\r
\r
- // Copy the pixel into the new target\r
- *DestinationPixel16bit = Pixel16bit;\r
+ break;\r
+\r
+ case LcdBitsPerPixel_16_555:\r
+ // Convert the EFI pixel at the start of the BltBuffer(0,0) into a video display pixel\r
+ Pixel16bit = (UINT16)(\r
+ ((EfiSourcePixel->Red << 7) & PixelInformation->RedMask)\r
+ | ((EfiSourcePixel->Green << 2) & PixelInformation->GreenMask)\r
+ | ((EfiSourcePixel->Blue >> 3) & PixelInformation->BlueMask)\r
+ // | ( 0 & PixelInformation->ReservedMask )\r
+ );\r
+\r
+ // Copy the SourcePixel into every pixel inside the target rectangle\r
+ for (DestinationLine = DestinationY;\r
+ DestinationLine < DestinationY + Height;\r
+ DestinationLine++)\r
+ {\r
+ for (DestinationPixelX = DestinationX;\r
+ DestinationPixelX < DestinationX + Width;\r
+ DestinationPixelX++)\r
+ {\r
+ // Calculate the target address:\r
+ DestinationPixel16bit = (UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationPixelX;\r
+\r
+ // Copy the pixel into the new target\r
+ *DestinationPixel16bit = Pixel16bit;\r
+ }\r
}\r
- }\r
- break;\r
-\r
- case LcdBitsPerPixel_12_444:\r
- // Convert the EFI pixel at the start of the BltBuffer(0,0) into a video display pixel\r
- Pixel16bit = (UINT16) (\r
- ( (EfiSourcePixel->Red >> 4) & PixelInformation->RedMask )\r
- | ( (EfiSourcePixel->Green ) & PixelInformation->GreenMask )\r
- | ( (EfiSourcePixel->Blue << 4) & PixelInformation->BlueMask )\r
- );\r
-\r
- // Copy the SourcePixel into every pixel inside the target rectangle\r
- for (DestinationLine = DestinationY;\r
- DestinationLine < DestinationY + Height;\r
- DestinationLine++)\r
- {\r
- for (DestinationPixelX = DestinationX;\r
- DestinationPixelX < DestinationX + Width;\r
- DestinationPixelX++)\r
+\r
+ break;\r
+\r
+ case LcdBitsPerPixel_16_565:\r
+ // Convert the EFI pixel at the start of the BltBuffer(0,0) into a video display pixel\r
+ Pixel16bit = (UINT16)(\r
+ ((EfiSourcePixel->Red << 8) & PixelInformation->RedMask)\r
+ | ((EfiSourcePixel->Green << 3) & PixelInformation->GreenMask)\r
+ | ((EfiSourcePixel->Blue >> 3) & PixelInformation->BlueMask)\r
+ );\r
+\r
+ // Copy the SourcePixel into every pixel inside the target rectangle\r
+ for (DestinationLine = DestinationY;\r
+ DestinationLine < DestinationY + Height;\r
+ DestinationLine++)\r
{\r
- // Calculate the target address:\r
- DestinationPixel16bit = (UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationPixelX;\r
+ for (DestinationPixelX = DestinationX;\r
+ DestinationPixelX < DestinationX + Width;\r
+ DestinationPixelX++)\r
+ {\r
+ // Calculate the target address:\r
+ DestinationPixel16bit = (UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationPixelX;\r
+\r
+ // Copy the pixel into the new target\r
+ *DestinationPixel16bit = Pixel16bit;\r
+ }\r
+ }\r
+\r
+ break;\r
\r
- // Copy the pixel into the new target\r
- *DestinationPixel16bit = Pixel16bit;\r
+ case LcdBitsPerPixel_12_444:\r
+ // Convert the EFI pixel at the start of the BltBuffer(0,0) into a video display pixel\r
+ Pixel16bit = (UINT16)(\r
+ ((EfiSourcePixel->Red >> 4) & PixelInformation->RedMask)\r
+ | ((EfiSourcePixel->Green) & PixelInformation->GreenMask)\r
+ | ((EfiSourcePixel->Blue << 4) & PixelInformation->BlueMask)\r
+ );\r
+\r
+ // Copy the SourcePixel into every pixel inside the target rectangle\r
+ for (DestinationLine = DestinationY;\r
+ DestinationLine < DestinationY + Height;\r
+ DestinationLine++)\r
+ {\r
+ for (DestinationPixelX = DestinationX;\r
+ DestinationPixelX < DestinationX + Width;\r
+ DestinationPixelX++)\r
+ {\r
+ // Calculate the target address:\r
+ DestinationPixel16bit = (UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationPixelX;\r
+\r
+ // Copy the pixel into the new target\r
+ *DestinationPixel16bit = Pixel16bit;\r
+ }\r
}\r
- }\r
- break;\r
-\r
- case LcdBitsPerPixel_8:\r
- case LcdBitsPerPixel_4:\r
- case LcdBitsPerPixel_2:\r
- case LcdBitsPerPixel_1:\r
- default:\r
- // Can't handle this case\r
- DEBUG((DEBUG_ERROR, "LcdGraphicsBlt: EfiBltVideoFill: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));\r
- Status = EFI_INVALID_PARAMETER;\r
- break;\r
+\r
+ break;\r
+\r
+ case LcdBitsPerPixel_8:\r
+ case LcdBitsPerPixel_4:\r
+ case LcdBitsPerPixel_2:\r
+ case LcdBitsPerPixel_1:\r
+ default:\r
+ // Can't handle this case\r
+ DEBUG ((DEBUG_ERROR, "LcdGraphicsBlt: EfiBltVideoFill: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));\r
+ Status = EFI_INVALID_PARAMETER;\r
+ break;\r
}\r
\r
return Status;\r
STATIC\r
EFI_STATUS\r
BltVideoToBltBuffer (\r
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,\r
- IN UINTN SourceX,\r
- IN UINTN SourceY,\r
- IN UINTN DestinationX,\r
- IN UINTN DestinationY,\r
- IN UINTN Width,\r
- IN UINTN Height,\r
- IN UINTN Delta OPTIONAL // Number of BYTES in a row of the BltBuffer\r
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
+ IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,\r
+ IN UINTN SourceX,\r
+ IN UINTN SourceY,\r
+ IN UINTN DestinationX,\r
+ IN UINTN DestinationY,\r
+ IN UINTN Width,\r
+ IN UINTN Height,\r
+ IN UINTN Delta OPTIONAL // Number of BYTES in a row of the BltBuffer\r
)\r
{\r
- EFI_STATUS Status;\r
- UINT32 HorizontalResolution;\r
- LCD_BPP BitsPerPixel;\r
- EFI_PIXEL_BITMASK *PixelInformation;\r
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *EfiDestinationPixel;\r
- VOID *FrameBufferBase;\r
- VOID *SourceAddr;\r
- VOID *DestinationAddr;\r
- UINT16 *SourcePixel16bit;\r
- UINT16 Pixel16bit;\r
- UINT32 SourcePixelX;\r
- UINT32 SourceLine;\r
- UINT32 DestinationPixelX;\r
- UINT32 DestinationLine;\r
- UINT32 BltBufferHorizontalResolution;\r
- UINTN WidthInBytes;\r
-\r
- Status = EFI_SUCCESS;\r
- PixelInformation = &This->Mode->Info->PixelInformation;\r
+ EFI_STATUS Status;\r
+ UINT32 HorizontalResolution;\r
+ LCD_BPP BitsPerPixel;\r
+ EFI_PIXEL_BITMASK *PixelInformation;\r
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL *EfiDestinationPixel;\r
+ VOID *FrameBufferBase;\r
+ VOID *SourceAddr;\r
+ VOID *DestinationAddr;\r
+ UINT16 *SourcePixel16bit;\r
+ UINT16 Pixel16bit;\r
+ UINT32 SourcePixelX;\r
+ UINT32 SourceLine;\r
+ UINT32 DestinationPixelX;\r
+ UINT32 DestinationLine;\r
+ UINT32 BltBufferHorizontalResolution;\r
+ UINTN WidthInBytes;\r
+\r
+ Status = EFI_SUCCESS;\r
+ PixelInformation = &This->Mode->Info->PixelInformation;\r
HorizontalResolution = This->Mode->Info->HorizontalResolution;\r
- FrameBufferBase = (UINTN *)((UINTN)(This->Mode->FrameBufferBase));\r
+ FrameBufferBase = (UINTN *)((UINTN)(This->Mode->FrameBufferBase));\r
\r
- if(( Delta != 0 ) && ( Delta != Width * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL))) {\r
+ if ((Delta != 0) && (Delta != Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL))) {\r
// Delta is not zero and it is different from the width.\r
// Divide it by the size of a pixel to find out the buffer's horizontal resolution.\r
- BltBufferHorizontalResolution = (UINT32) (Delta / sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
+ BltBufferHorizontalResolution = (UINT32)(Delta / sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
} else {\r
BltBufferHorizontalResolution = Width;\r
}\r
\r
- LcdPlatformGetBpp (This->Mode->Mode,&BitsPerPixel);\r
+ LcdPlatformGetBpp (This->Mode->Mode, &BitsPerPixel);\r
\r
switch (BitsPerPixel) {\r
- case LcdBitsPerPixel_24:\r
- WidthInBytes = Width * 4;\r
-\r
- // Access each line inside the Video Memory\r
- for (SourceLine = SourceY, DestinationLine = DestinationY;\r
- SourceLine < SourceY + Height;\r
- SourceLine++, DestinationLine++)\r
- {\r
- // Calculate the source and target addresses using 32bit pointer arithmetic:\r
- SourceAddr = (VOID *)((UINT32 *)FrameBufferBase + SourceLine * HorizontalResolution + SourceX );\r
- DestinationAddr = (VOID *)((UINT32 *)BltBuffer + DestinationLine * BltBufferHorizontalResolution + DestinationX);\r
-\r
- // Copy the entire line\r
- CopyMem( DestinationAddr, SourceAddr, WidthInBytes);\r
- }\r
- break;\r
-\r
- case LcdBitsPerPixel_16_555:\r
- // Access each pixel inside the Video Memory\r
- for (SourceLine = SourceY, DestinationLine = DestinationY;\r
- SourceLine < SourceY + Height;\r
- SourceLine++, DestinationLine++)\r
- {\r
- for (SourcePixelX = SourceX, DestinationPixelX = DestinationX;\r
- SourcePixelX < SourceX + Width;\r
- SourcePixelX++, DestinationPixelX++)\r
+ case LcdBitsPerPixel_24:\r
+ WidthInBytes = Width * 4;\r
+\r
+ // Access each line inside the Video Memory\r
+ for (SourceLine = SourceY, DestinationLine = DestinationY;\r
+ SourceLine < SourceY + Height;\r
+ SourceLine++, DestinationLine++)\r
{\r
- // Calculate the source and target addresses:\r
- SourcePixel16bit = (UINT16 *)FrameBufferBase + SourceLine * HorizontalResolution + SourcePixelX;\r
- EfiDestinationPixel = BltBuffer + DestinationLine * BltBufferHorizontalResolution + DestinationPixelX;\r
-\r
- // Snapshot the pixel from the video buffer once, to speed up the operation.\r
- // If we were dereferencing the pointer, as it is volatile, we would perform 3 memory read operations.\r
- Pixel16bit = *SourcePixel16bit;\r
-\r
- // Copy the pixel into the new target\r
- EfiDestinationPixel->Red = (UINT8) ( (Pixel16bit & PixelInformation->RedMask ) >> 7 );\r
- EfiDestinationPixel->Green = (UINT8) ( (Pixel16bit & PixelInformation->GreenMask ) >> 2);\r
- EfiDestinationPixel->Blue = (UINT8) ( (Pixel16bit & PixelInformation->BlueMask ) << 3 );\r
- // EfiDestinationPixel->Reserved = (UINT8) 0;\r
+ // Calculate the source and target addresses using 32bit pointer arithmetic:\r
+ SourceAddr = (VOID *)((UINT32 *)FrameBufferBase + SourceLine * HorizontalResolution + SourceX);\r
+ DestinationAddr = (VOID *)((UINT32 *)BltBuffer + DestinationLine * BltBufferHorizontalResolution + DestinationX);\r
+\r
+ // Copy the entire line\r
+ CopyMem (DestinationAddr, SourceAddr, WidthInBytes);\r
}\r
- }\r
- break;\r
-\r
- case LcdBitsPerPixel_16_565:\r
- // Access each pixel inside the Video Memory\r
- for (SourceLine = SourceY, DestinationLine = DestinationY;\r
- SourceLine < SourceY + Height;\r
- SourceLine++, DestinationLine++)\r
- {\r
- for (SourcePixelX = SourceX, DestinationPixelX = DestinationX;\r
- SourcePixelX < SourceX + Width;\r
- SourcePixelX++, DestinationPixelX++)\r
+\r
+ break;\r
+\r
+ case LcdBitsPerPixel_16_555:\r
+ // Access each pixel inside the Video Memory\r
+ for (SourceLine = SourceY, DestinationLine = DestinationY;\r
+ SourceLine < SourceY + Height;\r
+ SourceLine++, DestinationLine++)\r
{\r
- // Calculate the source and target addresses:\r
- SourcePixel16bit = (UINT16 *)FrameBufferBase + SourceLine * HorizontalResolution + SourcePixelX;\r
- EfiDestinationPixel = BltBuffer + DestinationLine * BltBufferHorizontalResolution + DestinationPixelX;\r
-\r
- // Snapshot the pixel from the video buffer once, to speed up the operation.\r
- // If we were dereferencing the pointer, as it is volatile, we would perform 3 memory read operations.\r
- Pixel16bit = *SourcePixel16bit;\r
-\r
- // Copy the pixel into the new target\r
- // There is no info for the Reserved byte, so we set it to zero\r
- EfiDestinationPixel->Red = (UINT8) ( (Pixel16bit & PixelInformation->RedMask ) >> 8 );\r
- EfiDestinationPixel->Green = (UINT8) ( (Pixel16bit & PixelInformation->GreenMask ) >> 3);\r
- EfiDestinationPixel->Blue = (UINT8) ( (Pixel16bit & PixelInformation->BlueMask ) << 3 );\r
- // EfiDestinationPixel->Reserved = (UINT8) 0;\r
+ for (SourcePixelX = SourceX, DestinationPixelX = DestinationX;\r
+ SourcePixelX < SourceX + Width;\r
+ SourcePixelX++, DestinationPixelX++)\r
+ {\r
+ // Calculate the source and target addresses:\r
+ SourcePixel16bit = (UINT16 *)FrameBufferBase + SourceLine * HorizontalResolution + SourcePixelX;\r
+ EfiDestinationPixel = BltBuffer + DestinationLine * BltBufferHorizontalResolution + DestinationPixelX;\r
+\r
+ // Snapshot the pixel from the video buffer once, to speed up the operation.\r
+ // If we were dereferencing the pointer, as it is volatile, we would perform 3 memory read operations.\r
+ Pixel16bit = *SourcePixel16bit;\r
+\r
+ // Copy the pixel into the new target\r
+ EfiDestinationPixel->Red = (UINT8)((Pixel16bit & PixelInformation->RedMask) >> 7);\r
+ EfiDestinationPixel->Green = (UINT8)((Pixel16bit & PixelInformation->GreenMask) >> 2);\r
+ EfiDestinationPixel->Blue = (UINT8)((Pixel16bit & PixelInformation->BlueMask) << 3);\r
+ // EfiDestinationPixel->Reserved = (UINT8) 0;\r
+ }\r
}\r
- }\r
- break;\r
-\r
- case LcdBitsPerPixel_12_444:\r
- // Access each pixel inside the Video Memory\r
- for (SourceLine = SourceY, DestinationLine = DestinationY;\r
- SourceLine < SourceY + Height;\r
- SourceLine++, DestinationLine++)\r
- {\r
- for (SourcePixelX = SourceX, DestinationPixelX = DestinationX;\r
- SourcePixelX < SourceX + Width;\r
- SourcePixelX++, DestinationPixelX++)\r
+\r
+ break;\r
+\r
+ case LcdBitsPerPixel_16_565:\r
+ // Access each pixel inside the Video Memory\r
+ for (SourceLine = SourceY, DestinationLine = DestinationY;\r
+ SourceLine < SourceY + Height;\r
+ SourceLine++, DestinationLine++)\r
{\r
- // Calculate the source and target addresses:\r
- SourcePixel16bit = (UINT16 *)FrameBufferBase + SourceLine * HorizontalResolution + SourcePixelX;\r
- EfiDestinationPixel = BltBuffer + DestinationLine * BltBufferHorizontalResolution + DestinationPixelX;\r
-\r
- // Snapshot the pixel from the video buffer once, to speed up the operation.\r
- // If we were dereferencing the pointer, as it is volatile, we would perform 3 memory read operations.\r
- Pixel16bit = *SourcePixel16bit;\r
-\r
- // Copy the pixel into the new target\r
- EfiDestinationPixel->Red = (UINT8) ( (Pixel16bit & PixelInformation->RedMask ) >> 4 );\r
- EfiDestinationPixel->Green = (UINT8) ( (Pixel16bit & PixelInformation->GreenMask ) );\r
- EfiDestinationPixel->Blue = (UINT8) ( (Pixel16bit & PixelInformation->BlueMask ) << 4 );\r
- // EfiDestinationPixel->Reserved = (UINT8) 0;\r
+ for (SourcePixelX = SourceX, DestinationPixelX = DestinationX;\r
+ SourcePixelX < SourceX + Width;\r
+ SourcePixelX++, DestinationPixelX++)\r
+ {\r
+ // Calculate the source and target addresses:\r
+ SourcePixel16bit = (UINT16 *)FrameBufferBase + SourceLine * HorizontalResolution + SourcePixelX;\r
+ EfiDestinationPixel = BltBuffer + DestinationLine * BltBufferHorizontalResolution + DestinationPixelX;\r
+\r
+ // Snapshot the pixel from the video buffer once, to speed up the operation.\r
+ // If we were dereferencing the pointer, as it is volatile, we would perform 3 memory read operations.\r
+ Pixel16bit = *SourcePixel16bit;\r
+\r
+ // Copy the pixel into the new target\r
+ // There is no info for the Reserved byte, so we set it to zero\r
+ EfiDestinationPixel->Red = (UINT8)((Pixel16bit & PixelInformation->RedMask) >> 8);\r
+ EfiDestinationPixel->Green = (UINT8)((Pixel16bit & PixelInformation->GreenMask) >> 3);\r
+ EfiDestinationPixel->Blue = (UINT8)((Pixel16bit & PixelInformation->BlueMask) << 3);\r
+ // EfiDestinationPixel->Reserved = (UINT8) 0;\r
+ }\r
}\r
- }\r
- break;\r
-\r
- case LcdBitsPerPixel_8:\r
- case LcdBitsPerPixel_4:\r
- case LcdBitsPerPixel_2:\r
- case LcdBitsPerPixel_1:\r
- default:\r
- // Can't handle this case\r
- DEBUG((DEBUG_ERROR, "LcdGraphicsBlt: EfiBltVideoToBltBuffer: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));\r
- Status = EFI_INVALID_PARAMETER;\r
- break;\r
+\r
+ break;\r
+\r
+ case LcdBitsPerPixel_12_444:\r
+ // Access each pixel inside the Video Memory\r
+ for (SourceLine = SourceY, DestinationLine = DestinationY;\r
+ SourceLine < SourceY + Height;\r
+ SourceLine++, DestinationLine++)\r
+ {\r
+ for (SourcePixelX = SourceX, DestinationPixelX = DestinationX;\r
+ SourcePixelX < SourceX + Width;\r
+ SourcePixelX++, DestinationPixelX++)\r
+ {\r
+ // Calculate the source and target addresses:\r
+ SourcePixel16bit = (UINT16 *)FrameBufferBase + SourceLine * HorizontalResolution + SourcePixelX;\r
+ EfiDestinationPixel = BltBuffer + DestinationLine * BltBufferHorizontalResolution + DestinationPixelX;\r
+\r
+ // Snapshot the pixel from the video buffer once, to speed up the operation.\r
+ // If we were dereferencing the pointer, as it is volatile, we would perform 3 memory read operations.\r
+ Pixel16bit = *SourcePixel16bit;\r
+\r
+ // Copy the pixel into the new target\r
+ EfiDestinationPixel->Red = (UINT8)((Pixel16bit & PixelInformation->RedMask) >> 4);\r
+ EfiDestinationPixel->Green = (UINT8)((Pixel16bit & PixelInformation->GreenMask));\r
+ EfiDestinationPixel->Blue = (UINT8)((Pixel16bit & PixelInformation->BlueMask) << 4);\r
+ // EfiDestinationPixel->Reserved = (UINT8) 0;\r
+ }\r
+ }\r
+\r
+ break;\r
+\r
+ case LcdBitsPerPixel_8:\r
+ case LcdBitsPerPixel_4:\r
+ case LcdBitsPerPixel_2:\r
+ case LcdBitsPerPixel_1:\r
+ default:\r
+ // Can't handle this case\r
+ DEBUG ((DEBUG_ERROR, "LcdGraphicsBlt: EfiBltVideoToBltBuffer: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));\r
+ Status = EFI_INVALID_PARAMETER;\r
+ break;\r
}\r
+\r
return Status;\r
}\r
\r
STATIC\r
EFI_STATUS\r
BltBufferToVideo (\r
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,\r
- IN UINTN SourceX,\r
- IN UINTN SourceY,\r
- IN UINTN DestinationX,\r
- IN UINTN DestinationY,\r
- IN UINTN Width,\r
- IN UINTN Height,\r
- IN UINTN Delta OPTIONAL // Number of BYTES in a row of the BltBuffer\r
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
+ IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,\r
+ IN UINTN SourceX,\r
+ IN UINTN SourceY,\r
+ IN UINTN DestinationX,\r
+ IN UINTN DestinationY,\r
+ IN UINTN Width,\r
+ IN UINTN Height,\r
+ IN UINTN Delta OPTIONAL // Number of BYTES in a row of the BltBuffer\r
)\r
{\r
- EFI_STATUS Status;\r
- UINT32 HorizontalResolution;\r
- LCD_BPP BitsPerPixel;\r
- EFI_PIXEL_BITMASK *PixelInformation;\r
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *EfiSourcePixel;\r
- VOID *FrameBufferBase;\r
- VOID *SourceAddr;\r
- VOID *DestinationAddr;\r
- UINT16 *DestinationPixel16bit;\r
- UINT32 SourcePixelX;\r
- UINT32 SourceLine;\r
- UINT32 DestinationPixelX;\r
- UINT32 DestinationLine;\r
- UINT32 BltBufferHorizontalResolution;\r
- UINTN WidthInBytes;\r
-\r
- Status = EFI_SUCCESS;\r
- PixelInformation = &This->Mode->Info->PixelInformation;\r
+ EFI_STATUS Status;\r
+ UINT32 HorizontalResolution;\r
+ LCD_BPP BitsPerPixel;\r
+ EFI_PIXEL_BITMASK *PixelInformation;\r
+ EFI_GRAPHICS_OUTPUT_BLT_PIXEL *EfiSourcePixel;\r
+ VOID *FrameBufferBase;\r
+ VOID *SourceAddr;\r
+ VOID *DestinationAddr;\r
+ UINT16 *DestinationPixel16bit;\r
+ UINT32 SourcePixelX;\r
+ UINT32 SourceLine;\r
+ UINT32 DestinationPixelX;\r
+ UINT32 DestinationLine;\r
+ UINT32 BltBufferHorizontalResolution;\r
+ UINTN WidthInBytes;\r
+\r
+ Status = EFI_SUCCESS;\r
+ PixelInformation = &This->Mode->Info->PixelInformation;\r
HorizontalResolution = This->Mode->Info->HorizontalResolution;\r
- FrameBufferBase = (UINTN *)((UINTN)(This->Mode->FrameBufferBase));\r
+ FrameBufferBase = (UINTN *)((UINTN)(This->Mode->FrameBufferBase));\r
\r
- if(( Delta != 0 ) && ( Delta != Width * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL))) {\r
+ if ((Delta != 0) && (Delta != Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL))) {\r
// Delta is not zero and it is different from the width.\r
// Divide it by the size of a pixel to find out the buffer's horizontal resolution.\r
- BltBufferHorizontalResolution = (UINT32) (Delta / sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
+ BltBufferHorizontalResolution = (UINT32)(Delta / sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
} else {\r
BltBufferHorizontalResolution = Width;\r
}\r
\r
- LcdPlatformGetBpp (This->Mode->Mode,&BitsPerPixel);\r
+ LcdPlatformGetBpp (This->Mode->Mode, &BitsPerPixel);\r
\r
switch (BitsPerPixel) {\r
- case LcdBitsPerPixel_24:\r
- WidthInBytes = Width * 4;\r
-\r
- // Access each pixel inside the BltBuffer Memory\r
- for (SourceLine = SourceY, DestinationLine = DestinationY;\r
- SourceLine < SourceY + Height;\r
- SourceLine++, DestinationLine++)\r
- {\r
- // Calculate the source and target addresses using 32bit pointer arithmetic:\r
- SourceAddr = (VOID *)((UINT32 *)BltBuffer + SourceLine * BltBufferHorizontalResolution + SourceX );\r
- DestinationAddr = (VOID *)((UINT32 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationX);\r
-\r
- // Copy the entire row Y\r
- CopyMem( DestinationAddr, SourceAddr, WidthInBytes);\r
- }\r
- break;\r
+ case LcdBitsPerPixel_24:\r
+ WidthInBytes = Width * 4;\r
\r
- case LcdBitsPerPixel_16_555:\r
- // Access each pixel inside the BltBuffer Memory\r
- for (SourceLine = SourceY, DestinationLine = DestinationY;\r
- SourceLine < SourceY + Height;\r
- SourceLine++, DestinationLine++) {\r
+ // Access each pixel inside the BltBuffer Memory\r
+ for (SourceLine = SourceY, DestinationLine = DestinationY;\r
+ SourceLine < SourceY + Height;\r
+ SourceLine++, DestinationLine++)\r
+ {\r
+ // Calculate the source and target addresses using 32bit pointer arithmetic:\r
+ SourceAddr = (VOID *)((UINT32 *)BltBuffer + SourceLine * BltBufferHorizontalResolution + SourceX);\r
+ DestinationAddr = (VOID *)((UINT32 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationX);\r
+\r
+ // Copy the entire row Y\r
+ CopyMem (DestinationAddr, SourceAddr, WidthInBytes);\r
+ }\r
+\r
+ break;\r
\r
- for (SourcePixelX = SourceX, DestinationPixelX = DestinationX;\r
- SourcePixelX < SourceX + Width;\r
- SourcePixelX++, DestinationPixelX++)\r
+ case LcdBitsPerPixel_16_555:\r
+ // Access each pixel inside the BltBuffer Memory\r
+ for (SourceLine = SourceY, DestinationLine = DestinationY;\r
+ SourceLine < SourceY + Height;\r
+ SourceLine++, DestinationLine++)\r
{\r
- // Calculate the source and target addresses:\r
- EfiSourcePixel = BltBuffer + SourceLine * BltBufferHorizontalResolution + SourcePixelX;\r
- DestinationPixel16bit = (UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationPixelX;\r
-\r
- // Copy the pixel into the new target\r
- // Only the most significant bits will be copied across:\r
- // To convert from 8 bits to 5 bits per pixel we throw away the 3 least significant bits\r
- *DestinationPixel16bit = (UINT16) (\r
- ( (EfiSourcePixel->Red << 7) & PixelInformation->RedMask )\r
- | ( (EfiSourcePixel->Green << 2) & PixelInformation->GreenMask )\r
- | ( (EfiSourcePixel->Blue >> 3) & PixelInformation->BlueMask )\r
- // | ( 0 & PixelInformation->ReservedMask )\r
- );\r
+ for (SourcePixelX = SourceX, DestinationPixelX = DestinationX;\r
+ SourcePixelX < SourceX + Width;\r
+ SourcePixelX++, DestinationPixelX++)\r
+ {\r
+ // Calculate the source and target addresses:\r
+ EfiSourcePixel = BltBuffer + SourceLine * BltBufferHorizontalResolution + SourcePixelX;\r
+ DestinationPixel16bit = (UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationPixelX;\r
+\r
+ // Copy the pixel into the new target\r
+ // Only the most significant bits will be copied across:\r
+ // To convert from 8 bits to 5 bits per pixel we throw away the 3 least significant bits\r
+ *DestinationPixel16bit = (UINT16)(\r
+ ((EfiSourcePixel->Red << 7) & PixelInformation->RedMask)\r
+ | ((EfiSourcePixel->Green << 2) & PixelInformation->GreenMask)\r
+ | ((EfiSourcePixel->Blue >> 3) & PixelInformation->BlueMask)\r
+ // | ( 0 & PixelInformation->ReservedMask )\r
+ );\r
+ }\r
}\r
- }\r
- break;\r
\r
- case LcdBitsPerPixel_16_565:\r
- // Access each pixel inside the BltBuffer Memory\r
- for (SourceLine = SourceY, DestinationLine = DestinationY;\r
- SourceLine < SourceY + Height;\r
- SourceLine++, DestinationLine++) {\r
+ break;\r
\r
- for (SourcePixelX = SourceX, DestinationPixelX = DestinationX;\r
- SourcePixelX < SourceX + Width;\r
- SourcePixelX++, DestinationPixelX++)\r
+ case LcdBitsPerPixel_16_565:\r
+ // Access each pixel inside the BltBuffer Memory\r
+ for (SourceLine = SourceY, DestinationLine = DestinationY;\r
+ SourceLine < SourceY + Height;\r
+ SourceLine++, DestinationLine++)\r
{\r
- // Calculate the source and target addresses:\r
- EfiSourcePixel = BltBuffer + SourceLine * BltBufferHorizontalResolution + SourcePixelX;\r
- DestinationPixel16bit = (UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationPixelX;\r
-\r
- // Copy the pixel into the new target\r
- // Only the most significant bits will be copied across:\r
- // To convert from 8 bits to 5 or 6 bits per pixel we throw away the 3 or 2 least significant bits\r
- // There is no room for the Reserved byte so we ignore that completely\r
- *DestinationPixel16bit = (UINT16) (\r
- ( (EfiSourcePixel->Red << 8) & PixelInformation->RedMask )\r
- | ( (EfiSourcePixel->Green << 3) & PixelInformation->GreenMask )\r
- | ( (EfiSourcePixel->Blue >> 3) & PixelInformation->BlueMask )\r
- );\r
+ for (SourcePixelX = SourceX, DestinationPixelX = DestinationX;\r
+ SourcePixelX < SourceX + Width;\r
+ SourcePixelX++, DestinationPixelX++)\r
+ {\r
+ // Calculate the source and target addresses:\r
+ EfiSourcePixel = BltBuffer + SourceLine * BltBufferHorizontalResolution + SourcePixelX;\r
+ DestinationPixel16bit = (UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationPixelX;\r
+\r
+ // Copy the pixel into the new target\r
+ // Only the most significant bits will be copied across:\r
+ // To convert from 8 bits to 5 or 6 bits per pixel we throw away the 3 or 2 least significant bits\r
+ // There is no room for the Reserved byte so we ignore that completely\r
+ *DestinationPixel16bit = (UINT16)(\r
+ ((EfiSourcePixel->Red << 8) & PixelInformation->RedMask)\r
+ | ((EfiSourcePixel->Green << 3) & PixelInformation->GreenMask)\r
+ | ((EfiSourcePixel->Blue >> 3) & PixelInformation->BlueMask)\r
+ );\r
+ }\r
}\r
- }\r
- break;\r
\r
- case LcdBitsPerPixel_12_444:\r
- // Access each pixel inside the BltBuffer Memory\r
- for (SourceLine = SourceY, DestinationLine = DestinationY;\r
- SourceLine < SourceY + Height;\r
- SourceLine++, DestinationLine++) {\r
+ break;\r
\r
- for (SourcePixelX = SourceX, DestinationPixelX = DestinationX;\r
- SourcePixelX < SourceX + Width;\r
- SourcePixelX++, DestinationPixelX++)\r
+ case LcdBitsPerPixel_12_444:\r
+ // Access each pixel inside the BltBuffer Memory\r
+ for (SourceLine = SourceY, DestinationLine = DestinationY;\r
+ SourceLine < SourceY + Height;\r
+ SourceLine++, DestinationLine++)\r
{\r
- // Calculate the source and target addresses:\r
- EfiSourcePixel = BltBuffer + SourceLine * BltBufferHorizontalResolution + SourcePixelX;\r
- DestinationPixel16bit = (UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationPixelX;\r
-\r
- // Copy the pixel into the new target\r
- // Only the most significant bits will be copied across:\r
- // To convert from 8 bits to 5 bits per pixel we throw away the 3 least significant bits\r
- *DestinationPixel16bit = (UINT16) (\r
- ( (EfiSourcePixel->Red << 4) & PixelInformation->RedMask )\r
- | ( (EfiSourcePixel->Green ) & PixelInformation->GreenMask )\r
- | ( (EfiSourcePixel->Blue >> 4) & PixelInformation->BlueMask )\r
- // | ( 0 & PixelInformation->ReservedMask )\r
- );\r
+ for (SourcePixelX = SourceX, DestinationPixelX = DestinationX;\r
+ SourcePixelX < SourceX + Width;\r
+ SourcePixelX++, DestinationPixelX++)\r
+ {\r
+ // Calculate the source and target addresses:\r
+ EfiSourcePixel = BltBuffer + SourceLine * BltBufferHorizontalResolution + SourcePixelX;\r
+ DestinationPixel16bit = (UINT16 *)FrameBufferBase + DestinationLine * HorizontalResolution + DestinationPixelX;\r
+\r
+ // Copy the pixel into the new target\r
+ // Only the most significant bits will be copied across:\r
+ // To convert from 8 bits to 5 bits per pixel we throw away the 3 least significant bits\r
+ *DestinationPixel16bit = (UINT16)(\r
+ ((EfiSourcePixel->Red << 4) & PixelInformation->RedMask)\r
+ | ((EfiSourcePixel->Green) & PixelInformation->GreenMask)\r
+ | ((EfiSourcePixel->Blue >> 4) & PixelInformation->BlueMask)\r
+ // | ( 0 & PixelInformation->ReservedMask )\r
+ );\r
+ }\r
}\r
- }\r
- break;\r
-\r
- case LcdBitsPerPixel_8:\r
- case LcdBitsPerPixel_4:\r
- case LcdBitsPerPixel_2:\r
- case LcdBitsPerPixel_1:\r
- default:\r
- // Can't handle this case\r
- DEBUG((DEBUG_ERROR, "LcdGraphicsBlt: EfiBltBufferToVideo: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));\r
- Status = EFI_INVALID_PARAMETER;\r
- break;\r
+\r
+ break;\r
+\r
+ case LcdBitsPerPixel_8:\r
+ case LcdBitsPerPixel_4:\r
+ case LcdBitsPerPixel_2:\r
+ case LcdBitsPerPixel_1:\r
+ default:\r
+ // Can't handle this case\r
+ DEBUG ((DEBUG_ERROR, "LcdGraphicsBlt: EfiBltBufferToVideo: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));\r
+ Status = EFI_INVALID_PARAMETER;\r
+ break;\r
}\r
+\r
return Status;\r
}\r
\r
STATIC\r
EFI_STATUS\r
BltVideoToVideo (\r
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,\r
- IN UINTN SourceX,\r
- IN UINTN SourceY,\r
- IN UINTN DestinationX,\r
- IN UINTN DestinationY,\r
- IN UINTN Width,\r
- IN UINTN Height,\r
- IN UINTN Delta OPTIONAL // Number of BYTES in a row of the BltBuffer\r
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
+ IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,\r
+ IN UINTN SourceX,\r
+ IN UINTN SourceY,\r
+ IN UINTN DestinationX,\r
+ IN UINTN DestinationY,\r
+ IN UINTN Width,\r
+ IN UINTN Height,\r
+ IN UINTN Delta OPTIONAL // Number of BYTES in a row of the BltBuffer\r
)\r
{\r
- EFI_STATUS Status;\r
- UINT32 HorizontalResolution;\r
- LCD_BPP BitsPerPixel;\r
- VOID *FrameBufferBase;\r
+ EFI_STATUS Status;\r
+ UINT32 HorizontalResolution;\r
+ LCD_BPP BitsPerPixel;\r
+ VOID *FrameBufferBase;\r
\r
HorizontalResolution = This->Mode->Info->HorizontalResolution;\r
- FrameBufferBase = (UINTN *)((UINTN)(This->Mode->FrameBufferBase));\r
+ FrameBufferBase = (UINTN *)((UINTN)(This->Mode->FrameBufferBase));\r
\r
//\r
// BltVideo to BltVideo:\r
// Source is the Video Memory,\r
// Destination is the Video Memory\r
\r
- LcdPlatformGetBpp (This->Mode->Mode,&BitsPerPixel);\r
+ LcdPlatformGetBpp (This->Mode->Mode, &BitsPerPixel);\r
FrameBufferBase = (UINTN *)((UINTN)(This->Mode->FrameBufferBase));\r
\r
// The UEFI spec currently states:\r
// "There is no limitation on the overlapping of the source and destination rectangles"\r
// Therefore, we must be careful to avoid overwriting the source data\r
- if( SourceY == DestinationY ) {\r
+ if ( SourceY == DestinationY ) {\r
// Copying within the same height, e.g. horizontal shift\r
- if( SourceX == DestinationX ) {\r
+ if ( SourceX == DestinationX ) {\r
// Nothing to do\r
Status = EFI_SUCCESS;\r
- } else if( ((SourceX>DestinationX)?(SourceX - DestinationX):(DestinationX - SourceX)) < Width ) {\r
+ } else if (((SourceX > DestinationX) ? (SourceX - DestinationX) : (DestinationX - SourceX)) < Width ) {\r
// There is overlap\r
- Status = VideoCopyHorizontalOverlap (BitsPerPixel, FrameBufferBase, HorizontalResolution, SourceX, SourceY, DestinationX, DestinationY, Width, Height );\r
+ Status = VideoCopyHorizontalOverlap (BitsPerPixel, FrameBufferBase, HorizontalResolution, SourceX, SourceY, DestinationX, DestinationY, Width, Height);\r
} else {\r
// No overlap\r
- Status = VideoCopyNoHorizontalOverlap (BitsPerPixel, FrameBufferBase, HorizontalResolution, SourceX, SourceY, DestinationX, DestinationY, Width, Height );\r
+ Status = VideoCopyNoHorizontalOverlap (BitsPerPixel, FrameBufferBase, HorizontalResolution, SourceX, SourceY, DestinationX, DestinationY, Width, Height);\r
}\r
} else {\r
// Copying from different heights\r
- Status = VideoCopyNoHorizontalOverlap (BitsPerPixel, FrameBufferBase, HorizontalResolution, SourceX, SourceY, DestinationX, DestinationY, Width, Height );\r
+ Status = VideoCopyNoHorizontalOverlap (BitsPerPixel, FrameBufferBase, HorizontalResolution, SourceX, SourceY, DestinationX, DestinationY, Width, Height);\r
}\r
\r
return Status;\r
EFI_STATUS\r
EFIAPI\r
LcdGraphicsBlt (\r
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
- IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,\r
- IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,\r
- IN UINTN SourceX,\r
- IN UINTN SourceY,\r
- IN UINTN DestinationX,\r
- IN UINTN DestinationY,\r
- IN UINTN Width,\r
- IN UINTN Height,\r
- IN UINTN Delta OPTIONAL // Number of BYTES in a row of the BltBuffer\r
+ IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,\r
+ IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,\r
+ IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,\r
+ IN UINTN SourceX,\r
+ IN UINTN SourceY,\r
+ IN UINTN DestinationX,\r
+ IN UINTN DestinationY,\r
+ IN UINTN Width,\r
+ IN UINTN Height,\r
+ IN UINTN Delta OPTIONAL // Number of BYTES in a row of the BltBuffer\r
)\r
{\r
- EFI_STATUS Status;\r
- UINT32 HorizontalResolution;\r
- UINT32 VerticalResolution;\r
- LCD_INSTANCE* Instance;\r
+ EFI_STATUS Status;\r
+ UINT32 HorizontalResolution;\r
+ UINT32 VerticalResolution;\r
+ LCD_INSTANCE *Instance;\r
\r
- Instance = LCD_INSTANCE_FROM_GOP_THIS(This);\r
+ Instance = LCD_INSTANCE_FROM_GOP_THIS (This);\r
\r
// Setup the hardware if not already done\r
if (!mDisplayInitialized) {\r
Status = InitializeDisplay (Instance);\r
- if (EFI_ERROR(Status)) {\r
+ if (EFI_ERROR (Status)) {\r
goto EXIT;\r
}\r
}\r
HorizontalResolution = This->Mode->Info->HorizontalResolution;\r
VerticalResolution = This->Mode->Info->VerticalResolution;\r
\r
- DEBUG((DEBUG_INFO, "LcdGraphicsBlt (BltOperation:%d,DestX:%d,DestY:%d,Width:%d,Height:%d) res(%d,%d)\n",\r
- BltOperation,DestinationX,DestinationY,Width,Height,HorizontalResolution,VerticalResolution));\r
+ DEBUG ((\r
+ DEBUG_INFO,\r
+ "LcdGraphicsBlt (BltOperation:%d,DestX:%d,DestY:%d,Width:%d,Height:%d) res(%d,%d)\n",\r
+ BltOperation,\r
+ DestinationX,\r
+ DestinationY,\r
+ Width,\r
+ Height,\r
+ HorizontalResolution,\r
+ VerticalResolution\r
+ ));\r
\r
// Check we have reasonable parameters\r
- if (Width == 0 || Height == 0) {\r
- DEBUG((DEBUG_ERROR, "LcdGraphicsBlt: ERROR - Invalid dimension: Zero size area.\n" ));\r
+ if ((Width == 0) || (Height == 0)) {\r
+ DEBUG ((DEBUG_ERROR, "LcdGraphicsBlt: ERROR - Invalid dimension: Zero size area.\n"));\r
Status = EFI_INVALID_PARAMETER;\r
goto EXIT;\r
}\r
\r
if ((BltOperation == EfiBltVideoFill) || (BltOperation == EfiBltBufferToVideo) || (BltOperation == EfiBltVideoToBltBuffer)) {\r
- ASSERT( BltBuffer != NULL);\r
+ ASSERT (BltBuffer != NULL);\r
}\r
\r
/*if ((DestinationX >= HorizontalResolution) || (DestinationY >= VerticalResolution)) {\r
// If we are reading data out of the video buffer, check that the source area is within the display limits\r
if ((BltOperation == EfiBltVideoToBltBuffer) || (BltOperation == EfiBltVideoToVideo)) {\r
if ((SourceY + Height > VerticalResolution) || (SourceX + Width > HorizontalResolution)) {\r
- DEBUG((DEBUG_INFO, "LcdGraphicsBlt: ERROR - Invalid source resolution.\n" ));\r
- DEBUG((DEBUG_INFO, " - SourceY=%d + Height=%d > VerticalResolution=%d.\n", SourceY, Height, VerticalResolution ));\r
- DEBUG((DEBUG_INFO, " - SourceX=%d + Width=%d > HorizontalResolution=%d.\n", SourceX, Width, HorizontalResolution ));\r
+ DEBUG ((DEBUG_INFO, "LcdGraphicsBlt: ERROR - Invalid source resolution.\n"));\r
+ DEBUG ((DEBUG_INFO, " - SourceY=%d + Height=%d > VerticalResolution=%d.\n", SourceY, Height, VerticalResolution));\r
+ DEBUG ((DEBUG_INFO, " - SourceX=%d + Width=%d > HorizontalResolution=%d.\n", SourceX, Width, HorizontalResolution));\r
Status = EFI_INVALID_PARAMETER;\r
goto EXIT;\r
}\r
// If we are writing data into the video buffer, that the destination area is within the display limits\r
if ((BltOperation == EfiBltVideoFill) || (BltOperation == EfiBltBufferToVideo) || (BltOperation == EfiBltVideoToVideo)) {\r
if ((DestinationY + Height > VerticalResolution) || (DestinationX + Width > HorizontalResolution)) {\r
- DEBUG((DEBUG_INFO, "LcdGraphicsBlt: ERROR - Invalid destination resolution.\n" ));\r
- DEBUG((DEBUG_INFO, " - DestinationY=%d + Height=%d > VerticalResolution=%d.\n", DestinationY, Height, VerticalResolution ));\r
- DEBUG((DEBUG_INFO, " - DestinationX=%d + Width=%d > HorizontalResolution=%d.\n", DestinationX, Width, HorizontalResolution ));\r
+ DEBUG ((DEBUG_INFO, "LcdGraphicsBlt: ERROR - Invalid destination resolution.\n"));\r
+ DEBUG ((DEBUG_INFO, " - DestinationY=%d + Height=%d > VerticalResolution=%d.\n", DestinationY, Height, VerticalResolution));\r
+ DEBUG ((DEBUG_INFO, " - DestinationX=%d + Width=%d > HorizontalResolution=%d.\n", DestinationX, Width, HorizontalResolution));\r
Status = EFI_INVALID_PARAMETER;\r
goto EXIT;\r
}\r
//\r
\r
switch (BltOperation) {\r
- case EfiBltVideoFill:\r
- Status = BltVideoFill (This, BltBuffer, SourceX, SourceY, DestinationX, DestinationY, Width, Height, Delta);\r
- break;\r
+ case EfiBltVideoFill:\r
+ Status = BltVideoFill (This, BltBuffer, SourceX, SourceY, DestinationX, DestinationY, Width, Height, Delta);\r
+ break;\r
\r
- case EfiBltVideoToBltBuffer:\r
- Status = BltVideoToBltBuffer (This, BltBuffer, SourceX, SourceY, DestinationX, DestinationY, Width, Height, Delta);\r
- break;\r
+ case EfiBltVideoToBltBuffer:\r
+ Status = BltVideoToBltBuffer (This, BltBuffer, SourceX, SourceY, DestinationX, DestinationY, Width, Height, Delta);\r
+ break;\r
\r
- case EfiBltBufferToVideo:\r
- Status = BltBufferToVideo (This, BltBuffer, SourceX, SourceY, DestinationX, DestinationY, Width, Height, Delta);\r
- break;\r
+ case EfiBltBufferToVideo:\r
+ Status = BltBufferToVideo (This, BltBuffer, SourceX, SourceY, DestinationX, DestinationY, Width, Height, Delta);\r
+ break;\r
\r
- case EfiBltVideoToVideo:\r
- Status = BltVideoToVideo (This, BltBuffer, SourceX, SourceY, DestinationX, DestinationY, Width, Height, Delta);\r
- break;\r
+ case EfiBltVideoToVideo:\r
+ Status = BltVideoToVideo (This, BltBuffer, SourceX, SourceY, DestinationX, DestinationY, Width, Height, Delta);\r
+ break;\r
\r
- case EfiGraphicsOutputBltOperationMax:\r
- default:\r
- DEBUG((DEBUG_ERROR, "LcdGraphicsBlt: Invalid Operation\n"));\r
- Status = EFI_INVALID_PARAMETER;\r
- break;\r
+ case EfiGraphicsOutputBltOperationMax:\r
+ default:\r
+ DEBUG ((DEBUG_ERROR, "LcdGraphicsBlt: Invalid Operation\n"));\r
+ Status = EFI_INVALID_PARAMETER;\r
+ break;\r
}\r
\r
EXIT:\r