diff mbox

[edk2,3/6] OvmfPkg/PlatformBootManagerLib: bring back the progress bar

Message ID 1464179806-24099-4-git-send-email-lersek@redhat.com
State New
Headers show

Commit Message

Laszlo Ersek May 25, 2016, 12:36 p.m. UTC
OVMF's Platform BDS used to have a nice progress bar (with
IntelFrameworkModulePkg BDS). We can restore it by copying the
PlatformBootManagerWaitCallback() function verbatim from

  Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c

It can be tested by passing the following option to QEMU (5 seconds):

  -boot menu=on,splash-time=5000

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

---
 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

-- 
1.8.3.1


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Laszlo Ersek May 25, 2016, 5:23 p.m. UTC | #1
On 05/25/16 19:00, Jordan Justen wrote:
> On 2016-05-25 05:36:43, Laszlo Ersek wrote:

>> OVMF's Platform BDS used to have a nice progress bar (with

>> IntelFrameworkModulePkg BDS). We can restore it by copying the

>> PlatformBootManagerWaitCallback() function verbatim from

>>

>>   Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c

>>

>> It can be tested by passing the following option to QEMU (5 seconds):

>>

>>   -boot menu=on,splash-time=5000

>>

>> Cc: Jordan Justen <jordan.l.justen@intel.com>

>> Cc: Ruiyu Ni <ruiyu.ni@intel.com>

>> Contributed-under: TianoCore Contribution Agreement 1.0

>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

>> ---

>>  OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 17 +++++++++++++++++

>>  1 file changed, 17 insertions(+)

>>

>> diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c

>> index 9eb9e390373d..dd8757f58ec3 100644

>> --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c

>> +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c

>> @@ -1425,5 +1425,22 @@ PlatformBootManagerWaitCallback (

>>    UINT16          TimeoutRemain

>>    )

>>  {

>> +  EFI_GRAPHICS_OUTPUT_BLT_PIXEL Black;

>> +  EFI_GRAPHICS_OUTPUT_BLT_PIXEL White;

>> +  UINT16                        Timeout;

>> +

>> +  Timeout = PcdGet16 (PcdPlatformBootTimeOut);

>> +

>> +  Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;

>> +  White.Blue = White.Green = White.Red = White.Reserved = 0xFF;

> 

> I know this came from Nt32, but how about making these global vars?

> 

> static EFI_GRAPHICS_OUTPUT_BLT_PIXEL Black = { 0, 0, 0, 0 };

> static EFI_GRAPHICS_OUTPUT_BLT_PIXEL White = { 0xff, 0xff, 0xff, 0 };


I'm okay with giving them static storage duration.

With that changed,
- do you want me to keep them in function scope (with the same names),
- or should I move them to file scope (and then, as Andrew suggests,
  rename them to, say, mPixelBlack and mPixelWhite)?

Thanks
Laszlo

> Series Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

> 

>> +

>> +  BootLogoUpdateProgress (

>> +    White,

>> +    Black,

>> +    L"Start boot option",

>> +    White,

>> +    (Timeout - TimeoutRemain) * 100 / Timeout,

>> +    0

>> +    );

>>  }

>>  

>> -- 

>> 1.8.3.1

>>

>>


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Laszlo Ersek May 25, 2016, 9:13 p.m. UTC | #2
On 05/25/16 21:53, Jordan Justen wrote:
> On 2016-05-25 10:23:56, Laszlo Ersek wrote:

>> On 05/25/16 19:00, Jordan Justen wrote:

>>> On 2016-05-25 05:36:43, Laszlo Ersek wrote:

>>>> OVMF's Platform BDS used to have a nice progress bar (with

>>>> IntelFrameworkModulePkg BDS). We can restore it by copying the

>>>> PlatformBootManagerWaitCallback() function verbatim from

>>>>

>>>>   Nt32Pkg/Library/PlatformBootManagerLib/PlatformBootManager.c

>>>>

>>>> It can be tested by passing the following option to QEMU (5 seconds):

>>>>

>>>>   -boot menu=on,splash-time=5000

>>>>

>>>> Cc: Jordan Justen <jordan.l.justen@intel.com>

>>>> Cc: Ruiyu Ni <ruiyu.ni@intel.com>

>>>> Contributed-under: TianoCore Contribution Agreement 1.0

>>>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

>>>> ---

>>>>  OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 17 +++++++++++++++++

>>>>  1 file changed, 17 insertions(+)

>>>>

>>>> diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c

>>>> index 9eb9e390373d..dd8757f58ec3 100644

>>>> --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c

>>>> +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c

>>>> @@ -1425,5 +1425,22 @@ PlatformBootManagerWaitCallback (

>>>>    UINT16          TimeoutRemain

>>>>    )

>>>>  {

>>>> +  EFI_GRAPHICS_OUTPUT_BLT_PIXEL Black;

>>>> +  EFI_GRAPHICS_OUTPUT_BLT_PIXEL White;

>>>> +  UINT16                        Timeout;

>>>> +

>>>> +  Timeout = PcdGet16 (PcdPlatformBootTimeOut);

>>>> +

>>>> +  Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;

>>>> +  White.Blue = White.Green = White.Red = White.Reserved = 0xFF;

>>>

>>> I know this came from Nt32, but how about making these global vars?

>>>

>>> static EFI_GRAPHICS_OUTPUT_BLT_PIXEL Black = { 0, 0, 0, 0 };

>>> static EFI_GRAPHICS_OUTPUT_BLT_PIXEL White = { 0xff, 0xff, 0xff, 0 };

>>

>> I'm okay with giving them static storage duration.

>>

>> With that changed,

>> - do you want me to keep them in function scope (with the same names),

>> - or should I move them to file scope (and then, as Andrew suggests,

>>   rename them to, say, mPixelBlack and mPixelWhite)?

>>

> 

> The part that bugged me was setting .Reserved to 0xff.

> 

> How about just making them initialized local variables?

> 

>   EFI_GRAPHICS_OUTPUT_BLT_PIXEL Black = { 0, 0, 0, 0 };

>   EFI_GRAPHICS_OUTPUT_BLT_PIXEL White = { 0xff, 0xff, 0xff, 0 };


That would conflict with the edk2 coding style (6.8 C Function Layout,
"Initializing a variable as part of its declaration is illegal" --
although it clearly doesn't cover variables with static storage duration.)

I even suspect that the first initialization could cause some compilers
to emit memset() intrinsics.

How about:

  Black.Blue = Black.Green = Black.Red = 0;
  White.Blue = White.Green = White.Red = 0xFF;
  Black.Reserved = White.Reserved = 0;

(I could submit a patch for Nt32Pkg too that fixed White.Reserved.)

Thanks
Laszlo
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 9eb9e390373d..dd8757f58ec3 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -1425,5 +1425,22 @@  PlatformBootManagerWaitCallback (
   UINT16          TimeoutRemain
   )
 {
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL Black;
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL White;
+  UINT16                        Timeout;
+
+  Timeout = PcdGet16 (PcdPlatformBootTimeOut);
+
+  Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;
+  White.Blue = White.Green = White.Red = White.Reserved = 0xFF;
+
+  BootLogoUpdateProgress (
+    White,
+    Black,
+    L"Start boot option",
+    White,
+    (Timeout - TimeoutRemain) * 100 / Timeout,
+    0
+    );
 }