1 /*++ 2 3 Copyright (c) 2004, Intel Corporation. All rights reserved.<BR> 4 This program and the accompanying materials 5 are licensed and made available under the terms and conditions of the BSD License 6 which accompanies this distribution. The full text of the license may be found at 7 http://opensource.org/licenses/bsd-license.php 8 9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 12 Module Name: 13 14 UgaDraw.h 15 16 Abstract: 17 18 UGA Draw protocol from the EFI 1.1 specification. 19 20 Abstraction of a very simple graphics device. 21 22 --*/ 23 24 #ifndef __UGA_DRAW_H__ 25 #define __UGA_DRAW_H__ 26 27 #define EFI_UGA_DRAW_PROTOCOL_GUID \ 28 { \ 29 0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39} \ 30 } 31 32 typedef struct _EFI_UGA_DRAW_PROTOCOL EFI_UGA_DRAW_PROTOCOL; 33 34 typedef 35 EFI_STATUS 36 (EFIAPI *EFI_UGA_DRAW_PROTOCOL_GET_MODE) ( 37 IN EFI_UGA_DRAW_PROTOCOL * This, 38 OUT UINT32 *HorizontalResolution, 39 OUT UINT32 *VerticalResolution, 40 OUT UINT32 *ColorDepth, 41 OUT UINT32 *RefreshRate 42 ) 43 /*++ 44 45 Routine Description: 46 Return the current video mode information. 47 48 Arguments: 49 This - Protocol instance pointer. 50 HorizontalResolution - Current video horizontal resolution in pixels 51 VerticalResolution - Current video vertical resolution in pixels 52 ColorDepth - Current video color depth in bits per pixel 53 RefreshRate - Current video refresh rate in Hz. 54 55 Returns: 56 EFI_SUCCESS - Mode information returned. 57 EFI_NOT_STARTED - Video display is not initialized. Call SetMode () 58 EFI_INVALID_PARAMETER - One of the input args was NULL. 59 60 --*/ 61 ; 62 63 typedef 64 EFI_STATUS 65 (EFIAPI *EFI_UGA_DRAW_PROTOCOL_SET_MODE) ( 66 IN EFI_UGA_DRAW_PROTOCOL * This, 67 IN UINT32 HorizontalResolution, 68 IN UINT32 VerticalResolution, 69 IN UINT32 ColorDepth, 70 IN UINT32 RefreshRate 71 ) 72 /*++ 73 74 Routine Description: 75 Return the current video mode information. 76 77 Arguments: 78 This - Protocol instance pointer. 79 HorizontalResolution - Current video horizontal resolution in pixels 80 VerticalResolution - Current video vertical resolution in pixels 81 ColorDepth - Current video color depth in bits per pixel 82 RefreshRate - Current video refresh rate in Hz. 83 84 Returns: 85 EFI_SUCCESS - Mode information returned. 86 EFI_NOT_STARTED - Video display is not initialized. Call SetMode () 87 88 --*/ 89 ; 90 91 typedef struct { 92 UINT8 Blue; 93 UINT8 Green; 94 UINT8 Red; 95 UINT8 Reserved; 96 } EFI_UGA_PIXEL; 97 98 typedef union { 99 EFI_UGA_PIXEL Pixel; 100 UINT32 Raw; 101 } EFI_UGA_PIXEL_UNION; 102 103 typedef enum { 104 EfiUgaVideoFill, 105 EfiUgaVideoToBltBuffer, 106 EfiUgaBltBufferToVideo, 107 EfiUgaVideoToVideo, 108 EfiUgaBltMax 109 } EFI_UGA_BLT_OPERATION; 110 111 typedef 112 EFI_STATUS 113 (EFIAPI *EFI_UGA_DRAW_PROTOCOL_BLT) ( 114 IN EFI_UGA_DRAW_PROTOCOL * This, 115 IN EFI_UGA_PIXEL * BltBuffer, OPTIONAL 116 IN EFI_UGA_BLT_OPERATION BltOperation, 117 IN UINTN SourceX, 118 IN UINTN SourceY, 119 IN UINTN DestinationX, 120 IN UINTN DestinationY, 121 IN UINTN Width, 122 IN UINTN Height, 123 IN UINTN Delta OPTIONAL 124 ); 125 126 /*++ 127 128 Routine Description: 129 The following table defines actions for BltOperations: 130 EfiUgaVideoFill - Write data from the BltBuffer pixel (SourceX, SourceY) 131 directly to every pixel of the video display rectangle 132 (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). 133 Only one pixel will be used from the BltBuffer. Delta is NOT used. 134 EfiUgaVideoToBltBuffer - Read data from the video display rectangle 135 (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in 136 the BltBuffer rectangle (DestinationX, DestinationY ) 137 (DestinationX + Width, DestinationY + Height). If DestinationX or 138 DestinationY is not zero then Delta must be set to the length in bytes 139 of a row in the BltBuffer. 140 EfiUgaBltBufferToVideo - Write data from the BltBuffer rectangle 141 (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the 142 video display rectangle (DestinationX, DestinationY) 143 (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is 144 not zero then Delta must be set to the length in bytes of a row in the 145 BltBuffer. 146 EfiUgaVideoToVideo - Copy from the video display rectangle (SourceX, SourceY) 147 (SourceX + Width, SourceY + Height) .to the video display rectangle 148 (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). 149 The BltBuffer and Delta are not used in this mode. 150 151 Arguments: 152 This - Protocol instance pointer. 153 BltBuffer - Buffer containing data to blit into video buffer. This 154 buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL) 155 BltOperation - Operation to perform on BlitBuffer and video memory 156 SourceX - X coordinate of source for the BltBuffer. 157 SourceY - Y coordinate of source for the BltBuffer. 158 DestinationX - X coordinate of destination for the BltBuffer. 159 DestinationY - Y coordinate of destination for the BltBuffer. 160 Width - Width of rectangle in BltBuffer in pixels. 161 Height - Hight of rectangle in BltBuffer in pixels. 162 Delta - 163 164 Returns: 165 EFI_SUCCESS - The Blt operation completed. 166 EFI_INVALID_PARAMETER - BltOperation is not valid. 167 EFI_DEVICE_ERROR - A hardware error occured writting to the video 168 buffer. 169 170 --*/ 171 ; 172 173 struct _EFI_UGA_DRAW_PROTOCOL { 174 EFI_UGA_DRAW_PROTOCOL_GET_MODE GetMode; 175 EFI_UGA_DRAW_PROTOCOL_SET_MODE SetMode; 176 EFI_UGA_DRAW_PROTOCOL_BLT Blt; 177 }; 178 179 extern EFI_GUID gEfiUgaDrawProtocolGuid; 180 181 #endif 182