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