-
Notifications
You must be signed in to change notification settings - Fork 141
/
Copy path0003-BootGraphicsResourceTableDxe-properly-handle-SetBoot.patch
148 lines (133 loc) · 4.44 KB
/
0003-BootGraphicsResourceTableDxe-properly-handle-SetBoot.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
From 367d54664c0572c64f42209c5652a50977e72c5e Mon Sep 17 00:00:00 2001
From: Andrei Warkentin <[email protected]>
Date: Mon, 14 May 2018 01:10:50 -0400
Subject: [PATCH 3/4] BootGraphicsResourceTableDxe: properly handle SetBootLogo
with NULL buffer
SetBootLogo would not free the previous logo memory, which in turn
means that a BGRT would still be installed, even if marked as not valid.
Windows 10 actually uses the BGRT image for its boot screen even if
not 'valid', which seems incredibly unintuitive.
This new behavior means a few things:
1) A boot to the default boot option (where SetBootLogo(NULL) is never
called) will result in Windows displaying the OEM logo.
2) Any other boot (via boot manager, second boot option, etc) will
result in Windows displaying its own logo. Honestly, this is much
better from a user experience, since it will be obvious that
something "non-default" is happening to the system.
Signed-off-by: Andrei Warkentin <[email protected]>
---
.../BootGraphicsResourceTableDxe.c | 54 ++++++++-----------
1 file changed, 22 insertions(+), 32 deletions(-)
diff --git a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c
index cfd4be0ebf..e672281ec5 100644
--- a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c
+++ b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c
@@ -145,14 +145,12 @@ EDKII_BOOT_LOGO2_PROTOCOL mBootLogo2ProtocolTemplate = {
EFI_EVENT mBootGraphicsReadyToBootEvent;
UINTN mBootGraphicsResourceTableKey = 0;
-BOOLEAN mIsLogoValid = FALSE;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *mLogoBltBuffer = NULL;
UINTN mLogoDestX = 0;
UINTN mLogoDestY = 0;
UINTN mLogoWidth = 0;
UINTN mLogoHeight = 0;
BOOLEAN mAcpiBgrtInstalled = FALSE;
-BOOLEAN mAcpiBgrtStatusChanged = FALSE;
BOOLEAN mAcpiBgrtBufferChanged = FALSE;
//
@@ -255,9 +253,20 @@ SetBootLogo2 (
UINTN BufferSize;
UINT32 Result32;
+ //
+ // Update state
+ //
+ mAcpiBgrtBufferChanged = TRUE;
+
+ //
+ // Free old logo buffer
+ //
+ if (mLogoBltBuffer != NULL) {
+ FreePool (mLogoBltBuffer);
+ mLogoBltBuffer = NULL;
+ }
+
if (BltBuffer == NULL) {
- mIsLogoValid = FALSE;
- mAcpiBgrtStatusChanged = TRUE;
return EFI_SUCCESS;
}
@@ -310,19 +319,6 @@ SetBootLogo2 (
return EFI_UNSUPPORTED;
}
- //
- // Update state
- //
- mAcpiBgrtBufferChanged = TRUE;
-
- //
- // Free old logo buffer
- //
- if (mLogoBltBuffer != NULL) {
- FreePool (mLogoBltBuffer);
- mLogoBltBuffer = NULL;
- }
-
//
// Allocate new logo buffer
//
@@ -335,7 +331,6 @@ SetBootLogo2 (
mLogoDestY = DestinationY;
mLogoWidth = Width;
mLogoHeight = Height;
- mIsLogoValid = TRUE;
return EFI_SUCCESS;
}
@@ -441,7 +436,7 @@ BgrtReadyToBootEventNotify (
// Check whether Boot Graphics Resource Table is already installed.
//
if (mAcpiBgrtInstalled) {
- if (!mAcpiBgrtStatusChanged && !mAcpiBgrtBufferChanged) {
+ if (!mAcpiBgrtBufferChanged) {
//
// Nothing has changed
//
@@ -458,13 +453,13 @@ BgrtReadyToBootEventNotify (
return;
}
}
- } else {
- //
- // Check whether Logo exists
- //
- if (mLogoBltBuffer == NULL) {
- return;
- }
+ }
+
+ //
+ // Check whether Logo exist.
+ //
+ if (mLogoBltBuffer == NULL) {
+ return;
}
if (mAcpiBgrtBufferChanged) {
@@ -509,11 +504,7 @@ BgrtReadyToBootEventNotify (
//
// Update Status field of Boot Graphics Resource Table
//
- if (mIsLogoValid) {
- mBootGraphicsResourceTableTemplate.Status = EFI_ACPI_5_0_BGRT_STATUS_VALID;
- } else {
- mBootGraphicsResourceTableTemplate.Status = EFI_ACPI_5_0_BGRT_STATUS_INVALID;
- }
+ mBootGraphicsResourceTableTemplate.Status = EFI_ACPI_5_0_BGRT_STATUS_VALID;
//
// Update Checksum of Boot Graphics Resource Table
@@ -539,7 +530,6 @@ BgrtReadyToBootEventNotify (
}
mAcpiBgrtInstalled = TRUE;
- mAcpiBgrtStatusChanged = FALSE;
mAcpiBgrtBufferChanged = FALSE;
}
--
2.17.1