iPXE
UgaDraw.h
Go to the documentation of this file.
00001 /** @file
00002   UGA Draw protocol from the EFI 1.10 specification.
00003 
00004   Abstraction of a very simple graphics device.
00005 
00006   Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
00007   This program and the accompanying materials
00008   are licensed and made available under the terms and conditions of the BSD License
00009   which accompanies this distribution.  The full text of the license may be found at
00010   http://opensource.org/licenses/bsd-license.php
00011 
00012   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
00013   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
00014 
00015 **/
00016 
00017 #ifndef __UGA_DRAW_H__
00018 #define __UGA_DRAW_H__
00019 
00020 FILE_LICENCE ( BSD3 );
00021 
00022 
00023 #define EFI_UGA_DRAW_PROTOCOL_GUID \
00024   { \
00025     0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 } \
00026   }
00027 
00028 typedef struct _EFI_UGA_DRAW_PROTOCOL EFI_UGA_DRAW_PROTOCOL;
00029 
00030 /**
00031   Return the current video mode information.
00032 
00033   @param  This                  The EFI_UGA_DRAW_PROTOCOL instance.
00034   @param  HorizontalResolution  The size of video screen in pixels in the X dimension.
00035   @param  VerticalResolution    The size of video screen in pixels in the Y dimension.
00036   @param  ColorDepth            Number of bits per pixel, currently defined to be 32.
00037   @param  RefreshRate           The refresh rate of the monitor in Hertz.
00038 
00039   @retval EFI_SUCCESS           Mode information returned.
00040   @retval EFI_NOT_STARTED       Video display is not initialized. Call SetMode ()
00041   @retval EFI_INVALID_PARAMETER One of the input args was NULL.
00042 
00043 **/
00044 typedef
00045 EFI_STATUS
00046 (EFIAPI *EFI_UGA_DRAW_PROTOCOL_GET_MODE)(
00047   IN  EFI_UGA_DRAW_PROTOCOL *This,
00048   OUT UINT32                *HorizontalResolution,
00049   OUT UINT32                *VerticalResolution,
00050   OUT UINT32                *ColorDepth,
00051   OUT UINT32                *RefreshRate
00052   );
00053 
00054 /**
00055   Set the current video mode information.
00056 
00057   @param  This                 The EFI_UGA_DRAW_PROTOCOL instance.
00058   @param  HorizontalResolution The size of video screen in pixels in the X dimension.
00059   @param  VerticalResolution   The size of video screen in pixels in the Y dimension.
00060   @param  ColorDepth           Number of bits per pixel, currently defined to be 32.
00061   @param  RefreshRate          The refresh rate of the monitor in Hertz.
00062 
00063   @retval EFI_SUCCESS          Mode information returned.
00064   @retval EFI_NOT_STARTED      Video display is not initialized. Call SetMode ()
00065 
00066 **/
00067 typedef
00068 EFI_STATUS
00069 (EFIAPI *EFI_UGA_DRAW_PROTOCOL_SET_MODE)(
00070   IN  EFI_UGA_DRAW_PROTOCOL *This,
00071   IN  UINT32                HorizontalResolution,
00072   IN  UINT32                VerticalResolution,
00073   IN  UINT32                ColorDepth,
00074   IN  UINT32                RefreshRate
00075   );
00076 
00077 typedef struct {
00078   UINT8 Blue;
00079   UINT8 Green;
00080   UINT8 Red;
00081   UINT8 Reserved;
00082 } EFI_UGA_PIXEL;
00083 
00084 typedef union {
00085   EFI_UGA_PIXEL Pixel;
00086   UINT32        Raw;
00087 } EFI_UGA_PIXEL_UNION;
00088 
00089 ///
00090 /// Enumration value for actions of Blt operations.
00091 ///
00092 typedef enum {
00093   EfiUgaVideoFill,          ///< Write data from the  BltBuffer pixel (SourceX, SourceY)
00094                             ///< directly to every pixel of the video display rectangle
00095                             ///< (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
00096                             ///< Only one pixel will be used from the BltBuffer. Delta is NOT used.
00097 
00098   EfiUgaVideoToBltBuffer,   ///< Read data from the video display rectangle
00099                             ///< (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
00100                             ///< the BltBuffer rectangle (DestinationX, DestinationY )
00101                             ///< (DestinationX + Width, DestinationY + Height). If DestinationX or
00102                             ///< DestinationY is not zero then Delta must be set to the length in bytes
00103                             ///< of a row in the BltBuffer.
00104 
00105   EfiUgaBltBufferToVideo,   ///< Write data from the  BltBuffer rectangle
00106                             ///< (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
00107                             ///< video display rectangle (DestinationX, DestinationY)
00108                             ///< (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
00109                             ///< not zero then Delta must be set to the length in bytes of a row in the
00110                             ///< BltBuffer.
00111 
00112   EfiUgaVideoToVideo,       ///< Copy from the video display rectangle (SourceX, SourceY)
00113                             ///< (SourceX + Width, SourceY + Height) .to the video display rectangle
00114                             ///< (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
00115                             ///< The BltBuffer and Delta  are not used in this mode.
00116 
00117   EfiUgaBltMax              ///< Maxmimum value for enumration value of Blt operation. If a Blt operation
00118                             ///< larger or equal to this enumration value, it is invalid.
00119 } EFI_UGA_BLT_OPERATION;
00120 
00121 /**
00122     Blt a rectangle of pixels on the graphics screen.
00123 
00124     @param[in] This          - Protocol instance pointer.
00125     @param[in] BltBuffer     - Buffer containing data to blit into video buffer. This
00126                                buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL)
00127     @param[in] BltOperation  - Operation to perform on BlitBuffer and video memory
00128     @param[in] SourceX       - X coordinate of source for the BltBuffer.
00129     @param[in] SourceY       - Y coordinate of source for the BltBuffer.
00130     @param[in] DestinationX  - X coordinate of destination for the BltBuffer.
00131     @param[in] DestinationY  - Y coordinate of destination for the BltBuffer.
00132     @param[in] Width         - Width of rectangle in BltBuffer in pixels.
00133     @param[in] Height        - Hight of rectangle in BltBuffer in pixels.
00134     @param[in] Delta         - OPTIONAL
00135 
00136     @retval EFI_SUCCESS           - The Blt operation completed.
00137     @retval EFI_INVALID_PARAMETER - BltOperation is not valid.
00138     @retval EFI_DEVICE_ERROR      - A hardware error occured writting to the video buffer.
00139 
00140 **/
00141 typedef
00142 EFI_STATUS
00143 (EFIAPI *EFI_UGA_DRAW_PROTOCOL_BLT)(
00144   IN  EFI_UGA_DRAW_PROTOCOL                   * This,
00145   IN  EFI_UGA_PIXEL                           * BltBuffer, OPTIONAL
00146   IN  EFI_UGA_BLT_OPERATION                   BltOperation,
00147   IN  UINTN                                   SourceX,
00148   IN  UINTN                                   SourceY,
00149   IN  UINTN                                   DestinationX,
00150   IN  UINTN                                   DestinationY,
00151   IN  UINTN                                   Width,
00152   IN  UINTN                                   Height,
00153   IN  UINTN                                   Delta         OPTIONAL
00154   );
00155 
00156 ///
00157 /// This protocol provides a basic abstraction to set video modes and
00158 /// copy pixels to and from the graphics controller's frame buffer.
00159 ///
00160 struct _EFI_UGA_DRAW_PROTOCOL {
00161   EFI_UGA_DRAW_PROTOCOL_GET_MODE  GetMode;
00162   EFI_UGA_DRAW_PROTOCOL_SET_MODE  SetMode;
00163   EFI_UGA_DRAW_PROTOCOL_BLT       Blt;
00164 };
00165 
00166 extern EFI_GUID gEfiUgaDrawProtocolGuid;
00167 
00168 #endif