blob: 72260dd0864cc913c2885c760b68d7c1c4d47dbb [file] [log] [blame]
lijuang45882c32019-06-18 13:46:55 +08001/* Copyright (c) 2016, 2017, 2019, The Linux Foundation. All rights reserved.
lijuangc9d156e2016-07-27 18:31:00 +08002 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are
5 * met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above
9 * copyright notice, this list of conditions and the following
10 * disclaimer in the documentation and/or other materials provided
11 * with the distribution.
12 * * Neither the name of The Linux Foundation nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*/
28
lijuangc9d156e2016-07-27 18:31:00 +080029#ifndef _DRAWUI_H_
30#define _DRAWUI_H_
31
32#include <Uefi.h>
33
lijuang64679b72017-09-26 15:52:10 +080034/* 45 characters per line for portrait orientation
35 * "720 (W) 1280(H)" : "sysfont2x" -- 720 /(8*2) = 45
36 * "1080(W) 1920(H)" : "sysfont3x" -- 1080/(8*3) = 45
37 * "1440(W) 2560(H)" : "sysfont4x" -- 1440/(8*4) = 45
38 * "2160(W) 3840(H)" : "sysfont6x" -- 2160/(8*6) = 45
lijuangc9d156e2016-07-27 18:31:00 +080039 */
Jeevan Shriram17f173d2017-10-24 22:11:07 -070040#define CHAR_NUM_PERROW_POR 45
lijuang64679b72017-09-26 15:52:10 +080041
42/* 80 characters per line for horizontal orientation
lijuangdac345c2017-10-19 14:25:09 +080043 * "480 (H) 640 (W)" : "" -- 640 / (8 * 1) = 80
lijuang64679b72017-09-26 15:52:10 +080044 * "720 (H) 1280(W)" : "sysfont2x" -- 1280/(8*2) = 80
45 * "1080(H) 1920(W)" : "sysfont3x" -- 1920/(8*3) = 80
46 * "1440(H) 2560(W)" : "sysfont4x" -- 2560/(8*4) = 80
47 * "2160(H) 3840(W)" : "sysfont6x" -- 3840/(8*6) = 80
48 */
Jeevan Shriram17f173d2017-10-24 22:11:07 -070049#define CHAR_NUM_PERROW_HOR 80
lijuang64679b72017-09-26 15:52:10 +080050
lijuang45882c32019-06-18 13:46:55 +080051/* Max row for portrait orientation
52 * "720 (W) 1280(H)" : "sysfont2x" -- 1280/(19*2) = 33
53 * "1080(W) 1920(H)" : "sysfont3x" -- 1920/(19*3) = 33
54 * "1440(W) 2560(H)" : "sysfont4x" -- 2560/(19*4) = 33
55 * "2160(W) 3840(H)" : "sysfont6x" -- 3840/(19*6) = 33
56 */
57#define MAX_ROW_FOR_POR 33
58
59/* Max row for horizontal orientation
60 * "480 (H) 640 (W)" : "" -- 480/(19*1) = 25
61 * "720 (H) 1280(W)" : "" -- 720/(19*1) = 37
62 * "1080(H) 1920(W)" : "sysfont2" -- 1080/(19*2) = 28
63 * "1440(H) 2560(W)" : "sysfont3" -- 1440/(19*3) = 25
64 * "2160(H) 3840(W)" : "sysfont4" -- 2160/(19*4) = 28
65 */
66#define MAX_ROW_FOR_HOR 25
67
Jeevan Shriram17f173d2017-10-24 22:11:07 -070068#define MAX_MSG_SIZE 256
69#define MAX_RSP_SIZE 64
lijuangc9d156e2016-07-27 18:31:00 +080070
71typedef enum {
lijuang45882c32019-06-18 13:46:55 +080072 PORTRAIT_MODE = 0,
73 HORIZONTAL_MODE
74} DISPLAY_MODE;
75
76typedef enum {
Jeevan Shriram17f173d2017-10-24 22:11:07 -070077 DISPLAY_MENU_YELLOW = 0,
78 DISPLAY_MENU_ORANGE,
79 DISPLAY_MENU_RED,
80 DISPLAY_MENU_EIO,
81 DISPLAY_MENU_MORE_OPTION,
82 DISPLAY_MENU_UNLOCK,
83 DISPLAY_MENU_FASTBOOT,
84 DISPLAY_MENU_UNLOCK_CRITICAL,
85 DISPLAY_MENU_LOCK,
86 DISPLAY_MENU_LOCK_CRITICAL
lijuangc9d156e2016-07-27 18:31:00 +080087} DISPLAY_MENU_TYPE;
88
89typedef enum {
Jeevan Shriram17f173d2017-10-24 22:11:07 -070090 BGR_WHITE,
91 BGR_BLACK,
92 BGR_ORANGE,
93 BGR_YELLOW,
94 BGR_RED,
95 BGR_GREEN,
96 BGR_BLUE,
97 BGR_CYAN,
98 BGR_SILVER,
lijuangc9d156e2016-07-27 18:31:00 +080099} COLOR_TYPE;
100
101typedef enum {
Jeevan Shriram17f173d2017-10-24 22:11:07 -0700102 COMMON_FACTOR = 1,
103 BIG_FACTOR,
104 MAX_FACTORTYPE = 2,
lijuangc9d156e2016-07-27 18:31:00 +0800105} SCALE_FACTOR_TYPE;
106
107typedef enum {
Jeevan Shriram17f173d2017-10-24 22:11:07 -0700108 POWEROFF = 0,
109 RESTART,
110 RECOVER,
111 FASTBOOT,
112 BACK,
113 CONTINUE,
114 FFBM,
115 QMMI,
116 NOACTION,
117 OPTION_ACTION_MAX,
lijuangc9d156e2016-07-27 18:31:00 +0800118} OPTION_ITEM_ACTION;
119
120typedef enum {
Jeevan Shriram17f173d2017-10-24 22:11:07 -0700121 COMMON = 0,
122 ALIGN_RIGHT,
123 ALIGN_LEFT,
124 OPTION_ITEM,
125 LINEATION,
lijuangc9d156e2016-07-27 18:31:00 +0800126} MENU_STRING_TYPE;
127
Jeevan Shriram17f173d2017-10-24 22:11:07 -0700128typedef struct {
129 CHAR8 Msg[MAX_MSG_SIZE];
130 UINT32 ScaleFactorType;
131 UINT32 FgColor;
132 UINT32 BgColor;
133 UINT32 Attribute;
134 UINT32 Location;
135 UINT32 Action;
lijuangc9d156e2016-07-27 18:31:00 +0800136} MENU_MSG_INFO;
137
138typedef struct {
Jeevan Shriram17f173d2017-10-24 22:11:07 -0700139 MENU_MSG_INFO *MsgInfo;
140 UINT32 OptionItems[OPTION_ACTION_MAX];
141 UINT32 OptionNum;
142 UINT32 OptionIndex;
143 UINT32 MenuType;
144 UINT32 TimeoutTime;
lijuangc9d156e2016-07-27 18:31:00 +0800145} MENU_OPTION_ITEM_INFO;
146
147typedef struct {
Jeevan Shriram17f173d2017-10-24 22:11:07 -0700148 MENU_OPTION_ITEM_INFO Info;
149 UINT32 LastMenuType;
lijuangc9d156e2016-07-27 18:31:00 +0800150} OPTION_MENU_INFO;
151
Jeevan Shriram17f173d2017-10-24 22:11:07 -0700152VOID
153SetMenuMsgInfo (MENU_MSG_INFO *MenuMsgInfo,
154 CHAR8 *Msg,
155 UINT32 ScaleFactorType,
156 UINT32 FgColor,
157 UINT32 BgColor,
158 UINT32 Attribute,
159 UINT32 Location,
160 UINT32 Action);
161EFI_STATUS
162DrawMenu (MENU_MSG_INFO *TargetMenu, UINT32 *Height);
163EFI_STATUS
164UpdateMsgBackground (MENU_MSG_INFO *MenuMsgInfo, UINT32 NewBgColor);
165EFI_STATUS BackUpBootLogoBltBuffer (VOID);
lijuanga4a9a652017-09-29 09:34:16 +0800166VOID RestoreBootLogoBitBuffer (VOID);
Jeevan Shriram17f173d2017-10-24 22:11:07 -0700167VOID FreeBootLogoBltBuffer (VOID);
168VOID DrawMenuInit (VOID);
lijuangc9d156e2016-07-27 18:31:00 +0800169#endif