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