Home | History | Annotate | Download | only in GraphicsOutput
      1 /*++
      2 
      3 Copyright (c) 2006, 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   GraphicsOutput.h
     15 
     16 Abstract:
     17 
     18   Graphics Output Protocol from the UEFI 2.0 specification.
     19 
     20   Abstraction of a very simple graphics device.
     21 
     22 --*/
     23 
     24 #ifndef __GRAPHICS_OUTPUT_H__
     25 #define __GRAPHICS_OUTPUT_H__
     26 
     27 #include EFI_PROTOCOL_DEFINITION (UgaDraw)
     28 
     29 #define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
     30   { \
     31     0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a} \
     32   }
     33 
     34 typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL;
     35 
     36 typedef struct {
     37   UINT32            RedMask;
     38   UINT32            GreenMask;
     39   UINT32            BlueMask;
     40   UINT32            ReservedMask;
     41 } EFI_PIXEL_BITMASK;
     42 
     43 typedef enum {
     44   PixelRedGreenBlueReserved8BitPerColor,
     45   PixelBlueGreenRedReserved8BitPerColor,
     46   PixelBitMask,
     47   PixelBltOnly,
     48   PixelFormatMax
     49 } EFI_GRAPHICS_PIXEL_FORMAT;
     50 
     51 typedef struct {
     52   UINT32                     Version;
     53   UINT32                     HorizontalResolution;
     54   UINT32                     VerticalResolution;
     55   EFI_GRAPHICS_PIXEL_FORMAT  PixelFormat;
     56   EFI_PIXEL_BITMASK          PixelInformation;
     57   UINT32                     PixelsPerScanLine;
     58 } EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;
     59 
     60 typedef
     61 EFI_STATUS
     62 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) (
     63   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL          *This,
     64   IN  UINT32                                ModeNumber,
     65   OUT UINTN                                 *SizeOfInfo,
     66   OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  **Info
     67   )
     68 /*++
     69 
     70   Routine Description:
     71     Return the current video mode information.
     72 
     73   Arguments:
     74     This                  - Protocol instance pointer.
     75     ModeNumber            - The mode number to return information on.
     76     SizeOfInfo            - A pointer to the size, in bytes, of the Info buffer.
     77     Info                  - A pointer to callee allocated buffer that returns information about ModeNumber.
     78 
     79   Returns:
     80     EFI_SUCCESS           - Mode information returned.
     81     EFI_DEVICE_ERROR      - A hardware error occurred trying to retrieve the video mode.
     82     EFI_NOT_STARTED       - Video display is not initialized. Call SetMode ()
     83     EFI_INVALID_PARAMETER - One of the input args was NULL.
     84 
     85 --*/
     86 ;
     87 
     88 typedef
     89 EFI_STATUS
     90 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) (
     91   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL * This,
     92   IN  UINT32                       ModeNumber
     93   )
     94 /*++
     95 
     96   Routine Description:
     97     Return the current video mode information.
     98 
     99   Arguments:
    100     This             - Protocol instance pointer.
    101     ModeNumber       - The mode number to be set.
    102 
    103   Returns:
    104     EFI_SUCCESS      - Graphics mode was changed.
    105     EFI_DEVICE_ERROR - The device had an error and could not complete the request.
    106     EFI_UNSUPPORTED  - ModeNumber is not supported by this device.
    107 
    108 --*/
    109 ;
    110 
    111 typedef EFI_UGA_PIXEL EFI_GRAPHICS_OUTPUT_BLT_PIXEL;
    112 
    113 typedef union {
    114   EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;
    115   UINT32                        Raw;
    116 } EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;
    117 
    118 typedef enum {
    119   EfiBltVideoFill,
    120   EfiBltVideoToBltBuffer,
    121   EfiBltBufferToVideo,
    122   EfiBltVideoToVideo,
    123   EfiGraphicsOutputBltOperationMax
    124 } EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
    125 
    126 typedef
    127 EFI_STATUS
    128 (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) (
    129   IN  EFI_GRAPHICS_OUTPUT_PROTOCOL            * This,
    130   IN  EFI_GRAPHICS_OUTPUT_BLT_PIXEL           * BltBuffer, OPTIONAL
    131   IN  EFI_GRAPHICS_OUTPUT_BLT_OPERATION       BltOperation,
    132   IN  UINTN                                   SourceX,
    133   IN  UINTN                                   SourceY,
    134   IN  UINTN                                   DestinationX,
    135   IN  UINTN                                   DestinationY,
    136   IN  UINTN                                   Width,
    137   IN  UINTN                                   Height,
    138   IN  UINTN                                   Delta         OPTIONAL
    139   );
    140 
    141 /*++
    142 
    143   Routine Description:
    144     The following table defines actions for BltOperations:
    145     EfiBltVideoFill - Write data from the  BltBuffer pixel (SourceX, SourceY)
    146       directly to every pixel of the video display rectangle
    147       (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
    148       Only one pixel will be used from the BltBuffer. Delta is NOT used.
    149     EfiBltVideoToBltBuffer - Read data from the video display rectangle
    150       (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
    151       the BltBuffer rectangle (DestinationX, DestinationY )
    152       (DestinationX + Width, DestinationY + Height). If DestinationX or
    153       DestinationY is not zero then Delta must be set to the length in bytes
    154       of a row in the BltBuffer.
    155     EfiBltBufferToVideo - Write data from the  BltBuffer rectangle
    156       (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
    157       video display rectangle (DestinationX, DestinationY)
    158       (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
    159       not zero then Delta must be set to the length in bytes of a row in the
    160       BltBuffer.
    161     EfiBltVideoToVideo - Copy from the video display rectangle (SourceX, SourceY)
    162      (SourceX + Width, SourceY + Height) .to the video display rectangle
    163      (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
    164      The BltBuffer and Delta  are not used in this mode.
    165 
    166   Arguments:
    167     This          - Protocol instance pointer.
    168     BltBuffer     - Buffer containing data to blit into video buffer. This
    169                     buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
    170     BltOperation  - Operation to perform on BlitBuffer and video memory
    171     SourceX       - X coordinate of source for the BltBuffer.
    172     SourceY       - Y coordinate of source for the BltBuffer.
    173     DestinationX  - X coordinate of destination for the BltBuffer.
    174     DestinationY  - Y coordinate of destination for the BltBuffer.
    175     Width         - Width of rectangle in BltBuffer in pixels.
    176     Height        - Hight of rectangle in BltBuffer in pixels.
    177     Delta         -
    178 
    179   Returns:
    180     EFI_SUCCESS           - The Blt operation completed.
    181     EFI_INVALID_PARAMETER - BltOperation is not valid.
    182     EFI_DEVICE_ERROR      - A hardware error occured writting to the video
    183                              buffer.
    184 
    185 --*/
    186 ;
    187 
    188 typedef struct {
    189   UINT32                                 MaxMode;
    190   UINT32                                 Mode;
    191   EFI_GRAPHICS_OUTPUT_MODE_INFORMATION   *Info;
    192   UINTN                                  SizeOfInfo;
    193   EFI_PHYSICAL_ADDRESS                   FrameBufferBase;
    194   UINTN                                  FrameBufferSize;
    195 } EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;
    196 
    197 struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {
    198   EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE  QueryMode;
    199   EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE    SetMode;
    200   EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT         Blt;
    201   EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE        *Mode;
    202 };
    203 
    204 extern EFI_GUID gEfiGraphicsOutputProtocolGuid;
    205 
    206 #endif
    207