public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms PATCH 1/1] Platforms/RPi3: DisplayDxe virtual resolution improvements
@ 2019-09-27  9:20 Pete Batard
  2019-09-27 16:38 ` [edk2-devel] " Philippe Mathieu-Daudé
  2019-09-28 23:05 ` Leif Lindholm
  0 siblings, 2 replies; 12+ messages in thread
From: Pete Batard @ 2019-09-27  9:20 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, leif.lindholm

From: Andrei Warkentin <andrey.warkentin@gmail.com>

The Pi GPU decouples requested resolution from actual physical resolution
and can perform scaling of virtual resolutions. This enables platform users
to do something like ask for 1024x768 and get a framebuffer of that size,
regardless of the actual output (which could be a very blurry SDTV).

Specifically, this patch allows selecting which specific virtual
resolutions to enable, thus replacing the old all-or-nothing behaviour
with either all virtual resolutions supported, or just the native one.

This patch also adds enables the common 7" Pi (800x480) screen to be used
at 800x600 resolution, instead of forcing 640x480 as the only usable
resolution.

Signed-off-by: Pete Batard <pete@akeo.ie>
---
 Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c      |  9 +--
 Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf    |  2 +-
 Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni | 17 +++--
 Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr | 71 ++++++++++++++++----
 Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c    | 53 +++++++++++++--
 Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf  |  2 +-
 Platform/RaspberryPi/RPi3/RPi3.dec                           |  2 +-
 Platform/RaspberryPi/RPi3/RPi3.dsc                           |  2 +-
 8 files changed, 125 insertions(+), 33 deletions(-)

diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c
index fcb4ce6935b6..98e58a560ed4 100644
--- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c
+++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c
@@ -92,6 +92,7 @@ SetupVariables (
   )
 {
   UINTN Size;
+  UINT8 Var8;
   UINT32 Var32;
   EFI_STATUS Status;
 
@@ -180,12 +181,12 @@ SetupVariables (
     PcdSet32 (PcdDebugShowUEFIExit, PcdGet32 (PcdDebugShowUEFIExit));
   }
 
-  Size = sizeof (UINT32);
-  Status = gRT->GetVariable (L"DisplayEnableVModes",
+  Size = sizeof (UINT8);
+  Status = gRT->GetVariable (L"DisplayEnableScaledVModes",
                   &gConfigDxeFormSetGuid,
-                  NULL, &Size, &Var32);
+                  NULL, &Size, &Var8);
   if (EFI_ERROR (Status)) {
-    PcdSet32 (PcdDisplayEnableVModes, PcdGet32 (PcdDisplayEnableVModes));
+    PcdSet8 (PcdDisplayEnableScaledVModes, PcdGet8 (PcdDisplayEnableScaledVModes));
   }
 
   Size = sizeof (UINT32);
diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf
index 2fc4302526a1..24112d517467 100644
--- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf
+++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf
@@ -64,7 +64,7 @@ [Pcd]
   gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti
   gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG
   gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit
-  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes
+  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes
   gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot
 
 [FeaturePcd]
diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni
index 65b45f3e6496..9b4076635f05 100644
--- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni
+++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni
@@ -71,10 +71,19 @@
 #string STR_DISPLAY_FORM_TITLE      #language en-US "Display"
 #string STR_DISPLAY_FORM_SUBTITLE   #language en-US "UEFI video driver settings"
 
-#string STR_DISPLAY_VMODES_PROMPT   #language en-US "Resolutions"
-#string STR_DISPLAY_VMODES_HELP     #language en-US "Support for non-native modes"
-#string STR_DISPLAY_VMODES_ENABLE   #language en-US "Also support 640x480, 800x600, 1024x768, 720p and 1080p"
-#string STR_DISPLAY_VMODES_DISABLE  #language en-US "Only native resolution"
+#string STR_DISPLAY_VMODES_640_PROMPT  #language en-US "Virtual 640x480"
+#string STR_DISPLAY_VMODES_640_HELP    #language en-US "Enable scaled 640x480 mode"
+#string STR_DISPLAY_VMODES_800_PROMPT  #language en-US "Virtual 800x600"
+#string STR_DISPLAY_VMODES_800_HELP    #language en-US "Enable scaled 800x600 mode"
+#string STR_DISPLAY_VMODES_1024_PROMPT #language en-US "Virtual 1024x768"
+#string STR_DISPLAY_VMODES_1024_HELP   #language en-US "Enable scaled 1024x768 mode"
+#string STR_DISPLAY_VMODES_720_PROMPT  #language en-US "Virtual 720p"
+#string STR_DISPLAY_VMODES_720_HELP    #language en-US "Enable scaled 720p mode"
+#string STR_DISPLAY_VMODES_1080_PROMPT #language en-US "Virtual 1080p"
+#string STR_DISPLAY_VMODES_1080_HELP   #language en-US "Enable scaled 1080p mode"
+
+#string STR_DISPLAY_VMODES_REAL_PROMPT #language en-US "Native resolution"
+#string STR_DISPLAY_VMODES_REAL_HELP   #language en-US "Native resolution"
 
 #string STR_DISPLAY_SSHOT_PROMPT    #language en-US "Screenshot Support"
 #string STR_DISPLAY_SSHOT_HELP      #language en-US "Save screen capture as a BMP on the first writable file system found"
diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr
index 217a285b5a1f..60bfdbd4d17e 100644
--- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr
+++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr
@@ -9,14 +9,23 @@
 #include <Guid/HiiPlatformSetupFormset.h>
 #include "ConfigDxeFormSetGuid.h"
 
+#pragma pack(1)
 typedef struct {
   /*
-   * 0 - One mode for the boot resolution.
-   * 1 - Adds additional "typical" resolutions like
-   *     640x480, 800x600, 1024 x 768, 720p and 1080p.
+   * One bit for each scaled resolution supported,
+   * these are ordered exactly like mGopModeData
+   * in DisplayDxe.
+   *
+   * 800x600, 640x480, 1024x768, 720p, 1080p, native.
    */
-   UINT32 Enable;
-} DISPLAY_ENABLE_VMODES_VARSTORE_DATA;
+   UINT8 v640   : 1;
+   UINT8 v800   : 1;
+   UINT8 v1024  : 1;
+   UINT8 v720p  : 1;
+   UINT8 v1080p : 1;
+   UINT8 Physical : 1;
+} DISPLAY_ENABLE_SCALED_VMODES_VARSTORE_DATA;
+#pragma pack()
 
 typedef struct {
   /*
@@ -166,9 +175,9 @@ formset
       name  = DebugShowUEFIExit,
       guid  = CONFIGDXE_FORM_SET_GUID;
 
-    efivarstore DISPLAY_ENABLE_VMODES_VARSTORE_DATA,
+    efivarstore DISPLAY_ENABLE_SCALED_VMODES_VARSTORE_DATA,
       attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
-      name  = DisplayEnableVModes,
+      name  = DisplayEnableScaledVModes,
       guid  = CONFIGDXE_FORM_SET_GUID;
 
     efivarstore DISPLAY_ENABLE_SSHOT_VARSTORE_DATA,
@@ -282,13 +291,47 @@ formset
         title  = STRING_TOKEN(STR_DISPLAY_FORM_TITLE);
         subtitle text = STRING_TOKEN(STR_DISPLAY_FORM_SUBTITLE);
 
-        oneof varid = DisplayEnableVModes.Enable,
-            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_PROMPT),
-            help        = STRING_TOKEN(STR_DISPLAY_VMODES_HELP),
-            flags       = NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED,
-            option text = STRING_TOKEN(STR_DISPLAY_VMODES_ENABLE), value = 1, flags = DEFAULT;
-            option text = STRING_TOKEN(STR_DISPLAY_VMODES_DISABLE), value = 0, flags = 0;
-        endoneof;
+        checkbox varid = DisplayEnableScaledVModes.v640,
+            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_640_PROMPT),
+            help        = STRING_TOKEN(STR_DISPLAY_VMODES_640_HELP),
+            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
+            default     = TRUE,
+        endcheckbox;
+
+        checkbox varid = DisplayEnableScaledVModes.v800,
+            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_800_PROMPT),
+            help        = STRING_TOKEN(STR_DISPLAY_VMODES_800_HELP),
+            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
+            default     = TRUE,
+        endcheckbox;
+
+        checkbox varid = DisplayEnableScaledVModes.v1024,
+            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_1024_PROMPT),
+            help        = STRING_TOKEN(STR_DISPLAY_VMODES_1024_HELP),
+            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
+            default     = TRUE,
+        endcheckbox;
+
+        checkbox varid = DisplayEnableScaledVModes.v720p,
+            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_720_PROMPT),
+            help        = STRING_TOKEN(STR_DISPLAY_VMODES_720_HELP),
+            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
+            default     = TRUE,
+        endcheckbox;
+
+        checkbox varid = DisplayEnableScaledVModes.v1080p,
+            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_1080_PROMPT),
+            help        = STRING_TOKEN(STR_DISPLAY_VMODES_1080_HELP),
+            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
+            default     = TRUE,
+        endcheckbox;
+
+        checkbox varid = DisplayEnableScaledVModes.Physical,
+            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_REAL_PROMPT),
+            help        = STRING_TOKEN(STR_DISPLAY_VMODES_REAL_HELP),
+            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
+            default     = TRUE,
+        endcheckbox;
 
         oneof varid = DisplayEnableSShot.Enable,
             prompt      = STRING_TOKEN(STR_DISPLAY_SSHOT_PROMPT),
diff --git a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c
index 9475a5ad670c..b880ca827bd6 100644
--- a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c
+++ b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c
@@ -10,6 +10,14 @@
 #include <Base.h>
 #include "DisplayDxe.h"
 
+#define MODE_800_ENABLED      BIT0
+#define MODE_640_ENABLED      BIT1
+#define MODE_1024_ENABLED     BIT2
+#define MODE_720P_ENABLED     BIT3
+#define MODE_1080P_ENABLED    BIT4
+#define MODE_NATIVE_ENABLED   BIT5
+#define JUST_NATIVE_ENABLED   MODE_NATIVE_ENABLED
+#define ALL_MODES             (BIT6 - 1)
 #define POS_TO_FB(posX, posY) ((UINT8*)                                 \
                                ((UINTN)This->Mode->FrameBufferBase +    \
                                 (posY) * This->Mode->Info->PixelsPerScanLine * \
@@ -104,7 +112,7 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol;
 STATIC EFI_CPU_ARCH_PROTOCOL *mCpu;
 
 STATIC UINTN mLastMode;
-STATIC GOP_MODE_DATA mGopModeData[] = {
+STATIC GOP_MODE_DATA mGopModeTemplate[] = {
   { 800,  600  }, /* Legacy */
   { 640,  480  }, /* Legacy */
   { 1024, 768  }, /* Legacy */
@@ -113,6 +121,9 @@ STATIC GOP_MODE_DATA mGopModeData[] = {
   { 0,    0    }, /* Physical */
 };
 
+STATIC UINTN mLastMode;
+STATIC GOP_MODE_DATA mGopModeData[ARRAY_SIZE (mGopModeTemplate)];
+
 STATIC DISPLAY_DEVICE_PATH mDisplayProtoDevicePath =
 {
   {
@@ -446,6 +457,7 @@ DriverStart (
   )
 {
   UINTN Index;
+  UINTN TempIndex;
   EFI_STATUS Status;
   VOID *Dummy;
 
@@ -473,11 +485,29 @@ DriverStart (
     goto Done;
   }
 
+  PcdSet8 (PcdDisplayEnableScaledVModes,
+    PcdGet8 (PcdDisplayEnableScaledVModes) & ALL_MODES);
 
-  if (PcdGet32 (PcdDisplayEnableVModes)) {
-    mLastMode = ARRAY_SIZE (mGopModeData) - 1;
-  } else {
-    mLastMode = 0;
+  if (PcdGet8 (PcdDisplayEnableScaledVModes) == 0) {
+    PcdSet8 (PcdDisplayEnableScaledVModes, JUST_NATIVE_ENABLED);
+  }
+
+  mLastMode = 0;
+  for  (TempIndex = 0, Index = 0;
+        TempIndex < ARRAY_SIZE (mGopModeTemplate); TempIndex++) {
+    if ((PcdGet8 (PcdDisplayEnableScaledVModes) & (1 << TempIndex)) != 0) {
+      DEBUG ((DEBUG_ERROR, "Mode %u: %u x %u present\n",
+        TempIndex, mGopModeTemplate[TempIndex].Width,
+        mGopModeTemplate[TempIndex].Height));
+
+      CopyMem (&mGopModeData[Index], &mGopModeTemplate[TempIndex],
+        sizeof (GOP_MODE_DATA));
+      mLastMode = Index;
+      Index++;
+    }
+  }
+
+  if (PcdGet8 (PcdDisplayEnableScaledVModes) == JUST_NATIVE_ENABLED) {
     /*
      * mBootWidth x mBootHeight may not be sensible,
      * so clean it up, since we won't be adding
@@ -486,11 +516,20 @@ DriverStart (
     if (mBootWidth < 640 || mBootHeight < 480) {
       mBootWidth = 640;
       mBootHeight = 480;
+    } else if (mBootWidth == 800 && mBootHeight == 480) {
+      /* The Pi 7" screen is close to 800x600, just pretend it is. */
+      mBootHeight = 600;
     }
   }
 
-  mGopModeData[mLastMode].Width = mBootWidth;
-  mGopModeData[mLastMode].Height = mBootHeight;
+  if ((PcdGet8(PcdDisplayEnableScaledVModes) & MODE_NATIVE_ENABLED) != 0) {
+     /*
+      * Adjust actual native res only if native res is enabled
+      * (so last mode is native res).
+      */
+     mGopModeData[mLastMode].Width = mBootWidth;
+     mGopModeData[mLastMode].Height = mBootHeight;
+  }
 
   for (Index = 0; Index <= mLastMode; Index++) {
     UINTN FbSize;
diff --git a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf
index 11271045bdd9..31da2090b402 100644
--- a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf
+++ b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf
@@ -57,7 +57,7 @@ [Protocols]
   gRaspberryPiFirmwareProtocolGuid
 
 [Pcd]
-  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes
+  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes
   gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot
 
 [Guids]
diff --git a/Platform/RaspberryPi/RPi3/RPi3.dec b/Platform/RaspberryPi/RPi3/RPi3.dec
index d2a813417648..0554ee20bac5 100644
--- a/Platform/RaspberryPi/RPi3/RPi3.dec
+++ b/Platform/RaspberryPi/RPi3/RPi3.dec
@@ -54,5 +54,5 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
   gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG|0|UINT32|0x00000014
   gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit|0|UINT32|0x00000015
   gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock|0|UINT32|0x00000016
-  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes|0|UINT32|0x00000017
+  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|0|UINT8|0x00000017
   gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|0|UINT32|0x00000018
diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc
index 2b9e619ad55c..b37a02e97da7 100644
--- a/Platform/RaspberryPi/RPi3/RPi3.dsc
+++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
@@ -416,7 +416,7 @@ [PcdsDynamicHii.common.DEFAULT]
   #
   # Display-related.
   #
-  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes|L"DisplayEnableVModes"|gConfigDxeFormSetGuid|0x0|0
+  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|L"DisplayEnableScaledVModes"|gConfigDxeFormSetGuid|0x0|0xff
   gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|L"DisplayEnableSShot"|gConfigDxeFormSetGuid|0x0|1
 
   #
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] [edk2-platforms PATCH 1/1] Platforms/RPi3: DisplayDxe virtual resolution improvements
  2019-09-27  9:20 [edk2-platforms PATCH 1/1] Platforms/RPi3: DisplayDxe virtual resolution improvements Pete Batard
@ 2019-09-27 16:38 ` Philippe Mathieu-Daudé
  2019-09-27 17:49   ` Leif Lindholm
  2019-09-27 17:51   ` Pete Batard
  2019-09-28 23:05 ` Leif Lindholm
  1 sibling, 2 replies; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-27 16:38 UTC (permalink / raw)
  To: devel, pete; +Cc: ard.biesheuvel, leif.lindholm

Hi Pete,

On 9/27/19 11:20 AM, Pete Batard wrote:
> From: Andrei Warkentin <andrey.warkentin@gmail.com>
> 
> The Pi GPU decouples requested resolution from actual physical resolution
> and can perform scaling of virtual resolutions. This enables platform users
> to do something like ask for 1024x768 and get a framebuffer of that size,
> regardless of the actual output (which could be a very blurry SDTV).
> 
> Specifically, this patch allows selecting which specific virtual
> resolutions to enable, thus replacing the old all-or-nothing behaviour
> with either all virtual resolutions supported, or just the native one.
> 
> This patch also adds enables the common 7" Pi (800x480) screen to be used
> at 800x600 resolution, instead of forcing 640x480 as the only usable
> resolution.

I tried to build the RPi3 platform but I get errors because it seems to
use an older edk2 repository. What tag should I use?

> 
> Signed-off-by: Pete Batard <pete@akeo.ie>

Hmm shouldn't this patch have a S-o-b from Andrei Warkentin too?

Thanks,

Phil.

> ---
>  Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c      |  9 +--
>  Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf    |  2 +-
>  Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni | 17 +++--
>  Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr | 71 ++++++++++++++++----
>  Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c    | 53 +++++++++++++--
>  Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf  |  2 +-
>  Platform/RaspberryPi/RPi3/RPi3.dec                           |  2 +-
>  Platform/RaspberryPi/RPi3/RPi3.dsc                           |  2 +-
>  8 files changed, 125 insertions(+), 33 deletions(-)
> 
> diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c
> index fcb4ce6935b6..98e58a560ed4 100644
> --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c
> +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c
> @@ -92,6 +92,7 @@ SetupVariables (
>    )
>  {
>    UINTN Size;
> +  UINT8 Var8;
>    UINT32 Var32;
>    EFI_STATUS Status;
>  
> @@ -180,12 +181,12 @@ SetupVariables (
>      PcdSet32 (PcdDebugShowUEFIExit, PcdGet32 (PcdDebugShowUEFIExit));
>    }
>  
> -  Size = sizeof (UINT32);
> -  Status = gRT->GetVariable (L"DisplayEnableVModes",
> +  Size = sizeof (UINT8);
> +  Status = gRT->GetVariable (L"DisplayEnableScaledVModes",
>                    &gConfigDxeFormSetGuid,
> -                  NULL, &Size, &Var32);
> +                  NULL, &Size, &Var8);
>    if (EFI_ERROR (Status)) {
> -    PcdSet32 (PcdDisplayEnableVModes, PcdGet32 (PcdDisplayEnableVModes));
> +    PcdSet8 (PcdDisplayEnableScaledVModes, PcdGet8 (PcdDisplayEnableScaledVModes));
>    }
>  
>    Size = sizeof (UINT32);
> diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf
> index 2fc4302526a1..24112d517467 100644
> --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf
> +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf
> @@ -64,7 +64,7 @@ [Pcd]
>    gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti
>    gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG
>    gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit
> -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes
> +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes
>    gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot
>  
>  [FeaturePcd]
> diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni
> index 65b45f3e6496..9b4076635f05 100644
> --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni
> +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni
> @@ -71,10 +71,19 @@
>  #string STR_DISPLAY_FORM_TITLE      #language en-US "Display"
>  #string STR_DISPLAY_FORM_SUBTITLE   #language en-US "UEFI video driver settings"
>  
> -#string STR_DISPLAY_VMODES_PROMPT   #language en-US "Resolutions"
> -#string STR_DISPLAY_VMODES_HELP     #language en-US "Support for non-native modes"
> -#string STR_DISPLAY_VMODES_ENABLE   #language en-US "Also support 640x480, 800x600, 1024x768, 720p and 1080p"
> -#string STR_DISPLAY_VMODES_DISABLE  #language en-US "Only native resolution"
> +#string STR_DISPLAY_VMODES_640_PROMPT  #language en-US "Virtual 640x480"
> +#string STR_DISPLAY_VMODES_640_HELP    #language en-US "Enable scaled 640x480 mode"
> +#string STR_DISPLAY_VMODES_800_PROMPT  #language en-US "Virtual 800x600"
> +#string STR_DISPLAY_VMODES_800_HELP    #language en-US "Enable scaled 800x600 mode"
> +#string STR_DISPLAY_VMODES_1024_PROMPT #language en-US "Virtual 1024x768"
> +#string STR_DISPLAY_VMODES_1024_HELP   #language en-US "Enable scaled 1024x768 mode"
> +#string STR_DISPLAY_VMODES_720_PROMPT  #language en-US "Virtual 720p"
> +#string STR_DISPLAY_VMODES_720_HELP    #language en-US "Enable scaled 720p mode"
> +#string STR_DISPLAY_VMODES_1080_PROMPT #language en-US "Virtual 1080p"
> +#string STR_DISPLAY_VMODES_1080_HELP   #language en-US "Enable scaled 1080p mode"
> +
> +#string STR_DISPLAY_VMODES_REAL_PROMPT #language en-US "Native resolution"
> +#string STR_DISPLAY_VMODES_REAL_HELP   #language en-US "Native resolution"
>  
>  #string STR_DISPLAY_SSHOT_PROMPT    #language en-US "Screenshot Support"
>  #string STR_DISPLAY_SSHOT_HELP      #language en-US "Save screen capture as a BMP on the first writable file system found"
> diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr
> index 217a285b5a1f..60bfdbd4d17e 100644
> --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr
> +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr
> @@ -9,14 +9,23 @@
>  #include <Guid/HiiPlatformSetupFormset.h>
>  #include "ConfigDxeFormSetGuid.h"
>  
> +#pragma pack(1)
>  typedef struct {
>    /*
> -   * 0 - One mode for the boot resolution.
> -   * 1 - Adds additional "typical" resolutions like
> -   *     640x480, 800x600, 1024 x 768, 720p and 1080p.
> +   * One bit for each scaled resolution supported,
> +   * these are ordered exactly like mGopModeData
> +   * in DisplayDxe.
> +   *
> +   * 800x600, 640x480, 1024x768, 720p, 1080p, native.
>     */
> -   UINT32 Enable;
> -} DISPLAY_ENABLE_VMODES_VARSTORE_DATA;
> +   UINT8 v640   : 1;
> +   UINT8 v800   : 1;
> +   UINT8 v1024  : 1;
> +   UINT8 v720p  : 1;
> +   UINT8 v1080p : 1;
> +   UINT8 Physical : 1;
> +} DISPLAY_ENABLE_SCALED_VMODES_VARSTORE_DATA;
> +#pragma pack()
>  
>  typedef struct {
>    /*
> @@ -166,9 +175,9 @@ formset
>        name  = DebugShowUEFIExit,
>        guid  = CONFIGDXE_FORM_SET_GUID;
>  
> -    efivarstore DISPLAY_ENABLE_VMODES_VARSTORE_DATA,
> +    efivarstore DISPLAY_ENABLE_SCALED_VMODES_VARSTORE_DATA,
>        attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
> -      name  = DisplayEnableVModes,
> +      name  = DisplayEnableScaledVModes,
>        guid  = CONFIGDXE_FORM_SET_GUID;
>  
>      efivarstore DISPLAY_ENABLE_SSHOT_VARSTORE_DATA,
> @@ -282,13 +291,47 @@ formset
>          title  = STRING_TOKEN(STR_DISPLAY_FORM_TITLE);
>          subtitle text = STRING_TOKEN(STR_DISPLAY_FORM_SUBTITLE);
>  
> -        oneof varid = DisplayEnableVModes.Enable,
> -            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_PROMPT),
> -            help        = STRING_TOKEN(STR_DISPLAY_VMODES_HELP),
> -            flags       = NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED,
> -            option text = STRING_TOKEN(STR_DISPLAY_VMODES_ENABLE), value = 1, flags = DEFAULT;
> -            option text = STRING_TOKEN(STR_DISPLAY_VMODES_DISABLE), value = 0, flags = 0;
> -        endoneof;
> +        checkbox varid = DisplayEnableScaledVModes.v640,
> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_640_PROMPT),
> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_640_HELP),
> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
> +            default     = TRUE,
> +        endcheckbox;
> +
> +        checkbox varid = DisplayEnableScaledVModes.v800,
> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_800_PROMPT),
> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_800_HELP),
> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
> +            default     = TRUE,
> +        endcheckbox;
> +
> +        checkbox varid = DisplayEnableScaledVModes.v1024,
> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_1024_PROMPT),
> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_1024_HELP),
> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
> +            default     = TRUE,
> +        endcheckbox;
> +
> +        checkbox varid = DisplayEnableScaledVModes.v720p,
> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_720_PROMPT),
> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_720_HELP),
> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
> +            default     = TRUE,
> +        endcheckbox;
> +
> +        checkbox varid = DisplayEnableScaledVModes.v1080p,
> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_1080_PROMPT),
> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_1080_HELP),
> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
> +            default     = TRUE,
> +        endcheckbox;
> +
> +        checkbox varid = DisplayEnableScaledVModes.Physical,
> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_REAL_PROMPT),
> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_REAL_HELP),
> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
> +            default     = TRUE,
> +        endcheckbox;
>  
>          oneof varid = DisplayEnableSShot.Enable,
>              prompt      = STRING_TOKEN(STR_DISPLAY_SSHOT_PROMPT),
> diff --git a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c
> index 9475a5ad670c..b880ca827bd6 100644
> --- a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c
> +++ b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c
> @@ -10,6 +10,14 @@
>  #include <Base.h>
>  #include "DisplayDxe.h"
>  
> +#define MODE_800_ENABLED      BIT0
> +#define MODE_640_ENABLED      BIT1
> +#define MODE_1024_ENABLED     BIT2
> +#define MODE_720P_ENABLED     BIT3
> +#define MODE_1080P_ENABLED    BIT4
> +#define MODE_NATIVE_ENABLED   BIT5
> +#define JUST_NATIVE_ENABLED   MODE_NATIVE_ENABLED
> +#define ALL_MODES             (BIT6 - 1)
>  #define POS_TO_FB(posX, posY) ((UINT8*)                                 \
>                                 ((UINTN)This->Mode->FrameBufferBase +    \
>                                  (posY) * This->Mode->Info->PixelsPerScanLine * \
> @@ -104,7 +112,7 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol;
>  STATIC EFI_CPU_ARCH_PROTOCOL *mCpu;
>  
>  STATIC UINTN mLastMode;
> -STATIC GOP_MODE_DATA mGopModeData[] = {
> +STATIC GOP_MODE_DATA mGopModeTemplate[] = {
>    { 800,  600  }, /* Legacy */
>    { 640,  480  }, /* Legacy */
>    { 1024, 768  }, /* Legacy */
> @@ -113,6 +121,9 @@ STATIC GOP_MODE_DATA mGopModeData[] = {
>    { 0,    0    }, /* Physical */
>  };
>  
> +STATIC UINTN mLastMode;
> +STATIC GOP_MODE_DATA mGopModeData[ARRAY_SIZE (mGopModeTemplate)];
> +
>  STATIC DISPLAY_DEVICE_PATH mDisplayProtoDevicePath =
>  {
>    {
> @@ -446,6 +457,7 @@ DriverStart (
>    )
>  {
>    UINTN Index;
> +  UINTN TempIndex;
>    EFI_STATUS Status;
>    VOID *Dummy;
>  
> @@ -473,11 +485,29 @@ DriverStart (
>      goto Done;
>    }
>  
> +  PcdSet8 (PcdDisplayEnableScaledVModes,
> +    PcdGet8 (PcdDisplayEnableScaledVModes) & ALL_MODES);
>  
> -  if (PcdGet32 (PcdDisplayEnableVModes)) {
> -    mLastMode = ARRAY_SIZE (mGopModeData) - 1;
> -  } else {
> -    mLastMode = 0;
> +  if (PcdGet8 (PcdDisplayEnableScaledVModes) == 0) {
> +    PcdSet8 (PcdDisplayEnableScaledVModes, JUST_NATIVE_ENABLED);
> +  }
> +
> +  mLastMode = 0;
> +  for  (TempIndex = 0, Index = 0;
> +        TempIndex < ARRAY_SIZE (mGopModeTemplate); TempIndex++) {
> +    if ((PcdGet8 (PcdDisplayEnableScaledVModes) & (1 << TempIndex)) != 0) {
> +      DEBUG ((DEBUG_ERROR, "Mode %u: %u x %u present\n",
> +        TempIndex, mGopModeTemplate[TempIndex].Width,
> +        mGopModeTemplate[TempIndex].Height));
> +
> +      CopyMem (&mGopModeData[Index], &mGopModeTemplate[TempIndex],
> +        sizeof (GOP_MODE_DATA));
> +      mLastMode = Index;
> +      Index++;
> +    }
> +  }
> +
> +  if (PcdGet8 (PcdDisplayEnableScaledVModes) == JUST_NATIVE_ENABLED) {
>      /*
>       * mBootWidth x mBootHeight may not be sensible,
>       * so clean it up, since we won't be adding
> @@ -486,11 +516,20 @@ DriverStart (
>      if (mBootWidth < 640 || mBootHeight < 480) {
>        mBootWidth = 640;
>        mBootHeight = 480;
> +    } else if (mBootWidth == 800 && mBootHeight == 480) {
> +      /* The Pi 7" screen is close to 800x600, just pretend it is. */
> +      mBootHeight = 600;
>      }
>    }
>  
> -  mGopModeData[mLastMode].Width = mBootWidth;
> -  mGopModeData[mLastMode].Height = mBootHeight;
> +  if ((PcdGet8(PcdDisplayEnableScaledVModes) & MODE_NATIVE_ENABLED) != 0) {
> +     /*
> +      * Adjust actual native res only if native res is enabled
> +      * (so last mode is native res).
> +      */
> +     mGopModeData[mLastMode].Width = mBootWidth;
> +     mGopModeData[mLastMode].Height = mBootHeight;
> +  }
>  
>    for (Index = 0; Index <= mLastMode; Index++) {
>      UINTN FbSize;
> diff --git a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf
> index 11271045bdd9..31da2090b402 100644
> --- a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf
> +++ b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf
> @@ -57,7 +57,7 @@ [Protocols]
>    gRaspberryPiFirmwareProtocolGuid
>  
>  [Pcd]
> -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes
> +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes
>    gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot
>  
>  [Guids]
> diff --git a/Platform/RaspberryPi/RPi3/RPi3.dec b/Platform/RaspberryPi/RPi3/RPi3.dec
> index d2a813417648..0554ee20bac5 100644
> --- a/Platform/RaspberryPi/RPi3/RPi3.dec
> +++ b/Platform/RaspberryPi/RPi3/RPi3.dec
> @@ -54,5 +54,5 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
>    gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG|0|UINT32|0x00000014
>    gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit|0|UINT32|0x00000015
>    gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock|0|UINT32|0x00000016
> -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes|0|UINT32|0x00000017
> +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|0|UINT8|0x00000017
>    gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|0|UINT32|0x00000018
> diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc
> index 2b9e619ad55c..b37a02e97da7 100644
> --- a/Platform/RaspberryPi/RPi3/RPi3.dsc
> +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
> @@ -416,7 +416,7 @@ [PcdsDynamicHii.common.DEFAULT]
>    #
>    # Display-related.
>    #
> -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes|L"DisplayEnableVModes"|gConfigDxeFormSetGuid|0x0|0
> +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|L"DisplayEnableScaledVModes"|gConfigDxeFormSetGuid|0x0|0xff
>    gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|L"DisplayEnableSShot"|gConfigDxeFormSetGuid|0x0|1
>  
>    #
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] [edk2-platforms PATCH 1/1] Platforms/RPi3: DisplayDxe virtual resolution improvements
  2019-09-27 16:38 ` [edk2-devel] " Philippe Mathieu-Daudé
@ 2019-09-27 17:49   ` Leif Lindholm
  2019-09-27 20:23     ` Philippe Mathieu-Daudé
  2019-09-27 17:51   ` Pete Batard
  1 sibling, 1 reply; 12+ messages in thread
From: Leif Lindholm @ 2019-09-27 17:49 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: devel, pete, ard.biesheuvel

On Fri, Sep 27, 2019 at 06:38:07PM +0200, Philippe Mathieu-Daudé wrote:
> Hi Pete,
> 
> On 9/27/19 11:20 AM, Pete Batard wrote:
> > From: Andrei Warkentin <andrey.warkentin@gmail.com>
> > 
> > The Pi GPU decouples requested resolution from actual physical resolution
> > and can perform scaling of virtual resolutions. This enables platform users
> > to do something like ask for 1024x768 and get a framebuffer of that size,
> > regardless of the actual output (which could be a very blurry SDTV).
> > 
> > Specifically, this patch allows selecting which specific virtual
> > resolutions to enable, thus replacing the old all-or-nothing behaviour
> > with either all virtual resolutions supported, or just the native one.
> > 
> > This patch also adds enables the common 7" Pi (800x480) screen to be used
> > at 800x600 resolution, instead of forcing 640x480 as the only usable
> > resolution.
> 
> I tried to build the RPi3 platform but I get errors because it seems to
> use an older edk2 repository. What tag should I use?

edk2-platforms master should always build against edk2 - if it does
not, that's a bug. But I can't see any issues when building rpi3 with
the current master branches.
Any platform that is not willing to commit to this state of things can
live on stable- or devel- branches in the edk-platforms repository.
This process is described in
https://github.com/tianocore/edk2-platforms/blob/about/Readme.md

But please provide some more information than "I get errors". It is a
much better use of maintainer time than sending me off verifying that
something I expected to work still works (for me).

> > Signed-off-by: Pete Batard <pete@akeo.ie>
> 
> Hmm shouldn't this patch have a S-o-b from Andrei Warkentin too?

No. Andrei is the author, he is not the person upstreaming. And the
From: tag retains his authorship.

Adding a S-o-b in that situation equates to putting in the commit
message that "Oh, and Andrei says he's cool with
https://developercertificate.org/".

Regards,

Leif

> Thanks,
> 
> Phil.
> 
> > ---
> >  Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c      |  9 +--
> >  Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf    |  2 +-
> >  Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni | 17 +++--
> >  Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr | 71 ++++++++++++++++----
> >  Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c    | 53 +++++++++++++--
> >  Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf  |  2 +-
> >  Platform/RaspberryPi/RPi3/RPi3.dec                           |  2 +-
> >  Platform/RaspberryPi/RPi3/RPi3.dsc                           |  2 +-
> >  8 files changed, 125 insertions(+), 33 deletions(-)
> > 
> > diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c
> > index fcb4ce6935b6..98e58a560ed4 100644
> > --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c
> > +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c
> > @@ -92,6 +92,7 @@ SetupVariables (
> >    )
> >  {
> >    UINTN Size;
> > +  UINT8 Var8;
> >    UINT32 Var32;
> >    EFI_STATUS Status;
> >  
> > @@ -180,12 +181,12 @@ SetupVariables (
> >      PcdSet32 (PcdDebugShowUEFIExit, PcdGet32 (PcdDebugShowUEFIExit));
> >    }
> >  
> > -  Size = sizeof (UINT32);
> > -  Status = gRT->GetVariable (L"DisplayEnableVModes",
> > +  Size = sizeof (UINT8);
> > +  Status = gRT->GetVariable (L"DisplayEnableScaledVModes",
> >                    &gConfigDxeFormSetGuid,
> > -                  NULL, &Size, &Var32);
> > +                  NULL, &Size, &Var8);
> >    if (EFI_ERROR (Status)) {
> > -    PcdSet32 (PcdDisplayEnableVModes, PcdGet32 (PcdDisplayEnableVModes));
> > +    PcdSet8 (PcdDisplayEnableScaledVModes, PcdGet8 (PcdDisplayEnableScaledVModes));
> >    }
> >  
> >    Size = sizeof (UINT32);
> > diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf
> > index 2fc4302526a1..24112d517467 100644
> > --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf
> > +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf
> > @@ -64,7 +64,7 @@ [Pcd]
> >    gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti
> >    gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG
> >    gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit
> > -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes
> > +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes
> >    gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot
> >  
> >  [FeaturePcd]
> > diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni
> > index 65b45f3e6496..9b4076635f05 100644
> > --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni
> > +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni
> > @@ -71,10 +71,19 @@
> >  #string STR_DISPLAY_FORM_TITLE      #language en-US "Display"
> >  #string STR_DISPLAY_FORM_SUBTITLE   #language en-US "UEFI video driver settings"
> >  
> > -#string STR_DISPLAY_VMODES_PROMPT   #language en-US "Resolutions"
> > -#string STR_DISPLAY_VMODES_HELP     #language en-US "Support for non-native modes"
> > -#string STR_DISPLAY_VMODES_ENABLE   #language en-US "Also support 640x480, 800x600, 1024x768, 720p and 1080p"
> > -#string STR_DISPLAY_VMODES_DISABLE  #language en-US "Only native resolution"
> > +#string STR_DISPLAY_VMODES_640_PROMPT  #language en-US "Virtual 640x480"
> > +#string STR_DISPLAY_VMODES_640_HELP    #language en-US "Enable scaled 640x480 mode"
> > +#string STR_DISPLAY_VMODES_800_PROMPT  #language en-US "Virtual 800x600"
> > +#string STR_DISPLAY_VMODES_800_HELP    #language en-US "Enable scaled 800x600 mode"
> > +#string STR_DISPLAY_VMODES_1024_PROMPT #language en-US "Virtual 1024x768"
> > +#string STR_DISPLAY_VMODES_1024_HELP   #language en-US "Enable scaled 1024x768 mode"
> > +#string STR_DISPLAY_VMODES_720_PROMPT  #language en-US "Virtual 720p"
> > +#string STR_DISPLAY_VMODES_720_HELP    #language en-US "Enable scaled 720p mode"
> > +#string STR_DISPLAY_VMODES_1080_PROMPT #language en-US "Virtual 1080p"
> > +#string STR_DISPLAY_VMODES_1080_HELP   #language en-US "Enable scaled 1080p mode"
> > +
> > +#string STR_DISPLAY_VMODES_REAL_PROMPT #language en-US "Native resolution"
> > +#string STR_DISPLAY_VMODES_REAL_HELP   #language en-US "Native resolution"
> >  
> >  #string STR_DISPLAY_SSHOT_PROMPT    #language en-US "Screenshot Support"
> >  #string STR_DISPLAY_SSHOT_HELP      #language en-US "Save screen capture as a BMP on the first writable file system found"
> > diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr
> > index 217a285b5a1f..60bfdbd4d17e 100644
> > --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr
> > +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr
> > @@ -9,14 +9,23 @@
> >  #include <Guid/HiiPlatformSetupFormset.h>
> >  #include "ConfigDxeFormSetGuid.h"
> >  
> > +#pragma pack(1)
> >  typedef struct {
> >    /*
> > -   * 0 - One mode for the boot resolution.
> > -   * 1 - Adds additional "typical" resolutions like
> > -   *     640x480, 800x600, 1024 x 768, 720p and 1080p.
> > +   * One bit for each scaled resolution supported,
> > +   * these are ordered exactly like mGopModeData
> > +   * in DisplayDxe.
> > +   *
> > +   * 800x600, 640x480, 1024x768, 720p, 1080p, native.
> >     */
> > -   UINT32 Enable;
> > -} DISPLAY_ENABLE_VMODES_VARSTORE_DATA;
> > +   UINT8 v640   : 1;
> > +   UINT8 v800   : 1;
> > +   UINT8 v1024  : 1;
> > +   UINT8 v720p  : 1;
> > +   UINT8 v1080p : 1;
> > +   UINT8 Physical : 1;
> > +} DISPLAY_ENABLE_SCALED_VMODES_VARSTORE_DATA;
> > +#pragma pack()
> >  
> >  typedef struct {
> >    /*
> > @@ -166,9 +175,9 @@ formset
> >        name  = DebugShowUEFIExit,
> >        guid  = CONFIGDXE_FORM_SET_GUID;
> >  
> > -    efivarstore DISPLAY_ENABLE_VMODES_VARSTORE_DATA,
> > +    efivarstore DISPLAY_ENABLE_SCALED_VMODES_VARSTORE_DATA,
> >        attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
> > -      name  = DisplayEnableVModes,
> > +      name  = DisplayEnableScaledVModes,
> >        guid  = CONFIGDXE_FORM_SET_GUID;
> >  
> >      efivarstore DISPLAY_ENABLE_SSHOT_VARSTORE_DATA,
> > @@ -282,13 +291,47 @@ formset
> >          title  = STRING_TOKEN(STR_DISPLAY_FORM_TITLE);
> >          subtitle text = STRING_TOKEN(STR_DISPLAY_FORM_SUBTITLE);
> >  
> > -        oneof varid = DisplayEnableVModes.Enable,
> > -            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_PROMPT),
> > -            help        = STRING_TOKEN(STR_DISPLAY_VMODES_HELP),
> > -            flags       = NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED,
> > -            option text = STRING_TOKEN(STR_DISPLAY_VMODES_ENABLE), value = 1, flags = DEFAULT;
> > -            option text = STRING_TOKEN(STR_DISPLAY_VMODES_DISABLE), value = 0, flags = 0;
> > -        endoneof;
> > +        checkbox varid = DisplayEnableScaledVModes.v640,
> > +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_640_PROMPT),
> > +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_640_HELP),
> > +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
> > +            default     = TRUE,
> > +        endcheckbox;
> > +
> > +        checkbox varid = DisplayEnableScaledVModes.v800,
> > +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_800_PROMPT),
> > +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_800_HELP),
> > +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
> > +            default     = TRUE,
> > +        endcheckbox;
> > +
> > +        checkbox varid = DisplayEnableScaledVModes.v1024,
> > +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_1024_PROMPT),
> > +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_1024_HELP),
> > +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
> > +            default     = TRUE,
> > +        endcheckbox;
> > +
> > +        checkbox varid = DisplayEnableScaledVModes.v720p,
> > +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_720_PROMPT),
> > +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_720_HELP),
> > +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
> > +            default     = TRUE,
> > +        endcheckbox;
> > +
> > +        checkbox varid = DisplayEnableScaledVModes.v1080p,
> > +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_1080_PROMPT),
> > +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_1080_HELP),
> > +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
> > +            default     = TRUE,
> > +        endcheckbox;
> > +
> > +        checkbox varid = DisplayEnableScaledVModes.Physical,
> > +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_REAL_PROMPT),
> > +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_REAL_HELP),
> > +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
> > +            default     = TRUE,
> > +        endcheckbox;
> >  
> >          oneof varid = DisplayEnableSShot.Enable,
> >              prompt      = STRING_TOKEN(STR_DISPLAY_SSHOT_PROMPT),
> > diff --git a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c
> > index 9475a5ad670c..b880ca827bd6 100644
> > --- a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c
> > +++ b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c
> > @@ -10,6 +10,14 @@
> >  #include <Base.h>
> >  #include "DisplayDxe.h"
> >  
> > +#define MODE_800_ENABLED      BIT0
> > +#define MODE_640_ENABLED      BIT1
> > +#define MODE_1024_ENABLED     BIT2
> > +#define MODE_720P_ENABLED     BIT3
> > +#define MODE_1080P_ENABLED    BIT4
> > +#define MODE_NATIVE_ENABLED   BIT5
> > +#define JUST_NATIVE_ENABLED   MODE_NATIVE_ENABLED
> > +#define ALL_MODES             (BIT6 - 1)
> >  #define POS_TO_FB(posX, posY) ((UINT8*)                                 \
> >                                 ((UINTN)This->Mode->FrameBufferBase +    \
> >                                  (posY) * This->Mode->Info->PixelsPerScanLine * \
> > @@ -104,7 +112,7 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol;
> >  STATIC EFI_CPU_ARCH_PROTOCOL *mCpu;
> >  
> >  STATIC UINTN mLastMode;
> > -STATIC GOP_MODE_DATA mGopModeData[] = {
> > +STATIC GOP_MODE_DATA mGopModeTemplate[] = {
> >    { 800,  600  }, /* Legacy */
> >    { 640,  480  }, /* Legacy */
> >    { 1024, 768  }, /* Legacy */
> > @@ -113,6 +121,9 @@ STATIC GOP_MODE_DATA mGopModeData[] = {
> >    { 0,    0    }, /* Physical */
> >  };
> >  
> > +STATIC UINTN mLastMode;
> > +STATIC GOP_MODE_DATA mGopModeData[ARRAY_SIZE (mGopModeTemplate)];
> > +
> >  STATIC DISPLAY_DEVICE_PATH mDisplayProtoDevicePath =
> >  {
> >    {
> > @@ -446,6 +457,7 @@ DriverStart (
> >    )
> >  {
> >    UINTN Index;
> > +  UINTN TempIndex;
> >    EFI_STATUS Status;
> >    VOID *Dummy;
> >  
> > @@ -473,11 +485,29 @@ DriverStart (
> >      goto Done;
> >    }
> >  
> > +  PcdSet8 (PcdDisplayEnableScaledVModes,
> > +    PcdGet8 (PcdDisplayEnableScaledVModes) & ALL_MODES);
> >  
> > -  if (PcdGet32 (PcdDisplayEnableVModes)) {
> > -    mLastMode = ARRAY_SIZE (mGopModeData) - 1;
> > -  } else {
> > -    mLastMode = 0;
> > +  if (PcdGet8 (PcdDisplayEnableScaledVModes) == 0) {
> > +    PcdSet8 (PcdDisplayEnableScaledVModes, JUST_NATIVE_ENABLED);
> > +  }
> > +
> > +  mLastMode = 0;
> > +  for  (TempIndex = 0, Index = 0;
> > +        TempIndex < ARRAY_SIZE (mGopModeTemplate); TempIndex++) {
> > +    if ((PcdGet8 (PcdDisplayEnableScaledVModes) & (1 << TempIndex)) != 0) {
> > +      DEBUG ((DEBUG_ERROR, "Mode %u: %u x %u present\n",
> > +        TempIndex, mGopModeTemplate[TempIndex].Width,
> > +        mGopModeTemplate[TempIndex].Height));
> > +
> > +      CopyMem (&mGopModeData[Index], &mGopModeTemplate[TempIndex],
> > +        sizeof (GOP_MODE_DATA));
> > +      mLastMode = Index;
> > +      Index++;
> > +    }
> > +  }
> > +
> > +  if (PcdGet8 (PcdDisplayEnableScaledVModes) == JUST_NATIVE_ENABLED) {
> >      /*
> >       * mBootWidth x mBootHeight may not be sensible,
> >       * so clean it up, since we won't be adding
> > @@ -486,11 +516,20 @@ DriverStart (
> >      if (mBootWidth < 640 || mBootHeight < 480) {
> >        mBootWidth = 640;
> >        mBootHeight = 480;
> > +    } else if (mBootWidth == 800 && mBootHeight == 480) {
> > +      /* The Pi 7" screen is close to 800x600, just pretend it is. */
> > +      mBootHeight = 600;
> >      }
> >    }
> >  
> > -  mGopModeData[mLastMode].Width = mBootWidth;
> > -  mGopModeData[mLastMode].Height = mBootHeight;
> > +  if ((PcdGet8(PcdDisplayEnableScaledVModes) & MODE_NATIVE_ENABLED) != 0) {
> > +     /*
> > +      * Adjust actual native res only if native res is enabled
> > +      * (so last mode is native res).
> > +      */
> > +     mGopModeData[mLastMode].Width = mBootWidth;
> > +     mGopModeData[mLastMode].Height = mBootHeight;
> > +  }
> >  
> >    for (Index = 0; Index <= mLastMode; Index++) {
> >      UINTN FbSize;
> > diff --git a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf
> > index 11271045bdd9..31da2090b402 100644
> > --- a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf
> > +++ b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf
> > @@ -57,7 +57,7 @@ [Protocols]
> >    gRaspberryPiFirmwareProtocolGuid
> >  
> >  [Pcd]
> > -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes
> > +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes
> >    gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot
> >  
> >  [Guids]
> > diff --git a/Platform/RaspberryPi/RPi3/RPi3.dec b/Platform/RaspberryPi/RPi3/RPi3.dec
> > index d2a813417648..0554ee20bac5 100644
> > --- a/Platform/RaspberryPi/RPi3/RPi3.dec
> > +++ b/Platform/RaspberryPi/RPi3/RPi3.dec
> > @@ -54,5 +54,5 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
> >    gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG|0|UINT32|0x00000014
> >    gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit|0|UINT32|0x00000015
> >    gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock|0|UINT32|0x00000016
> > -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes|0|UINT32|0x00000017
> > +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|0|UINT8|0x00000017
> >    gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|0|UINT32|0x00000018
> > diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc
> > index 2b9e619ad55c..b37a02e97da7 100644
> > --- a/Platform/RaspberryPi/RPi3/RPi3.dsc
> > +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
> > @@ -416,7 +416,7 @@ [PcdsDynamicHii.common.DEFAULT]
> >    #
> >    # Display-related.
> >    #
> > -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes|L"DisplayEnableVModes"|gConfigDxeFormSetGuid|0x0|0
> > +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|L"DisplayEnableScaledVModes"|gConfigDxeFormSetGuid|0x0|0xff
> >    gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|L"DisplayEnableSShot"|gConfigDxeFormSetGuid|0x0|1
> >  
> >    #
> > 
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] [edk2-platforms PATCH 1/1] Platforms/RPi3: DisplayDxe virtual resolution improvements
  2019-09-27 16:38 ` [edk2-devel] " Philippe Mathieu-Daudé
  2019-09-27 17:49   ` Leif Lindholm
@ 2019-09-27 17:51   ` Pete Batard
  1 sibling, 0 replies; 12+ messages in thread
From: Pete Batard @ 2019-09-27 17:51 UTC (permalink / raw)
  To: devel, philmd; +Cc: ard.biesheuvel, leif.lindholm

Hi Philippe,

On 2019.09.27 17:38, Philippe Mathieu-Daudé wrote:
> Hi Pete,
> 
> On 9/27/19 11:20 AM, Pete Batard wrote:
>> From: Andrei Warkentin <andrey.warkentin@gmail.com>
>>
>> The Pi GPU decouples requested resolution from actual physical resolution
>> and can perform scaling of virtual resolutions. This enables platform users
>> to do something like ask for 1024x768 and get a framebuffer of that size,
>> regardless of the actual output (which could be a very blurry SDTV).
>>
>> Specifically, this patch allows selecting which specific virtual
>> resolutions to enable, thus replacing the old all-or-nothing behaviour
>> with either all virtual resolutions supported, or just the native one.
>>
>> This patch also adds enables the common 7" Pi (800x480) screen to be used
>> at 800x600 resolution, instead of forcing 640x480 as the only usable
>> resolution.
> 
> I tried to build the RPi3 platform but I get errors because it seems to
> use an older edk2 repository. What tag should I use?

I just re-built against very latest edk2/edk2-platforms/edk2-non-osi 
(pulled a couple minutes ago) and I'm not seeing any issue. It should 
build against latest.

What error are you getting?

>>
>> Signed-off-by: Pete Batard <pete@akeo.ie>
> 
> Hmm shouldn't this patch have a S-o-b from Andrei Warkentin too?

We discussed this before with Leif (who has since replied), and agreed 
that it makes no sense to use a S-o-b unless it's the actual person 
sending the e-mail.

Regards,

/Pete

> 
> Thanks,
> 
> Phil.
> 
>> ---
>>   Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c      |  9 +--
>>   Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf    |  2 +-
>>   Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni | 17 +++--
>>   Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr | 71 ++++++++++++++++----
>>   Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c    | 53 +++++++++++++--
>>   Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf  |  2 +-
>>   Platform/RaspberryPi/RPi3/RPi3.dec                           |  2 +-
>>   Platform/RaspberryPi/RPi3/RPi3.dsc                           |  2 +-
>>   8 files changed, 125 insertions(+), 33 deletions(-)
>>
>> diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c
>> index fcb4ce6935b6..98e58a560ed4 100644
>> --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c
>> +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c
>> @@ -92,6 +92,7 @@ SetupVariables (
>>     )
>>   {
>>     UINTN Size;
>> +  UINT8 Var8;
>>     UINT32 Var32;
>>     EFI_STATUS Status;
>>   
>> @@ -180,12 +181,12 @@ SetupVariables (
>>       PcdSet32 (PcdDebugShowUEFIExit, PcdGet32 (PcdDebugShowUEFIExit));
>>     }
>>   
>> -  Size = sizeof (UINT32);
>> -  Status = gRT->GetVariable (L"DisplayEnableVModes",
>> +  Size = sizeof (UINT8);
>> +  Status = gRT->GetVariable (L"DisplayEnableScaledVModes",
>>                     &gConfigDxeFormSetGuid,
>> -                  NULL, &Size, &Var32);
>> +                  NULL, &Size, &Var8);
>>     if (EFI_ERROR (Status)) {
>> -    PcdSet32 (PcdDisplayEnableVModes, PcdGet32 (PcdDisplayEnableVModes));
>> +    PcdSet8 (PcdDisplayEnableScaledVModes, PcdGet8 (PcdDisplayEnableScaledVModes));
>>     }
>>   
>>     Size = sizeof (UINT32);
>> diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf
>> index 2fc4302526a1..24112d517467 100644
>> --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf
>> +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf
>> @@ -64,7 +64,7 @@ [Pcd]
>>     gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti
>>     gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG
>>     gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit
>> -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes
>> +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes
>>     gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot
>>   
>>   [FeaturePcd]
>> diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni
>> index 65b45f3e6496..9b4076635f05 100644
>> --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni
>> +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni
>> @@ -71,10 +71,19 @@
>>   #string STR_DISPLAY_FORM_TITLE      #language en-US "Display"
>>   #string STR_DISPLAY_FORM_SUBTITLE   #language en-US "UEFI video driver settings"
>>   
>> -#string STR_DISPLAY_VMODES_PROMPT   #language en-US "Resolutions"
>> -#string STR_DISPLAY_VMODES_HELP     #language en-US "Support for non-native modes"
>> -#string STR_DISPLAY_VMODES_ENABLE   #language en-US "Also support 640x480, 800x600, 1024x768, 720p and 1080p"
>> -#string STR_DISPLAY_VMODES_DISABLE  #language en-US "Only native resolution"
>> +#string STR_DISPLAY_VMODES_640_PROMPT  #language en-US "Virtual 640x480"
>> +#string STR_DISPLAY_VMODES_640_HELP    #language en-US "Enable scaled 640x480 mode"
>> +#string STR_DISPLAY_VMODES_800_PROMPT  #language en-US "Virtual 800x600"
>> +#string STR_DISPLAY_VMODES_800_HELP    #language en-US "Enable scaled 800x600 mode"
>> +#string STR_DISPLAY_VMODES_1024_PROMPT #language en-US "Virtual 1024x768"
>> +#string STR_DISPLAY_VMODES_1024_HELP   #language en-US "Enable scaled 1024x768 mode"
>> +#string STR_DISPLAY_VMODES_720_PROMPT  #language en-US "Virtual 720p"
>> +#string STR_DISPLAY_VMODES_720_HELP    #language en-US "Enable scaled 720p mode"
>> +#string STR_DISPLAY_VMODES_1080_PROMPT #language en-US "Virtual 1080p"
>> +#string STR_DISPLAY_VMODES_1080_HELP   #language en-US "Enable scaled 1080p mode"
>> +
>> +#string STR_DISPLAY_VMODES_REAL_PROMPT #language en-US "Native resolution"
>> +#string STR_DISPLAY_VMODES_REAL_HELP   #language en-US "Native resolution"
>>   
>>   #string STR_DISPLAY_SSHOT_PROMPT    #language en-US "Screenshot Support"
>>   #string STR_DISPLAY_SSHOT_HELP      #language en-US "Save screen capture as a BMP on the first writable file system found"
>> diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr
>> index 217a285b5a1f..60bfdbd4d17e 100644
>> --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr
>> +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr
>> @@ -9,14 +9,23 @@
>>   #include <Guid/HiiPlatformSetupFormset.h>
>>   #include "ConfigDxeFormSetGuid.h"
>>   
>> +#pragma pack(1)
>>   typedef struct {
>>     /*
>> -   * 0 - One mode for the boot resolution.
>> -   * 1 - Adds additional "typical" resolutions like
>> -   *     640x480, 800x600, 1024 x 768, 720p and 1080p.
>> +   * One bit for each scaled resolution supported,
>> +   * these are ordered exactly like mGopModeData
>> +   * in DisplayDxe.
>> +   *
>> +   * 800x600, 640x480, 1024x768, 720p, 1080p, native.
>>      */
>> -   UINT32 Enable;
>> -} DISPLAY_ENABLE_VMODES_VARSTORE_DATA;
>> +   UINT8 v640   : 1;
>> +   UINT8 v800   : 1;
>> +   UINT8 v1024  : 1;
>> +   UINT8 v720p  : 1;
>> +   UINT8 v1080p : 1;
>> +   UINT8 Physical : 1;
>> +} DISPLAY_ENABLE_SCALED_VMODES_VARSTORE_DATA;
>> +#pragma pack()
>>   
>>   typedef struct {
>>     /*
>> @@ -166,9 +175,9 @@ formset
>>         name  = DebugShowUEFIExit,
>>         guid  = CONFIGDXE_FORM_SET_GUID;
>>   
>> -    efivarstore DISPLAY_ENABLE_VMODES_VARSTORE_DATA,
>> +    efivarstore DISPLAY_ENABLE_SCALED_VMODES_VARSTORE_DATA,
>>         attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
>> -      name  = DisplayEnableVModes,
>> +      name  = DisplayEnableScaledVModes,
>>         guid  = CONFIGDXE_FORM_SET_GUID;
>>   
>>       efivarstore DISPLAY_ENABLE_SSHOT_VARSTORE_DATA,
>> @@ -282,13 +291,47 @@ formset
>>           title  = STRING_TOKEN(STR_DISPLAY_FORM_TITLE);
>>           subtitle text = STRING_TOKEN(STR_DISPLAY_FORM_SUBTITLE);
>>   
>> -        oneof varid = DisplayEnableVModes.Enable,
>> -            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_PROMPT),
>> -            help        = STRING_TOKEN(STR_DISPLAY_VMODES_HELP),
>> -            flags       = NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED,
>> -            option text = STRING_TOKEN(STR_DISPLAY_VMODES_ENABLE), value = 1, flags = DEFAULT;
>> -            option text = STRING_TOKEN(STR_DISPLAY_VMODES_DISABLE), value = 0, flags = 0;
>> -        endoneof;
>> +        checkbox varid = DisplayEnableScaledVModes.v640,
>> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_640_PROMPT),
>> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_640_HELP),
>> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
>> +            default     = TRUE,
>> +        endcheckbox;
>> +
>> +        checkbox varid = DisplayEnableScaledVModes.v800,
>> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_800_PROMPT),
>> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_800_HELP),
>> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
>> +            default     = TRUE,
>> +        endcheckbox;
>> +
>> +        checkbox varid = DisplayEnableScaledVModes.v1024,
>> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_1024_PROMPT),
>> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_1024_HELP),
>> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
>> +            default     = TRUE,
>> +        endcheckbox;
>> +
>> +        checkbox varid = DisplayEnableScaledVModes.v720p,
>> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_720_PROMPT),
>> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_720_HELP),
>> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
>> +            default     = TRUE,
>> +        endcheckbox;
>> +
>> +        checkbox varid = DisplayEnableScaledVModes.v1080p,
>> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_1080_PROMPT),
>> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_1080_HELP),
>> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
>> +            default     = TRUE,
>> +        endcheckbox;
>> +
>> +        checkbox varid = DisplayEnableScaledVModes.Physical,
>> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_REAL_PROMPT),
>> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_REAL_HELP),
>> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
>> +            default     = TRUE,
>> +        endcheckbox;
>>   
>>           oneof varid = DisplayEnableSShot.Enable,
>>               prompt      = STRING_TOKEN(STR_DISPLAY_SSHOT_PROMPT),
>> diff --git a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c
>> index 9475a5ad670c..b880ca827bd6 100644
>> --- a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c
>> +++ b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c
>> @@ -10,6 +10,14 @@
>>   #include <Base.h>
>>   #include "DisplayDxe.h"
>>   
>> +#define MODE_800_ENABLED      BIT0
>> +#define MODE_640_ENABLED      BIT1
>> +#define MODE_1024_ENABLED     BIT2
>> +#define MODE_720P_ENABLED     BIT3
>> +#define MODE_1080P_ENABLED    BIT4
>> +#define MODE_NATIVE_ENABLED   BIT5
>> +#define JUST_NATIVE_ENABLED   MODE_NATIVE_ENABLED
>> +#define ALL_MODES             (BIT6 - 1)
>>   #define POS_TO_FB(posX, posY) ((UINT8*)                                 \
>>                                  ((UINTN)This->Mode->FrameBufferBase +    \
>>                                   (posY) * This->Mode->Info->PixelsPerScanLine * \
>> @@ -104,7 +112,7 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol;
>>   STATIC EFI_CPU_ARCH_PROTOCOL *mCpu;
>>   
>>   STATIC UINTN mLastMode;
>> -STATIC GOP_MODE_DATA mGopModeData[] = {
>> +STATIC GOP_MODE_DATA mGopModeTemplate[] = {
>>     { 800,  600  }, /* Legacy */
>>     { 640,  480  }, /* Legacy */
>>     { 1024, 768  }, /* Legacy */
>> @@ -113,6 +121,9 @@ STATIC GOP_MODE_DATA mGopModeData[] = {
>>     { 0,    0    }, /* Physical */
>>   };
>>   
>> +STATIC UINTN mLastMode;
>> +STATIC GOP_MODE_DATA mGopModeData[ARRAY_SIZE (mGopModeTemplate)];
>> +
>>   STATIC DISPLAY_DEVICE_PATH mDisplayProtoDevicePath =
>>   {
>>     {
>> @@ -446,6 +457,7 @@ DriverStart (
>>     )
>>   {
>>     UINTN Index;
>> +  UINTN TempIndex;
>>     EFI_STATUS Status;
>>     VOID *Dummy;
>>   
>> @@ -473,11 +485,29 @@ DriverStart (
>>       goto Done;
>>     }
>>   
>> +  PcdSet8 (PcdDisplayEnableScaledVModes,
>> +    PcdGet8 (PcdDisplayEnableScaledVModes) & ALL_MODES);
>>   
>> -  if (PcdGet32 (PcdDisplayEnableVModes)) {
>> -    mLastMode = ARRAY_SIZE (mGopModeData) - 1;
>> -  } else {
>> -    mLastMode = 0;
>> +  if (PcdGet8 (PcdDisplayEnableScaledVModes) == 0) {
>> +    PcdSet8 (PcdDisplayEnableScaledVModes, JUST_NATIVE_ENABLED);
>> +  }
>> +
>> +  mLastMode = 0;
>> +  for  (TempIndex = 0, Index = 0;
>> +        TempIndex < ARRAY_SIZE (mGopModeTemplate); TempIndex++) {
>> +    if ((PcdGet8 (PcdDisplayEnableScaledVModes) & (1 << TempIndex)) != 0) {
>> +      DEBUG ((DEBUG_ERROR, "Mode %u: %u x %u present\n",
>> +        TempIndex, mGopModeTemplate[TempIndex].Width,
>> +        mGopModeTemplate[TempIndex].Height));
>> +
>> +      CopyMem (&mGopModeData[Index], &mGopModeTemplate[TempIndex],
>> +        sizeof (GOP_MODE_DATA));
>> +      mLastMode = Index;
>> +      Index++;
>> +    }
>> +  }
>> +
>> +  if (PcdGet8 (PcdDisplayEnableScaledVModes) == JUST_NATIVE_ENABLED) {
>>       /*
>>        * mBootWidth x mBootHeight may not be sensible,
>>        * so clean it up, since we won't be adding
>> @@ -486,11 +516,20 @@ DriverStart (
>>       if (mBootWidth < 640 || mBootHeight < 480) {
>>         mBootWidth = 640;
>>         mBootHeight = 480;
>> +    } else if (mBootWidth == 800 && mBootHeight == 480) {
>> +      /* The Pi 7" screen is close to 800x600, just pretend it is. */
>> +      mBootHeight = 600;
>>       }
>>     }
>>   
>> -  mGopModeData[mLastMode].Width = mBootWidth;
>> -  mGopModeData[mLastMode].Height = mBootHeight;
>> +  if ((PcdGet8(PcdDisplayEnableScaledVModes) & MODE_NATIVE_ENABLED) != 0) {
>> +     /*
>> +      * Adjust actual native res only if native res is enabled
>> +      * (so last mode is native res).
>> +      */
>> +     mGopModeData[mLastMode].Width = mBootWidth;
>> +     mGopModeData[mLastMode].Height = mBootHeight;
>> +  }
>>   
>>     for (Index = 0; Index <= mLastMode; Index++) {
>>       UINTN FbSize;
>> diff --git a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf
>> index 11271045bdd9..31da2090b402 100644
>> --- a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf
>> +++ b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf
>> @@ -57,7 +57,7 @@ [Protocols]
>>     gRaspberryPiFirmwareProtocolGuid
>>   
>>   [Pcd]
>> -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes
>> +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes
>>     gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot
>>   
>>   [Guids]
>> diff --git a/Platform/RaspberryPi/RPi3/RPi3.dec b/Platform/RaspberryPi/RPi3/RPi3.dec
>> index d2a813417648..0554ee20bac5 100644
>> --- a/Platform/RaspberryPi/RPi3/RPi3.dec
>> +++ b/Platform/RaspberryPi/RPi3/RPi3.dec
>> @@ -54,5 +54,5 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
>>     gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG|0|UINT32|0x00000014
>>     gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit|0|UINT32|0x00000015
>>     gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock|0|UINT32|0x00000016
>> -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes|0|UINT32|0x00000017
>> +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|0|UINT8|0x00000017
>>     gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|0|UINT32|0x00000018
>> diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc
>> index 2b9e619ad55c..b37a02e97da7 100644
>> --- a/Platform/RaspberryPi/RPi3/RPi3.dsc
>> +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
>> @@ -416,7 +416,7 @@ [PcdsDynamicHii.common.DEFAULT]
>>     #
>>     # Display-related.
>>     #
>> -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes|L"DisplayEnableVModes"|gConfigDxeFormSetGuid|0x0|0
>> +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|L"DisplayEnableScaledVModes"|gConfigDxeFormSetGuid|0x0|0xff
>>     gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|L"DisplayEnableSShot"|gConfigDxeFormSetGuid|0x0|1
>>   
>>     #
>>
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] [edk2-platforms PATCH 1/1] Platforms/RPi3: DisplayDxe virtual resolution improvements
  2019-09-27 17:49   ` Leif Lindholm
@ 2019-09-27 20:23     ` Philippe Mathieu-Daudé
  2019-09-27 20:41       ` Pete Batard
  0 siblings, 1 reply; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-09-27 20:23 UTC (permalink / raw)
  To: devel, leif.lindholm; +Cc: pete, ard.biesheuvel

On 9/27/19 7:49 PM, Leif Lindholm wrote:
> On Fri, Sep 27, 2019 at 06:38:07PM +0200, Philippe Mathieu-Daudé wrote:
>> Hi Pete,
>>
>> On 9/27/19 11:20 AM, Pete Batard wrote:
>>> From: Andrei Warkentin <andrey.warkentin@gmail.com>
>>>
>>> The Pi GPU decouples requested resolution from actual physical resolution
>>> and can perform scaling of virtual resolutions. This enables platform users
>>> to do something like ask for 1024x768 and get a framebuffer of that size,
>>> regardless of the actual output (which could be a very blurry SDTV).
>>>
>>> Specifically, this patch allows selecting which specific virtual
>>> resolutions to enable, thus replacing the old all-or-nothing behaviour
>>> with either all virtual resolutions supported, or just the native one.
>>>
>>> This patch also adds enables the common 7" Pi (800x480) screen to be used
>>> at 800x600 resolution, instead of forcing 640x480 as the only usable
>>> resolution.
>>
>> I tried to build the RPi3 platform but I get errors because it seems to
>> use an older edk2 repository. What tag should I use?
> 
> edk2-platforms master should always build against edk2 - if it does
> not, that's a bug. But I can't see any issues when building rpi3 with
> the current master branches.
> Any platform that is not willing to commit to this state of things can
> live on stable- or devel- branches in the edk-platforms repository.
> This process is described in
> https://github.com/tianocore/edk2-platforms/blob/about/Readme.md
> 
> But please provide some more information than "I get errors". It is a
> much better use of maintainer time than sending me off verifying that
> something I expected to work still works (for me).

Yes, sorry :/

So the first error was:

: error 000E: File/directory not found in workspace
  Platform/RaspberryPi/RPi3/Drivers/LogoDxe/LogoDxe.inf is not found in
packages path:

And as you noted on IRC, I was missing edk2-non-osi, silly me :S

Using it I now get:

/home/phil/source/edk2$ GCC5_AARCH64_PREFIX=aarch64-linux-gnu- build -a
AARCH64 -t GCC5 -b DEBUG -p Platform/RaspberryPi/RPi3/RPi3.dsc -D
ATF_BUILD_DIR=$ATF_BUILD_DIR -n 1
Build environment:
Linux-5.2.11-100.fc29.x86_64-x86_64-with-Ubuntu-16.04-xenial
Build start time: 20:10:25, Sep.27 2019

WORKSPACE        = /home/phil/source/edk2
PACKAGES_PATH    =
/home/phil/source/edk2:/home/phil/source/edk2-platforms:/home/phil/source/edk2-non-osi
EDK_TOOLS_PATH   = /home/phil/source/edk2/BaseTools
CONF_PATH        = /home/phil/source/edk2/Conf


Architecture(s)  = AARCH64
Build target     = DEBUG

Processing meta-data .Toolchain        = GCC5

Active Platform          =
/home/phil/source/edk2-platforms/Platform/RaspberryPi/RPi3/RPi3.dsc
..... done!
Building ...
/home/phil/source/edk2/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ...
/home/phil/source/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ...
/home/phil/source/edk2/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ... /home/phil/source/edk2/MdePkg/Library/UefiLib/UefiLib.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ...
/home/phil/source/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ...
/home/phil/source/edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ...
/home/phil/source/edk2/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ...
/home/phil/source/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ...
/home/phil/source/edk2/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ...
/home/phil/source/edk2/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ...
/home/phil/source/edk2/MdePkg/Library/BasePrintLib/BasePrintLib.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ...
/home/phil/source/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ...
/home/phil/source/edk2/MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ...
/home/phil/source/edk2/MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ...
/home/phil/source/edk2/MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ...
/home/phil/source/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ...
/home/phil/source/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.inf [AARCH64]
make: Nothing to be done for 'tbuild'.
Building ... /home/phil/source/edk2/MdePkg/Library/BaseLib/BaseLib.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ...
/home/phil/source/edk2/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ...
/home/phil/source/edk2/MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
[AARCH64]
make: Nothing to be done for 'tbuild'.
Building ...
/home/phil/source/edk2-platforms/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
[AARCH64]
test -f
/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe/OUTPUT/PlatformSmbiosDxe.map
&& cp -f
/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe/OUTPUT/PlatformSmbiosDxe.map
/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/FV/Ffs/BAD0554E-22E9-4D83-9AFD-CC87727A1A45PlatformSmbiosDxe/BAD0554E-22E9-4D83-9AFD-CC87727A1A45.map
GNUmakefile:476: recipe for target
'/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/FV/Ffs/BAD0554E-22E9-4D83-9AFD-CC87727A1A45PlatformSmbiosDxe/BAD0554E-22E9-4D83-9AFD-CC87727A1A45.map'
failed
make: ***
[/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/FV/Ffs/BAD0554E-22E9-4D83-9AFD-CC87727A1A45PlatformSmbiosDxe/BAD0554E-22E9-4D83-9AFD-CC87727A1A45.map]
Error 1


build.py...
 : error 7000: Failed to execute command
        make tbuild
[/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/edk2-platforms/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe]


build.py...
 : error F002: Failed to build module

/home/phil/source/edk2-platforms/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
[AARCH64, GCC5, DEBUG]

However I do have this file generated:

/home/phil/source/edk2$ find -name PlatformSmbiosDxe.map
./Build/RPi3/DEBUG_GCC5/AARCH64/edk2-platforms/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe/OUTPUT/PlatformSmbiosDxe.map
./Build/RPi3/DEBUG_GCC5/AARCH64/edk2-platforms/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe/DEBUG/PlatformSmbiosDxe.map

Let's try dumb symlink:

edk2@x1w:/home/phil/source/edk2$ ln -s
/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/edk2-platforms/Platform
/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/Platform


Building ...
/home/phil/source/edk2-non-osi/Platform/RaspberryPi/RPi3/Drivers/LogoDxe/LogoDxe.inf
[AARCH64]
test -f
/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/Platform/RaspberryPi/RPi3/Drivers/LogoDxe/LogoDxe/OUTPUT/LogoDxe.map
&& cp -f
/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/Platform/RaspberryPi/RPi3/Drivers/LogoDxe/LogoDxe/OUTPUT/LogoDxe.map
/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/FV/Ffs/F74D20EE-37E7-48FC-97F7-9B1047749C69LogoDxe/F74D20EE-37E7-48FC-97F7-9B1047749C69.map
make: ***
[/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/FV/Ffs/F74D20EE-37E7-48FC-97F7-9B1047749C69LogoDxe/F74D20EE-37E7-48FC-97F7-9B1047749C69.map]
Error 1
GNUmakefile:455: recipe for target
'/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/FV/Ffs/F74D20EE-37E7-48FC-97F7-9B1047749C69LogoDxe/F74D20EE-37E7-48FC-97F7-9B1047749C69.map'
failed

Hmmm it seems something is wrong with my paths...

I rm'ed -rf ./Build and retried but still the same result.

I'll try somewhere else.

>>> Signed-off-by: Pete Batard <pete@akeo.ie>
>>
>> Hmm shouldn't this patch have a S-o-b from Andrei Warkentin too?
> 
> No. Andrei is the author, he is not the person upstreaming. And the
> From: tag retains his authorship.

Oh, this is new to me.

> Adding a S-o-b in that situation equates to putting in the commit
> message that "Oh, and Andrei says he's cool with
> https://developercertificate.org/".

OK :)

Thanks,

Phil.

[...]


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] [edk2-platforms PATCH 1/1] Platforms/RPi3: DisplayDxe virtual resolution improvements
  2019-09-27 20:23     ` Philippe Mathieu-Daudé
@ 2019-09-27 20:41       ` Pete Batard
  2019-10-01 10:20         ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 12+ messages in thread
From: Pete Batard @ 2019-09-27 20:41 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, devel, leif.lindholm; +Cc: ard.biesheuvel

Try this after making sure that you have edk2/, edk2-platforms/ and 
edk-non-osi/ in /home/phil/source:

cd /home/phil/source
export GCC5_AARCH64_PREFIX=aarch64-linux-gnu-
export WORKSPACE=$PWD
export 
PACKAGES_PATH=$WORKSPACE/edk2:$WORKSPACE/edk2-platforms:$WORKSPACE/edk2-non-osi
source edk2/edksetup.sh --reconfig
build -a AARCH64 -t GCC5 -p 
edk2-platforms/Platform/RaspberryPi/RPi3/RPi3.dsc -b DEBUG

Regards,

/Pete


On 2019.09.27 21:23, Philippe Mathieu-Daudé wrote:
> On 9/27/19 7:49 PM, Leif Lindholm wrote:
>> On Fri, Sep 27, 2019 at 06:38:07PM +0200, Philippe Mathieu-Daudé wrote:
>>> Hi Pete,
>>>
>>> On 9/27/19 11:20 AM, Pete Batard wrote:
>>>> From: Andrei Warkentin <andrey.warkentin@gmail.com>
>>>>
>>>> The Pi GPU decouples requested resolution from actual physical resolution
>>>> and can perform scaling of virtual resolutions. This enables platform users
>>>> to do something like ask for 1024x768 and get a framebuffer of that size,
>>>> regardless of the actual output (which could be a very blurry SDTV).
>>>>
>>>> Specifically, this patch allows selecting which specific virtual
>>>> resolutions to enable, thus replacing the old all-or-nothing behaviour
>>>> with either all virtual resolutions supported, or just the native one.
>>>>
>>>> This patch also adds enables the common 7" Pi (800x480) screen to be used
>>>> at 800x600 resolution, instead of forcing 640x480 as the only usable
>>>> resolution.
>>>
>>> I tried to build the RPi3 platform but I get errors because it seems to
>>> use an older edk2 repository. What tag should I use?
>>
>> edk2-platforms master should always build against edk2 - if it does
>> not, that's a bug. But I can't see any issues when building rpi3 with
>> the current master branches.
>> Any platform that is not willing to commit to this state of things can
>> live on stable- or devel- branches in the edk-platforms repository.
>> This process is described in
>> https://github.com/tianocore/edk2-platforms/blob/about/Readme.md
>>
>> But please provide some more information than "I get errors". It is a
>> much better use of maintainer time than sending me off verifying that
>> something I expected to work still works (for me).
> 
> Yes, sorry :/
> 
> So the first error was:
> 
> : error 000E: File/directory not found in workspace
>    Platform/RaspberryPi/RPi3/Drivers/LogoDxe/LogoDxe.inf is not found in
> packages path:
> 
> And as you noted on IRC, I was missing edk2-non-osi, silly me :S
> 
> Using it I now get:
> 
> /home/phil/source/edk2$ GCC5_AARCH64_PREFIX=aarch64-linux-gnu- build -a
> AARCH64 -t GCC5 -b DEBUG -p Platform/RaspberryPi/RPi3/RPi3.dsc -D
> ATF_BUILD_DIR=$ATF_BUILD_DIR -n 1
> Build environment:
> Linux-5.2.11-100.fc29.x86_64-x86_64-with-Ubuntu-16.04-xenial
> Build start time: 20:10:25, Sep.27 2019
> 
> WORKSPACE        = /home/phil/source/edk2
> PACKAGES_PATH    =
> /home/phil/source/edk2:/home/phil/source/edk2-platforms:/home/phil/source/edk2-non-osi
> EDK_TOOLS_PATH   = /home/phil/source/edk2/BaseTools
> CONF_PATH        = /home/phil/source/edk2/Conf
> 
> 
> Architecture(s)  = AARCH64
> Build target     = DEBUG
> 
> Processing meta-data .Toolchain        = GCC5
> 
> Active Platform          =
> /home/phil/source/edk2-platforms/Platform/RaspberryPi/RPi3/RPi3.dsc
> ..... done!
> Building ...
> /home/phil/source/edk2/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ...
> /home/phil/source/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ...
> /home/phil/source/edk2/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ... /home/phil/source/edk2/MdePkg/Library/UefiLib/UefiLib.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ...
> /home/phil/source/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ...
> /home/phil/source/edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ...
> /home/phil/source/edk2/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ...
> /home/phil/source/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ...
> /home/phil/source/edk2/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ...
> /home/phil/source/edk2/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ...
> /home/phil/source/edk2/MdePkg/Library/BasePrintLib/BasePrintLib.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ...
> /home/phil/source/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ...
> /home/phil/source/edk2/MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ...
> /home/phil/source/edk2/MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ...
> /home/phil/source/edk2/MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ...
> /home/phil/source/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ...
> /home/phil/source/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.inf [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ... /home/phil/source/edk2/MdePkg/Library/BaseLib/BaseLib.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ...
> /home/phil/source/edk2/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ...
> /home/phil/source/edk2/MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
> [AARCH64]
> make: Nothing to be done for 'tbuild'.
> Building ...
> /home/phil/source/edk2-platforms/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
> [AARCH64]
> test -f
> /home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe/OUTPUT/PlatformSmbiosDxe.map
> && cp -f
> /home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe/OUTPUT/PlatformSmbiosDxe.map
> /home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/FV/Ffs/BAD0554E-22E9-4D83-9AFD-CC87727A1A45PlatformSmbiosDxe/BAD0554E-22E9-4D83-9AFD-CC87727A1A45.map
> GNUmakefile:476: recipe for target
> '/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/FV/Ffs/BAD0554E-22E9-4D83-9AFD-CC87727A1A45PlatformSmbiosDxe/BAD0554E-22E9-4D83-9AFD-CC87727A1A45.map'
> failed
> make: ***
> [/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/FV/Ffs/BAD0554E-22E9-4D83-9AFD-CC87727A1A45PlatformSmbiosDxe/BAD0554E-22E9-4D83-9AFD-CC87727A1A45.map]
> Error 1
> 
> 
> build.py...
>   : error 7000: Failed to execute command
>          make tbuild
> [/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/edk2-platforms/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe]
> 
> 
> build.py...
>   : error F002: Failed to build module
> 
> /home/phil/source/edk2-platforms/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
> [AARCH64, GCC5, DEBUG]
> 
> However I do have this file generated:
> 
> /home/phil/source/edk2$ find -name PlatformSmbiosDxe.map
> ./Build/RPi3/DEBUG_GCC5/AARCH64/edk2-platforms/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe/OUTPUT/PlatformSmbiosDxe.map
> ./Build/RPi3/DEBUG_GCC5/AARCH64/edk2-platforms/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe/DEBUG/PlatformSmbiosDxe.map
> 
> Let's try dumb symlink:
> 
> edk2@x1w:/home/phil/source/edk2$ ln -s
> /home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/edk2-platforms/Platform
> /home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/Platform
> 
> 
> Building ...
> /home/phil/source/edk2-non-osi/Platform/RaspberryPi/RPi3/Drivers/LogoDxe/LogoDxe.inf
> [AARCH64]
> test -f
> /home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/Platform/RaspberryPi/RPi3/Drivers/LogoDxe/LogoDxe/OUTPUT/LogoDxe.map
> && cp -f
> /home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/Platform/RaspberryPi/RPi3/Drivers/LogoDxe/LogoDxe/OUTPUT/LogoDxe.map
> /home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/FV/Ffs/F74D20EE-37E7-48FC-97F7-9B1047749C69LogoDxe/F74D20EE-37E7-48FC-97F7-9B1047749C69.map
> make: ***
> [/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/FV/Ffs/F74D20EE-37E7-48FC-97F7-9B1047749C69LogoDxe/F74D20EE-37E7-48FC-97F7-9B1047749C69.map]
> Error 1
> GNUmakefile:455: recipe for target
> '/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/FV/Ffs/F74D20EE-37E7-48FC-97F7-9B1047749C69LogoDxe/F74D20EE-37E7-48FC-97F7-9B1047749C69.map'
> failed
> 
> Hmmm it seems something is wrong with my paths...
> 
> I rm'ed -rf ./Build and retried but still the same result.
> 
> I'll try somewhere else.
> 
>>>> Signed-off-by: Pete Batard <pete@akeo.ie>
>>>
>>> Hmm shouldn't this patch have a S-o-b from Andrei Warkentin too?
>>
>> No. Andrei is the author, he is not the person upstreaming. And the
>> From: tag retains his authorship.
> 
> Oh, this is new to me.
> 
>> Adding a S-o-b in that situation equates to putting in the commit
>> message that "Oh, and Andrei says he's cool with
>> https://developercertificate.org/".
> 
> OK :)
> 
> Thanks,
> 
> Phil.
> 
> [...]
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-platforms PATCH 1/1] Platforms/RPi3: DisplayDxe virtual resolution improvements
  2019-09-27  9:20 [edk2-platforms PATCH 1/1] Platforms/RPi3: DisplayDxe virtual resolution improvements Pete Batard
  2019-09-27 16:38 ` [edk2-devel] " Philippe Mathieu-Daudé
@ 2019-09-28 23:05 ` Leif Lindholm
  2019-09-30  9:32   ` Pete Batard
  1 sibling, 1 reply; 12+ messages in thread
From: Leif Lindholm @ 2019-09-28 23:05 UTC (permalink / raw)
  To: Pete Batard; +Cc: devel, ard.biesheuvel

On Fri, Sep 27, 2019 at 10:20:15AM +0100, Pete Batard wrote:
> From: Andrei Warkentin <andrey.warkentin@gmail.com>
> 
> The Pi GPU decouples requested resolution from actual physical resolution
> and can perform scaling of virtual resolutions. This enables platform users
> to do something like ask for 1024x768 and get a framebuffer of that size,
> regardless of the actual output (which could be a very blurry SDTV).
> 
> Specifically, this patch allows selecting which specific virtual
> resolutions to enable, thus replacing the old all-or-nothing behaviour
> with either all virtual resolutions supported, or just the native one.
> 
> This patch also adds enables the common 7" Pi (800x480) screen to be used
> at 800x600 resolution, instead of forcing 640x480 as the only usable
> resolution.

I am basically OK with this patch, but I note that the change in
variable name/content means existing users will end up with stale
variables.

So I wonder if it would be worth explicitly adding a stanza deleting
the old variable if found?

/
    Leif.

> Signed-off-by: Pete Batard <pete@akeo.ie>
> ---
>  Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c      |  9 +--
>  Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf    |  2 +-
>  Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni | 17 +++--
>  Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr | 71 ++++++++++++++++----
>  Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c    | 53 +++++++++++++--
>  Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf  |  2 +-
>  Platform/RaspberryPi/RPi3/RPi3.dec                           |  2 +-
>  Platform/RaspberryPi/RPi3/RPi3.dsc                           |  2 +-
>  8 files changed, 125 insertions(+), 33 deletions(-)
> 
> diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c
> index fcb4ce6935b6..98e58a560ed4 100644
> --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c
> +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c
> @@ -92,6 +92,7 @@ SetupVariables (
>    )
>  {
>    UINTN Size;
> +  UINT8 Var8;
>    UINT32 Var32;
>    EFI_STATUS Status;
>  
> @@ -180,12 +181,12 @@ SetupVariables (
>      PcdSet32 (PcdDebugShowUEFIExit, PcdGet32 (PcdDebugShowUEFIExit));
>    }
>  
> -  Size = sizeof (UINT32);
> -  Status = gRT->GetVariable (L"DisplayEnableVModes",
> +  Size = sizeof (UINT8);
> +  Status = gRT->GetVariable (L"DisplayEnableScaledVModes",
>                    &gConfigDxeFormSetGuid,
> -                  NULL, &Size, &Var32);
> +                  NULL, &Size, &Var8);
>    if (EFI_ERROR (Status)) {
> -    PcdSet32 (PcdDisplayEnableVModes, PcdGet32 (PcdDisplayEnableVModes));
> +    PcdSet8 (PcdDisplayEnableScaledVModes, PcdGet8 (PcdDisplayEnableScaledVModes));
>    }
>  
>    Size = sizeof (UINT32);
> diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf
> index 2fc4302526a1..24112d517467 100644
> --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf
> +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf
> @@ -64,7 +64,7 @@ [Pcd]
>    gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti
>    gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG
>    gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit
> -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes
> +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes
>    gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot
>  
>  [FeaturePcd]
> diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni
> index 65b45f3e6496..9b4076635f05 100644
> --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni
> +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni
> @@ -71,10 +71,19 @@
>  #string STR_DISPLAY_FORM_TITLE      #language en-US "Display"
>  #string STR_DISPLAY_FORM_SUBTITLE   #language en-US "UEFI video driver settings"
>  
> -#string STR_DISPLAY_VMODES_PROMPT   #language en-US "Resolutions"
> -#string STR_DISPLAY_VMODES_HELP     #language en-US "Support for non-native modes"
> -#string STR_DISPLAY_VMODES_ENABLE   #language en-US "Also support 640x480, 800x600, 1024x768, 720p and 1080p"
> -#string STR_DISPLAY_VMODES_DISABLE  #language en-US "Only native resolution"
> +#string STR_DISPLAY_VMODES_640_PROMPT  #language en-US "Virtual 640x480"
> +#string STR_DISPLAY_VMODES_640_HELP    #language en-US "Enable scaled 640x480 mode"
> +#string STR_DISPLAY_VMODES_800_PROMPT  #language en-US "Virtual 800x600"
> +#string STR_DISPLAY_VMODES_800_HELP    #language en-US "Enable scaled 800x600 mode"
> +#string STR_DISPLAY_VMODES_1024_PROMPT #language en-US "Virtual 1024x768"
> +#string STR_DISPLAY_VMODES_1024_HELP   #language en-US "Enable scaled 1024x768 mode"
> +#string STR_DISPLAY_VMODES_720_PROMPT  #language en-US "Virtual 720p"
> +#string STR_DISPLAY_VMODES_720_HELP    #language en-US "Enable scaled 720p mode"
> +#string STR_DISPLAY_VMODES_1080_PROMPT #language en-US "Virtual 1080p"
> +#string STR_DISPLAY_VMODES_1080_HELP   #language en-US "Enable scaled 1080p mode"
> +
> +#string STR_DISPLAY_VMODES_REAL_PROMPT #language en-US "Native resolution"
> +#string STR_DISPLAY_VMODES_REAL_HELP   #language en-US "Native resolution"
>  
>  #string STR_DISPLAY_SSHOT_PROMPT    #language en-US "Screenshot Support"
>  #string STR_DISPLAY_SSHOT_HELP      #language en-US "Save screen capture as a BMP on the first writable file system found"
> diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr
> index 217a285b5a1f..60bfdbd4d17e 100644
> --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr
> +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr
> @@ -9,14 +9,23 @@
>  #include <Guid/HiiPlatformSetupFormset.h>
>  #include "ConfigDxeFormSetGuid.h"
>  
> +#pragma pack(1)
>  typedef struct {
>    /*
> -   * 0 - One mode for the boot resolution.
> -   * 1 - Adds additional "typical" resolutions like
> -   *     640x480, 800x600, 1024 x 768, 720p and 1080p.
> +   * One bit for each scaled resolution supported,
> +   * these are ordered exactly like mGopModeData
> +   * in DisplayDxe.
> +   *
> +   * 800x600, 640x480, 1024x768, 720p, 1080p, native.
>     */
> -   UINT32 Enable;
> -} DISPLAY_ENABLE_VMODES_VARSTORE_DATA;
> +   UINT8 v640   : 1;
> +   UINT8 v800   : 1;
> +   UINT8 v1024  : 1;
> +   UINT8 v720p  : 1;
> +   UINT8 v1080p : 1;
> +   UINT8 Physical : 1;
> +} DISPLAY_ENABLE_SCALED_VMODES_VARSTORE_DATA;
> +#pragma pack()
>  
>  typedef struct {
>    /*
> @@ -166,9 +175,9 @@ formset
>        name  = DebugShowUEFIExit,
>        guid  = CONFIGDXE_FORM_SET_GUID;
>  
> -    efivarstore DISPLAY_ENABLE_VMODES_VARSTORE_DATA,
> +    efivarstore DISPLAY_ENABLE_SCALED_VMODES_VARSTORE_DATA,
>        attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
> -      name  = DisplayEnableVModes,
> +      name  = DisplayEnableScaledVModes,
>        guid  = CONFIGDXE_FORM_SET_GUID;
>  
>      efivarstore DISPLAY_ENABLE_SSHOT_VARSTORE_DATA,
> @@ -282,13 +291,47 @@ formset
>          title  = STRING_TOKEN(STR_DISPLAY_FORM_TITLE);
>          subtitle text = STRING_TOKEN(STR_DISPLAY_FORM_SUBTITLE);
>  
> -        oneof varid = DisplayEnableVModes.Enable,
> -            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_PROMPT),
> -            help        = STRING_TOKEN(STR_DISPLAY_VMODES_HELP),
> -            flags       = NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED,
> -            option text = STRING_TOKEN(STR_DISPLAY_VMODES_ENABLE), value = 1, flags = DEFAULT;
> -            option text = STRING_TOKEN(STR_DISPLAY_VMODES_DISABLE), value = 0, flags = 0;
> -        endoneof;
> +        checkbox varid = DisplayEnableScaledVModes.v640,
> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_640_PROMPT),
> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_640_HELP),
> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
> +            default     = TRUE,
> +        endcheckbox;
> +
> +        checkbox varid = DisplayEnableScaledVModes.v800,
> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_800_PROMPT),
> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_800_HELP),
> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
> +            default     = TRUE,
> +        endcheckbox;
> +
> +        checkbox varid = DisplayEnableScaledVModes.v1024,
> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_1024_PROMPT),
> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_1024_HELP),
> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
> +            default     = TRUE,
> +        endcheckbox;
> +
> +        checkbox varid = DisplayEnableScaledVModes.v720p,
> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_720_PROMPT),
> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_720_HELP),
> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
> +            default     = TRUE,
> +        endcheckbox;
> +
> +        checkbox varid = DisplayEnableScaledVModes.v1080p,
> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_1080_PROMPT),
> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_1080_HELP),
> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
> +            default     = TRUE,
> +        endcheckbox;
> +
> +        checkbox varid = DisplayEnableScaledVModes.Physical,
> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_REAL_PROMPT),
> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_REAL_HELP),
> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
> +            default     = TRUE,
> +        endcheckbox;
>  
>          oneof varid = DisplayEnableSShot.Enable,
>              prompt      = STRING_TOKEN(STR_DISPLAY_SSHOT_PROMPT),
> diff --git a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c
> index 9475a5ad670c..b880ca827bd6 100644
> --- a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c
> +++ b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c
> @@ -10,6 +10,14 @@
>  #include <Base.h>
>  #include "DisplayDxe.h"
>  
> +#define MODE_800_ENABLED      BIT0
> +#define MODE_640_ENABLED      BIT1
> +#define MODE_1024_ENABLED     BIT2
> +#define MODE_720P_ENABLED     BIT3
> +#define MODE_1080P_ENABLED    BIT4
> +#define MODE_NATIVE_ENABLED   BIT5
> +#define JUST_NATIVE_ENABLED   MODE_NATIVE_ENABLED
> +#define ALL_MODES             (BIT6 - 1)
>  #define POS_TO_FB(posX, posY) ((UINT8*)                                 \
>                                 ((UINTN)This->Mode->FrameBufferBase +    \
>                                  (posY) * This->Mode->Info->PixelsPerScanLine * \
> @@ -104,7 +112,7 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol;
>  STATIC EFI_CPU_ARCH_PROTOCOL *mCpu;
>  
>  STATIC UINTN mLastMode;
> -STATIC GOP_MODE_DATA mGopModeData[] = {
> +STATIC GOP_MODE_DATA mGopModeTemplate[] = {
>    { 800,  600  }, /* Legacy */
>    { 640,  480  }, /* Legacy */
>    { 1024, 768  }, /* Legacy */
> @@ -113,6 +121,9 @@ STATIC GOP_MODE_DATA mGopModeData[] = {
>    { 0,    0    }, /* Physical */
>  };
>  
> +STATIC UINTN mLastMode;
> +STATIC GOP_MODE_DATA mGopModeData[ARRAY_SIZE (mGopModeTemplate)];
> +
>  STATIC DISPLAY_DEVICE_PATH mDisplayProtoDevicePath =
>  {
>    {
> @@ -446,6 +457,7 @@ DriverStart (
>    )
>  {
>    UINTN Index;
> +  UINTN TempIndex;
>    EFI_STATUS Status;
>    VOID *Dummy;
>  
> @@ -473,11 +485,29 @@ DriverStart (
>      goto Done;
>    }
>  
> +  PcdSet8 (PcdDisplayEnableScaledVModes,
> +    PcdGet8 (PcdDisplayEnableScaledVModes) & ALL_MODES);
>  
> -  if (PcdGet32 (PcdDisplayEnableVModes)) {
> -    mLastMode = ARRAY_SIZE (mGopModeData) - 1;
> -  } else {
> -    mLastMode = 0;
> +  if (PcdGet8 (PcdDisplayEnableScaledVModes) == 0) {
> +    PcdSet8 (PcdDisplayEnableScaledVModes, JUST_NATIVE_ENABLED);
> +  }
> +
> +  mLastMode = 0;
> +  for  (TempIndex = 0, Index = 0;
> +        TempIndex < ARRAY_SIZE (mGopModeTemplate); TempIndex++) {
> +    if ((PcdGet8 (PcdDisplayEnableScaledVModes) & (1 << TempIndex)) != 0) {
> +      DEBUG ((DEBUG_ERROR, "Mode %u: %u x %u present\n",
> +        TempIndex, mGopModeTemplate[TempIndex].Width,
> +        mGopModeTemplate[TempIndex].Height));
> +
> +      CopyMem (&mGopModeData[Index], &mGopModeTemplate[TempIndex],
> +        sizeof (GOP_MODE_DATA));
> +      mLastMode = Index;
> +      Index++;
> +    }
> +  }
> +
> +  if (PcdGet8 (PcdDisplayEnableScaledVModes) == JUST_NATIVE_ENABLED) {
>      /*
>       * mBootWidth x mBootHeight may not be sensible,
>       * so clean it up, since we won't be adding
> @@ -486,11 +516,20 @@ DriverStart (
>      if (mBootWidth < 640 || mBootHeight < 480) {
>        mBootWidth = 640;
>        mBootHeight = 480;
> +    } else if (mBootWidth == 800 && mBootHeight == 480) {
> +      /* The Pi 7" screen is close to 800x600, just pretend it is. */
> +      mBootHeight = 600;
>      }
>    }
>  
> -  mGopModeData[mLastMode].Width = mBootWidth;
> -  mGopModeData[mLastMode].Height = mBootHeight;
> +  if ((PcdGet8(PcdDisplayEnableScaledVModes) & MODE_NATIVE_ENABLED) != 0) {
> +     /*
> +      * Adjust actual native res only if native res is enabled
> +      * (so last mode is native res).
> +      */
> +     mGopModeData[mLastMode].Width = mBootWidth;
> +     mGopModeData[mLastMode].Height = mBootHeight;
> +  }
>  
>    for (Index = 0; Index <= mLastMode; Index++) {
>      UINTN FbSize;
> diff --git a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf
> index 11271045bdd9..31da2090b402 100644
> --- a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf
> +++ b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf
> @@ -57,7 +57,7 @@ [Protocols]
>    gRaspberryPiFirmwareProtocolGuid
>  
>  [Pcd]
> -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes
> +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes
>    gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot
>  
>  [Guids]
> diff --git a/Platform/RaspberryPi/RPi3/RPi3.dec b/Platform/RaspberryPi/RPi3/RPi3.dec
> index d2a813417648..0554ee20bac5 100644
> --- a/Platform/RaspberryPi/RPi3/RPi3.dec
> +++ b/Platform/RaspberryPi/RPi3/RPi3.dec
> @@ -54,5 +54,5 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
>    gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG|0|UINT32|0x00000014
>    gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit|0|UINT32|0x00000015
>    gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock|0|UINT32|0x00000016
> -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes|0|UINT32|0x00000017
> +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|0|UINT8|0x00000017
>    gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|0|UINT32|0x00000018
> diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc
> index 2b9e619ad55c..b37a02e97da7 100644
> --- a/Platform/RaspberryPi/RPi3/RPi3.dsc
> +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
> @@ -416,7 +416,7 @@ [PcdsDynamicHii.common.DEFAULT]
>    #
>    # Display-related.
>    #
> -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes|L"DisplayEnableVModes"|gConfigDxeFormSetGuid|0x0|0
> +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|L"DisplayEnableScaledVModes"|gConfigDxeFormSetGuid|0x0|0xff
>    gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|L"DisplayEnableSShot"|gConfigDxeFormSetGuid|0x0|1
>  
>    #
> -- 
> 2.21.0.windows.1
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-platforms PATCH 1/1] Platforms/RPi3: DisplayDxe virtual resolution improvements
  2019-09-28 23:05 ` Leif Lindholm
@ 2019-09-30  9:32   ` Pete Batard
  2019-10-01 13:10     ` Leif Lindholm
  0 siblings, 1 reply; 12+ messages in thread
From: Pete Batard @ 2019-09-30  9:32 UTC (permalink / raw)
  To: Leif Lindholm; +Cc: devel, ard.biesheuvel

Hi Leif,

On 2019.09.29 00:05, Leif Lindholm wrote:
> On Fri, Sep 27, 2019 at 10:20:15AM +0100, Pete Batard wrote:
>> From: Andrei Warkentin <andrey.warkentin@gmail.com>
>>
>> The Pi GPU decouples requested resolution from actual physical resolution
>> and can perform scaling of virtual resolutions. This enables platform users
>> to do something like ask for 1024x768 and get a framebuffer of that size,
>> regardless of the actual output (which could be a very blurry SDTV).
>>
>> Specifically, this patch allows selecting which specific virtual
>> resolutions to enable, thus replacing the old all-or-nothing behaviour
>> with either all virtual resolutions supported, or just the native one.
>>
>> This patch also adds enables the common 7" Pi (800x480) screen to be used
>> at 800x600 resolution, instead of forcing 640x480 as the only usable
>> resolution.
> 
> I am basically OK with this patch, but I note that the change in
> variable name/content means existing users will end up with stale
> variables.
> 
> So I wonder if it would be worth explicitly adding a stanza deleting
> the old variable if found?

That would be a valid point *if* the Pi 3 was using actual NVRAM storage 
to write those variables.

However, we have no such thing on the hardware, so we currently store 
those variables on the SD card, within the firmware file itself.

Which means, the minute you "install" a new firmware (by replacing the 
existing RPI_EFI.fd on your SD card with a new one), you're losing all 
your existing variables anyway, including stale ones.

Maybe with the Pi 4 and its 512 KB EEPROM, we'll be able to look into 
preserving the variables. Or we may also look into writing variables to 
a separate virtual NVRAM file on the SD card, instead of just reusing 
the .fd (which we are doing for convenience). But for our current model, 
what you highlight is a non issue, as the only "upgrade" path forces 
users to always start with a virtual NVRAM that has been reset and that 
is therefore free from any stale variable.

Regards,

/Pete

> 
> /
>      Leif.
> 
>> Signed-off-by: Pete Batard <pete@akeo.ie>
>> ---
>>   Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c      |  9 +--
>>   Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf    |  2 +-
>>   Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni | 17 +++--
>>   Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr | 71 ++++++++++++++++----
>>   Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c    | 53 +++++++++++++--
>>   Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf  |  2 +-
>>   Platform/RaspberryPi/RPi3/RPi3.dec                           |  2 +-
>>   Platform/RaspberryPi/RPi3/RPi3.dsc                           |  2 +-
>>   8 files changed, 125 insertions(+), 33 deletions(-)
>>
>> diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c
>> index fcb4ce6935b6..98e58a560ed4 100644
>> --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c
>> +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.c
>> @@ -92,6 +92,7 @@ SetupVariables (
>>     )
>>   {
>>     UINTN Size;
>> +  UINT8 Var8;
>>     UINT32 Var32;
>>     EFI_STATUS Status;
>>   
>> @@ -180,12 +181,12 @@ SetupVariables (
>>       PcdSet32 (PcdDebugShowUEFIExit, PcdGet32 (PcdDebugShowUEFIExit));
>>     }
>>   
>> -  Size = sizeof (UINT32);
>> -  Status = gRT->GetVariable (L"DisplayEnableVModes",
>> +  Size = sizeof (UINT8);
>> +  Status = gRT->GetVariable (L"DisplayEnableScaledVModes",
>>                     &gConfigDxeFormSetGuid,
>> -                  NULL, &Size, &Var32);
>> +                  NULL, &Size, &Var8);
>>     if (EFI_ERROR (Status)) {
>> -    PcdSet32 (PcdDisplayEnableVModes, PcdGet32 (PcdDisplayEnableVModes));
>> +    PcdSet8 (PcdDisplayEnableScaledVModes, PcdGet8 (PcdDisplayEnableScaledVModes));
>>     }
>>   
>>     Size = sizeof (UINT32);
>> diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf
>> index 2fc4302526a1..24112d517467 100644
>> --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf
>> +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxe.inf
>> @@ -64,7 +64,7 @@ [Pcd]
>>     gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti
>>     gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG
>>     gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit
>> -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes
>> +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes
>>     gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot
>>   
>>   [FeaturePcd]
>> diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni
>> index 65b45f3e6496..9b4076635f05 100644
>> --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni
>> +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.uni
>> @@ -71,10 +71,19 @@
>>   #string STR_DISPLAY_FORM_TITLE      #language en-US "Display"
>>   #string STR_DISPLAY_FORM_SUBTITLE   #language en-US "UEFI video driver settings"
>>   
>> -#string STR_DISPLAY_VMODES_PROMPT   #language en-US "Resolutions"
>> -#string STR_DISPLAY_VMODES_HELP     #language en-US "Support for non-native modes"
>> -#string STR_DISPLAY_VMODES_ENABLE   #language en-US "Also support 640x480, 800x600, 1024x768, 720p and 1080p"
>> -#string STR_DISPLAY_VMODES_DISABLE  #language en-US "Only native resolution"
>> +#string STR_DISPLAY_VMODES_640_PROMPT  #language en-US "Virtual 640x480"
>> +#string STR_DISPLAY_VMODES_640_HELP    #language en-US "Enable scaled 640x480 mode"
>> +#string STR_DISPLAY_VMODES_800_PROMPT  #language en-US "Virtual 800x600"
>> +#string STR_DISPLAY_VMODES_800_HELP    #language en-US "Enable scaled 800x600 mode"
>> +#string STR_DISPLAY_VMODES_1024_PROMPT #language en-US "Virtual 1024x768"
>> +#string STR_DISPLAY_VMODES_1024_HELP   #language en-US "Enable scaled 1024x768 mode"
>> +#string STR_DISPLAY_VMODES_720_PROMPT  #language en-US "Virtual 720p"
>> +#string STR_DISPLAY_VMODES_720_HELP    #language en-US "Enable scaled 720p mode"
>> +#string STR_DISPLAY_VMODES_1080_PROMPT #language en-US "Virtual 1080p"
>> +#string STR_DISPLAY_VMODES_1080_HELP   #language en-US "Enable scaled 1080p mode"
>> +
>> +#string STR_DISPLAY_VMODES_REAL_PROMPT #language en-US "Native resolution"
>> +#string STR_DISPLAY_VMODES_REAL_HELP   #language en-US "Native resolution"
>>   
>>   #string STR_DISPLAY_SSHOT_PROMPT    #language en-US "Screenshot Support"
>>   #string STR_DISPLAY_SSHOT_HELP      #language en-US "Save screen capture as a BMP on the first writable file system found"
>> diff --git a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr
>> index 217a285b5a1f..60bfdbd4d17e 100644
>> --- a/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr
>> +++ b/Platform/RaspberryPi/RPi3/Drivers/ConfigDxe/ConfigDxeHii.vfr
>> @@ -9,14 +9,23 @@
>>   #include <Guid/HiiPlatformSetupFormset.h>
>>   #include "ConfigDxeFormSetGuid.h"
>>   
>> +#pragma pack(1)
>>   typedef struct {
>>     /*
>> -   * 0 - One mode for the boot resolution.
>> -   * 1 - Adds additional "typical" resolutions like
>> -   *     640x480, 800x600, 1024 x 768, 720p and 1080p.
>> +   * One bit for each scaled resolution supported,
>> +   * these are ordered exactly like mGopModeData
>> +   * in DisplayDxe.
>> +   *
>> +   * 800x600, 640x480, 1024x768, 720p, 1080p, native.
>>      */
>> -   UINT32 Enable;
>> -} DISPLAY_ENABLE_VMODES_VARSTORE_DATA;
>> +   UINT8 v640   : 1;
>> +   UINT8 v800   : 1;
>> +   UINT8 v1024  : 1;
>> +   UINT8 v720p  : 1;
>> +   UINT8 v1080p : 1;
>> +   UINT8 Physical : 1;
>> +} DISPLAY_ENABLE_SCALED_VMODES_VARSTORE_DATA;
>> +#pragma pack()
>>   
>>   typedef struct {
>>     /*
>> @@ -166,9 +175,9 @@ formset
>>         name  = DebugShowUEFIExit,
>>         guid  = CONFIGDXE_FORM_SET_GUID;
>>   
>> -    efivarstore DISPLAY_ENABLE_VMODES_VARSTORE_DATA,
>> +    efivarstore DISPLAY_ENABLE_SCALED_VMODES_VARSTORE_DATA,
>>         attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
>> -      name  = DisplayEnableVModes,
>> +      name  = DisplayEnableScaledVModes,
>>         guid  = CONFIGDXE_FORM_SET_GUID;
>>   
>>       efivarstore DISPLAY_ENABLE_SSHOT_VARSTORE_DATA,
>> @@ -282,13 +291,47 @@ formset
>>           title  = STRING_TOKEN(STR_DISPLAY_FORM_TITLE);
>>           subtitle text = STRING_TOKEN(STR_DISPLAY_FORM_SUBTITLE);
>>   
>> -        oneof varid = DisplayEnableVModes.Enable,
>> -            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_PROMPT),
>> -            help        = STRING_TOKEN(STR_DISPLAY_VMODES_HELP),
>> -            flags       = NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED,
>> -            option text = STRING_TOKEN(STR_DISPLAY_VMODES_ENABLE), value = 1, flags = DEFAULT;
>> -            option text = STRING_TOKEN(STR_DISPLAY_VMODES_DISABLE), value = 0, flags = 0;
>> -        endoneof;
>> +        checkbox varid = DisplayEnableScaledVModes.v640,
>> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_640_PROMPT),
>> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_640_HELP),
>> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
>> +            default     = TRUE,
>> +        endcheckbox;
>> +
>> +        checkbox varid = DisplayEnableScaledVModes.v800,
>> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_800_PROMPT),
>> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_800_HELP),
>> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
>> +            default     = TRUE,
>> +        endcheckbox;
>> +
>> +        checkbox varid = DisplayEnableScaledVModes.v1024,
>> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_1024_PROMPT),
>> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_1024_HELP),
>> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
>> +            default     = TRUE,
>> +        endcheckbox;
>> +
>> +        checkbox varid = DisplayEnableScaledVModes.v720p,
>> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_720_PROMPT),
>> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_720_HELP),
>> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
>> +            default     = TRUE,
>> +        endcheckbox;
>> +
>> +        checkbox varid = DisplayEnableScaledVModes.v1080p,
>> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_1080_PROMPT),
>> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_1080_HELP),
>> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
>> +            default     = TRUE,
>> +        endcheckbox;
>> +
>> +        checkbox varid = DisplayEnableScaledVModes.Physical,
>> +            prompt      = STRING_TOKEN(STR_DISPLAY_VMODES_REAL_PROMPT),
>> +            help        = STRING_TOKEN(STR_DISPLAY_VMODES_REAL_HELP),
>> +            flags       = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG | RESET_REQUIRED,
>> +            default     = TRUE,
>> +        endcheckbox;
>>   
>>           oneof varid = DisplayEnableSShot.Enable,
>>               prompt      = STRING_TOKEN(STR_DISPLAY_SSHOT_PROMPT),
>> diff --git a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c
>> index 9475a5ad670c..b880ca827bd6 100644
>> --- a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c
>> +++ b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.c
>> @@ -10,6 +10,14 @@
>>   #include <Base.h>
>>   #include "DisplayDxe.h"
>>   
>> +#define MODE_800_ENABLED      BIT0
>> +#define MODE_640_ENABLED      BIT1
>> +#define MODE_1024_ENABLED     BIT2
>> +#define MODE_720P_ENABLED     BIT3
>> +#define MODE_1080P_ENABLED    BIT4
>> +#define MODE_NATIVE_ENABLED   BIT5
>> +#define JUST_NATIVE_ENABLED   MODE_NATIVE_ENABLED
>> +#define ALL_MODES             (BIT6 - 1)
>>   #define POS_TO_FB(posX, posY) ((UINT8*)                                 \
>>                                  ((UINTN)This->Mode->FrameBufferBase +    \
>>                                   (posY) * This->Mode->Info->PixelsPerScanLine * \
>> @@ -104,7 +112,7 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL *mFwProtocol;
>>   STATIC EFI_CPU_ARCH_PROTOCOL *mCpu;
>>   
>>   STATIC UINTN mLastMode;
>> -STATIC GOP_MODE_DATA mGopModeData[] = {
>> +STATIC GOP_MODE_DATA mGopModeTemplate[] = {
>>     { 800,  600  }, /* Legacy */
>>     { 640,  480  }, /* Legacy */
>>     { 1024, 768  }, /* Legacy */
>> @@ -113,6 +121,9 @@ STATIC GOP_MODE_DATA mGopModeData[] = {
>>     { 0,    0    }, /* Physical */
>>   };
>>   
>> +STATIC UINTN mLastMode;
>> +STATIC GOP_MODE_DATA mGopModeData[ARRAY_SIZE (mGopModeTemplate)];
>> +
>>   STATIC DISPLAY_DEVICE_PATH mDisplayProtoDevicePath =
>>   {
>>     {
>> @@ -446,6 +457,7 @@ DriverStart (
>>     )
>>   {
>>     UINTN Index;
>> +  UINTN TempIndex;
>>     EFI_STATUS Status;
>>     VOID *Dummy;
>>   
>> @@ -473,11 +485,29 @@ DriverStart (
>>       goto Done;
>>     }
>>   
>> +  PcdSet8 (PcdDisplayEnableScaledVModes,
>> +    PcdGet8 (PcdDisplayEnableScaledVModes) & ALL_MODES);
>>   
>> -  if (PcdGet32 (PcdDisplayEnableVModes)) {
>> -    mLastMode = ARRAY_SIZE (mGopModeData) - 1;
>> -  } else {
>> -    mLastMode = 0;
>> +  if (PcdGet8 (PcdDisplayEnableScaledVModes) == 0) {
>> +    PcdSet8 (PcdDisplayEnableScaledVModes, JUST_NATIVE_ENABLED);
>> +  }
>> +
>> +  mLastMode = 0;
>> +  for  (TempIndex = 0, Index = 0;
>> +        TempIndex < ARRAY_SIZE (mGopModeTemplate); TempIndex++) {
>> +    if ((PcdGet8 (PcdDisplayEnableScaledVModes) & (1 << TempIndex)) != 0) {
>> +      DEBUG ((DEBUG_ERROR, "Mode %u: %u x %u present\n",
>> +        TempIndex, mGopModeTemplate[TempIndex].Width,
>> +        mGopModeTemplate[TempIndex].Height));
>> +
>> +      CopyMem (&mGopModeData[Index], &mGopModeTemplate[TempIndex],
>> +        sizeof (GOP_MODE_DATA));
>> +      mLastMode = Index;
>> +      Index++;
>> +    }
>> +  }
>> +
>> +  if (PcdGet8 (PcdDisplayEnableScaledVModes) == JUST_NATIVE_ENABLED) {
>>       /*
>>        * mBootWidth x mBootHeight may not be sensible,
>>        * so clean it up, since we won't be adding
>> @@ -486,11 +516,20 @@ DriverStart (
>>       if (mBootWidth < 640 || mBootHeight < 480) {
>>         mBootWidth = 640;
>>         mBootHeight = 480;
>> +    } else if (mBootWidth == 800 && mBootHeight == 480) {
>> +      /* The Pi 7" screen is close to 800x600, just pretend it is. */
>> +      mBootHeight = 600;
>>       }
>>     }
>>   
>> -  mGopModeData[mLastMode].Width = mBootWidth;
>> -  mGopModeData[mLastMode].Height = mBootHeight;
>> +  if ((PcdGet8(PcdDisplayEnableScaledVModes) & MODE_NATIVE_ENABLED) != 0) {
>> +     /*
>> +      * Adjust actual native res only if native res is enabled
>> +      * (so last mode is native res).
>> +      */
>> +     mGopModeData[mLastMode].Width = mBootWidth;
>> +     mGopModeData[mLastMode].Height = mBootHeight;
>> +  }
>>   
>>     for (Index = 0; Index <= mLastMode; Index++) {
>>       UINTN FbSize;
>> diff --git a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf
>> index 11271045bdd9..31da2090b402 100644
>> --- a/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf
>> +++ b/Platform/RaspberryPi/RPi3/Drivers/DisplayDxe/DisplayDxe.inf
>> @@ -57,7 +57,7 @@ [Protocols]
>>     gRaspberryPiFirmwareProtocolGuid
>>   
>>   [Pcd]
>> -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes
>> +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes
>>     gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot
>>   
>>   [Guids]
>> diff --git a/Platform/RaspberryPi/RPi3/RPi3.dec b/Platform/RaspberryPi/RPi3/RPi3.dec
>> index d2a813417648..0554ee20bac5 100644
>> --- a/Platform/RaspberryPi/RPi3/RPi3.dec
>> +++ b/Platform/RaspberryPi/RPi3/RPi3.dec
>> @@ -54,5 +54,5 @@ [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
>>     gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG|0|UINT32|0x00000014
>>     gRaspberryPiTokenSpaceGuid.PcdDebugShowUEFIExit|0|UINT32|0x00000015
>>     gRaspberryPiTokenSpaceGuid.PcdCustomCpuClock|0|UINT32|0x00000016
>> -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes|0|UINT32|0x00000017
>> +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|0|UINT8|0x00000017
>>     gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|0|UINT32|0x00000018
>> diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RPi3/RPi3.dsc
>> index 2b9e619ad55c..b37a02e97da7 100644
>> --- a/Platform/RaspberryPi/RPi3/RPi3.dsc
>> +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
>> @@ -416,7 +416,7 @@ [PcdsDynamicHii.common.DEFAULT]
>>     #
>>     # Display-related.
>>     #
>> -  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableVModes|L"DisplayEnableVModes"|gConfigDxeFormSetGuid|0x0|0
>> +  gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes|L"DisplayEnableScaledVModes"|gConfigDxeFormSetGuid|0x0|0xff
>>     gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot|L"DisplayEnableSShot"|gConfigDxeFormSetGuid|0x0|1
>>   
>>     #
>> -- 
>> 2.21.0.windows.1
>>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] [edk2-platforms PATCH 1/1] Platforms/RPi3: DisplayDxe virtual resolution improvements
  2019-09-27 20:41       ` Pete Batard
@ 2019-10-01 10:20         ` Philippe Mathieu-Daudé
  2019-10-01 13:18           ` Leif Lindholm
  0 siblings, 1 reply; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-01 10:20 UTC (permalink / raw)
  To: devel, pete, leif.lindholm; +Cc: ard.biesheuvel

Hi Pete,

On 9/27/19 10:41 PM, Pete Batard wrote:
> Try this after making sure that you have edk2/, edk2-platforms/ and 
> edk-non-osi/ in /home/phil/source:
> 
> cd /home/phil/source
> export GCC5_AARCH64_PREFIX=aarch64-linux-gnu-
> export WORKSPACE=$PWD
> export 
> PACKAGES_PATH=$WORKSPACE/edk2:$WORKSPACE/edk2-platforms:$WORKSPACE/edk2-non-osi 
> 
> source edk2/edksetup.sh --reconfig
> build -a AARCH64 -t GCC5 -p 
> edk2-platforms/Platform/RaspberryPi/RPi3/RPi3.dsc -b DEBUG

[note for other readers: I'm answering to Pete top-posted comment,
  start of the discussion can be followed below my reply]

I'm confused because this works like charm.

I always used:

WORKSPACE        = /home/phil/source/edk2
PACKAGES_PATH    =
/home/phil/source/edk2:/home/phil/source/edk2-platforms

and built into my edk2/ folder (my $WORKSPACE).

Leif noticed I was missing edk2-non-osi, so I added it (this reply below):

PACKAGES_PATH    =
/home/phil/source/edk2:/home/phil/source/edk2-platforms:/home/phil/source/edk2-non-osi 


I don't understand why modifying $WORKSPACE out of edk2/ this changes 
the behavior into failure, I thought it was would mostly change the 
Build/ folder location, and the packages were only searched into 
$PACKAGES_PATH (which did not change).

Anyhow I'll adapt my setup and not use edk2/ as $WORKSPACE anymore.

Thanks for the pointers,

Phil.

> On 2019.09.27 21:23, Philippe Mathieu-Daudé wrote:
>> On 9/27/19 7:49 PM, Leif Lindholm wrote:
>>> On Fri, Sep 27, 2019 at 06:38:07PM +0200, Philippe Mathieu-Daudé wrote:
>>>> Hi Pete,
>>>>
>>>> On 9/27/19 11:20 AM, Pete Batard wrote:
>>>>> From: Andrei Warkentin <andrey.warkentin@gmail.com>
>>>>>
>>>>> The Pi GPU decouples requested resolution from actual physical 
>>>>> resolution
>>>>> and can perform scaling of virtual resolutions. This enables 
>>>>> platform users
>>>>> to do something like ask for 1024x768 and get a framebuffer of that 
>>>>> size,
>>>>> regardless of the actual output (which could be a very blurry SDTV).
>>>>>
>>>>> Specifically, this patch allows selecting which specific virtual
>>>>> resolutions to enable, thus replacing the old all-or-nothing behaviour
>>>>> with either all virtual resolutions supported, or just the native one.
>>>>>
>>>>> This patch also adds enables the common 7" Pi (800x480) screen to 
>>>>> be used
>>>>> at 800x600 resolution, instead of forcing 640x480 as the only usable
>>>>> resolution.
>>>>
>>>> I tried to build the RPi3 platform but I get errors because it seems to
>>>> use an older edk2 repository. What tag should I use?
>>>
>>> edk2-platforms master should always build against edk2 - if it does
>>> not, that's a bug. But I can't see any issues when building rpi3 with
>>> the current master branches.
>>> Any platform that is not willing to commit to this state of things can
>>> live on stable- or devel- branches in the edk-platforms repository.
>>> This process is described in
>>> https://github.com/tianocore/edk2-platforms/blob/about/Readme.md
>>>
>>> But please provide some more information than "I get errors". It is a
>>> much better use of maintainer time than sending me off verifying that
>>> something I expected to work still works (for me).
>>
>> Yes, sorry :/
>>
>> So the first error was:
>>
>> : error 000E: File/directory not found in workspace
>>    Platform/RaspberryPi/RPi3/Drivers/LogoDxe/LogoDxe.inf is not found in
>> packages path:
>>
>> And as you noted on IRC, I was missing edk2-non-osi, silly me :S
>>
>> Using it I now get:
>>
>> /home/phil/source/edk2$ GCC5_AARCH64_PREFIX=aarch64-linux-gnu- build -a
>> AARCH64 -t GCC5 -b DEBUG -p Platform/RaspberryPi/RPi3/RPi3.dsc -D
>> ATF_BUILD_DIR=$ATF_BUILD_DIR -n 1
>> Build environment:
>> Linux-5.2.11-100.fc29.x86_64-x86_64-with-Ubuntu-16.04-xenial
>> Build start time: 20:10:25, Sep.27 2019
>>
>> WORKSPACE        = /home/phil/source/edk2
>> PACKAGES_PATH    =
>> /home/phil/source/edk2:/home/phil/source/edk2-platforms:/home/phil/source/edk2-non-osi 
>>
>> EDK_TOOLS_PATH   = /home/phil/source/edk2/BaseTools
>> CONF_PATH        = /home/phil/source/edk2/Conf
>>
>>
>> Architecture(s)  = AARCH64
>> Build target     = DEBUG
>>
>> Processing meta-data .Toolchain        = GCC5
>>
>> Active Platform          =
>> /home/phil/source/edk2-platforms/Platform/RaspberryPi/RPi3/RPi3.dsc
>> ..... done!
>> Building ...
>> /home/phil/source/edk2/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf 
>>
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ...
>> /home/phil/source/edk2/MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf 
>>
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ...
>> /home/phil/source/edk2/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf 
>>
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ... /home/phil/source/edk2/MdePkg/Library/UefiLib/UefiLib.inf
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ...
>> /home/phil/source/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf 
>>
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ...
>> /home/phil/source/edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf 
>>
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ...
>> /home/phil/source/edk2/MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf 
>>
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ...
>> /home/phil/source/edk2/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf 
>>
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ...
>> /home/phil/source/edk2/MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf 
>>
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ...
>> /home/phil/source/edk2/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf 
>>
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ...
>> /home/phil/source/edk2/MdePkg/Library/BasePrintLib/BasePrintLib.inf
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ...
>> /home/phil/source/edk2/MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf 
>>
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ...
>> /home/phil/source/edk2/MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf 
>>
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ...
>> /home/phil/source/edk2/MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ...
>> /home/phil/source/edk2/MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ...
>> /home/phil/source/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf 
>>
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ...
>> /home/phil/source/edk2/MdePkg/Library/DxePcdLib/DxePcdLib.inf [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ... /home/phil/source/edk2/MdePkg/Library/BaseLib/BaseLib.inf
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ...
>> /home/phil/source/edk2/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf 
>>
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ...
>> /home/phil/source/edk2/MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf 
>>
>> [AARCH64]
>> make: Nothing to be done for 'tbuild'.
>> Building ...
>> /home/phil/source/edk2-platforms/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf 
>>
>> [AARCH64]
>> test -f
>> /home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe/OUTPUT/PlatformSmbiosDxe.map 
>>
>> && cp -f
>> /home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe/OUTPUT/PlatformSmbiosDxe.map 
>>
>> /home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/FV/Ffs/BAD0554E-22E9-4D83-9AFD-CC87727A1A45PlatformSmbiosDxe/BAD0554E-22E9-4D83-9AFD-CC87727A1A45.map 
>>
>> GNUmakefile:476: recipe for target
>> '/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/FV/Ffs/BAD0554E-22E9-4D83-9AFD-CC87727A1A45PlatformSmbiosDxe/BAD0554E-22E9-4D83-9AFD-CC87727A1A45.map' 
>>
>> failed
>> make: ***
>> [/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/FV/Ffs/BAD0554E-22E9-4D83-9AFD-CC87727A1A45PlatformSmbiosDxe/BAD0554E-22E9-4D83-9AFD-CC87727A1A45.map] 
>>
>> Error 1
>>
>>
>> build.py...
>>   : error 7000: Failed to execute command
>>          make tbuild
>> [/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/edk2-platforms/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe] 
>>
>>
>>
>> build.py...
>>   : error F002: Failed to build module
>>
>> /home/phil/source/edk2-platforms/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf 
>>
>> [AARCH64, GCC5, DEBUG]
>>
>> However I do have this file generated:
>>
>> /home/phil/source/edk2$ find -name PlatformSmbiosDxe.map
>> ./Build/RPi3/DEBUG_GCC5/AARCH64/edk2-platforms/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe/OUTPUT/PlatformSmbiosDxe.map 
>>
>> ./Build/RPi3/DEBUG_GCC5/AARCH64/edk2-platforms/Platform/RaspberryPi/RPi3/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe/DEBUG/PlatformSmbiosDxe.map 
>>
>>
>> Let's try dumb symlink:
>>
>> edk2@x1w:/home/phil/source/edk2$ ln -s
>> /home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/edk2-platforms/Platform 
>>
>> /home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/Platform
>>
>>
>> Building ...
>> /home/phil/source/edk2-non-osi/Platform/RaspberryPi/RPi3/Drivers/LogoDxe/LogoDxe.inf 
>>
>> [AARCH64]
>> test -f
>> /home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/Platform/RaspberryPi/RPi3/Drivers/LogoDxe/LogoDxe/OUTPUT/LogoDxe.map 
>>
>> && cp -f
>> /home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/AARCH64/Platform/RaspberryPi/RPi3/Drivers/LogoDxe/LogoDxe/OUTPUT/LogoDxe.map 
>>
>> /home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/FV/Ffs/F74D20EE-37E7-48FC-97F7-9B1047749C69LogoDxe/F74D20EE-37E7-48FC-97F7-9B1047749C69.map 
>>
>> make: ***
>> [/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/FV/Ffs/F74D20EE-37E7-48FC-97F7-9B1047749C69LogoDxe/F74D20EE-37E7-48FC-97F7-9B1047749C69.map] 
>>
>> Error 1
>> GNUmakefile:455: recipe for target
>> '/home/phil/source/edk2/Build/RPi3/DEBUG_GCC5/FV/Ffs/F74D20EE-37E7-48FC-97F7-9B1047749C69LogoDxe/F74D20EE-37E7-48FC-97F7-9B1047749C69.map' 
>>
>> failed
>>
>> Hmmm it seems something is wrong with my paths...
>>
>> I rm'ed -rf ./Build and retried but still the same result.
>>
>> I'll try somewhere else.
>>
>>>>> Signed-off-by: Pete Batard <pete@akeo.ie>
>>>>
>>>> Hmm shouldn't this patch have a S-o-b from Andrei Warkentin too?
>>>
>>> No. Andrei is the author, he is not the person upstreaming. And the
>>> From: tag retains his authorship.
>>
>> Oh, this is new to me.
>>
>>> Adding a S-o-b in that situation equates to putting in the commit
>>> message that "Oh, and Andrei says he's cool with
>>> https://developercertificate.org/".
>>
>> OK :)
>>
>> Thanks,
>>
>> Phil.
>>
>> [...]


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-platforms PATCH 1/1] Platforms/RPi3: DisplayDxe virtual resolution improvements
  2019-09-30  9:32   ` Pete Batard
@ 2019-10-01 13:10     ` Leif Lindholm
  2019-10-01 13:35       ` [edk2-devel] " Philippe Mathieu-Daudé
  0 siblings, 1 reply; 12+ messages in thread
From: Leif Lindholm @ 2019-10-01 13:10 UTC (permalink / raw)
  To: Pete Batard; +Cc: devel, ard.biesheuvel

On Mon, Sep 30, 2019 at 10:32:03AM +0100, Pete Batard wrote:
> Hi Leif,
> 
> On 2019.09.29 00:05, Leif Lindholm wrote:
> > On Fri, Sep 27, 2019 at 10:20:15AM +0100, Pete Batard wrote:
> > > From: Andrei Warkentin <andrey.warkentin@gmail.com>
> > > 
> > > The Pi GPU decouples requested resolution from actual physical resolution
> > > and can perform scaling of virtual resolutions. This enables platform users
> > > to do something like ask for 1024x768 and get a framebuffer of that size,
> > > regardless of the actual output (which could be a very blurry SDTV).
> > > 
> > > Specifically, this patch allows selecting which specific virtual
> > > resolutions to enable, thus replacing the old all-or-nothing behaviour
> > > with either all virtual resolutions supported, or just the native one.
> > > 
> > > This patch also adds enables the common 7" Pi (800x480) screen to be used
> > > at 800x600 resolution, instead of forcing 640x480 as the only usable
> > > resolution.
> > 
> > I am basically OK with this patch, but I note that the change in
> > variable name/content means existing users will end up with stale
> > variables.
> > 
> > So I wonder if it would be worth explicitly adding a stanza deleting
> > the old variable if found?
> 
> That would be a valid point *if* the Pi 3 was using actual NVRAM storage to
> write those variables.
> 
> However, we have no such thing on the hardware, so we currently store those
> variables on the SD card, within the firmware file itself.
> 
> Which means, the minute you "install" a new firmware (by replacing the
> existing RPI_EFI.fd on your SD card with a new one), you're losing all your
> existing variables anyway, including stale ones.

Ah. That is sort of unique, but I see how it could still be useful.
It was the EFI_VARIABLE_NON_VOLATILE that threw me.

> Maybe with the Pi 4 and its 512 KB EEPROM, we'll be able to look into
> preserving the variables. Or we may also look into writing variables to a
> separate virtual NVRAM file on the SD card, instead of just reusing the .fd
> (which we are doing for convenience). But for our current model, what you
> highlight is a non issue, as the only "upgrade" path forces users to always
> start with a virtual NVRAM that has been reset and that is therefore free
> from any stale variable.

Sure. this works.
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Pushed as 777573818e0c.

Regards,

Leif

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] [edk2-platforms PATCH 1/1] Platforms/RPi3: DisplayDxe virtual resolution improvements
  2019-10-01 10:20         ` Philippe Mathieu-Daudé
@ 2019-10-01 13:18           ` Leif Lindholm
  0 siblings, 0 replies; 12+ messages in thread
From: Leif Lindholm @ 2019-10-01 13:18 UTC (permalink / raw)
  To: devel, philmd; +Cc: pete, ard.biesheuvel

On Tue, Oct 01, 2019 at 12:20:03PM +0200, Philippe Mathieu-Daudé wrote:
> Hi Pete,
> 
> On 9/27/19 10:41 PM, Pete Batard wrote:
> > Try this after making sure that you have edk2/, edk2-platforms/ and
> > edk-non-osi/ in /home/phil/source:
> > 
> > cd /home/phil/source
> > export GCC5_AARCH64_PREFIX=aarch64-linux-gnu-
> > export WORKSPACE=$PWD
> > export PACKAGES_PATH=$WORKSPACE/edk2:$WORKSPACE/edk2-platforms:$WORKSPACE/edk2-non-osi
> > 
> > source edk2/edksetup.sh --reconfig
> > build -a AARCH64 -t GCC5 -p
> > edk2-platforms/Platform/RaspberryPi/RPi3/RPi3.dsc -b DEBUG
> 
> [note for other readers: I'm answering to Pete top-posted comment,
>  start of the discussion can be followed below my reply]
> 
> I'm confused because this works like charm.
> 
> I always used:
> 
> WORKSPACE        = /home/phil/source/edk2
> PACKAGES_PATH    =
> /home/phil/source/edk2:/home/phil/source/edk2-platforms
> 
> and built into my edk2/ folder (my $WORKSPACE).
> 
> Leif noticed I was missing edk2-non-osi, so I added it (this reply below):
> 
> PACKAGES_PATH    =
> /home/phil/source/edk2:/home/phil/source/edk2-platforms:/home/phil/source/edk2-non-osi
> 
> 
> I don't understand why modifying $WORKSPACE out of edk2/ this changes the
> behavior into failure, I thought it was would mostly change the Build/
> folder location, and the packages were only searched into $PACKAGES_PATH
> (which did not change).

Yeah, I recall this from the early days of moving from OpenPlatformPkg
(symlink or submodule) to edk2-platforms (and PACKAGES_PATH).
Something in the "let's avoid getting namespace clashes" logic goes
bonkers[1] when you get any part of path overlap (i.e. Platform/ in
more than one PACKAGES_PATH directory) ... but only when using edk2/
as WORKSPACE.

[1] does what Leif wouldn't have expected

> Anyhow I'll adapt my setup and not use edk2/ as $WORKSPACE anymore.

Yeah, that's what I did.

/
    Leif

> Thanks for the pointers,
> 
> Phil.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [edk2-devel] [edk2-platforms PATCH 1/1] Platforms/RPi3: DisplayDxe virtual resolution improvements
  2019-10-01 13:10     ` Leif Lindholm
@ 2019-10-01 13:35       ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-10-01 13:35 UTC (permalink / raw)
  To: devel, leif.lindholm, Pete Batard; +Cc: ard.biesheuvel

On 10/1/19 3:10 PM, Leif Lindholm wrote:
> On Mon, Sep 30, 2019 at 10:32:03AM +0100, Pete Batard wrote:
>> Hi Leif,
>>
>> On 2019.09.29 00:05, Leif Lindholm wrote:
>>> On Fri, Sep 27, 2019 at 10:20:15AM +0100, Pete Batard wrote:
>>>> From: Andrei Warkentin <andrey.warkentin@gmail.com>
>>>>
>>>> The Pi GPU decouples requested resolution from actual physical resolution
>>>> and can perform scaling of virtual resolutions. This enables platform users
>>>> to do something like ask for 1024x768 and get a framebuffer of that size,
>>>> regardless of the actual output (which could be a very blurry SDTV).
>>>>
>>>> Specifically, this patch allows selecting which specific virtual
>>>> resolutions to enable, thus replacing the old all-or-nothing behaviour
>>>> with either all virtual resolutions supported, or just the native one.
>>>>
>>>> This patch also adds enables the common 7" Pi (800x480) screen to be used
>>>> at 800x600 resolution, instead of forcing 640x480 as the only usable
>>>> resolution.

Slightly too late nit: " ... also ..." suggest the 7" display forced to 
800x600 change could have go in a separate patch.

>>>
>>> I am basically OK with this patch, but I note that the change in
>>> variable name/content means existing users will end up with stale
>>> variables.
>>>
>>> So I wonder if it would be worth explicitly adding a stanza deleting
>>> the old variable if found?
>>
>> That would be a valid point *if* the Pi 3 was using actual NVRAM storage to
>> write those variables.
>>
>> However, we have no such thing on the hardware, so we currently store those
>> variables on the SD card, within the firmware file itself.
>>
>> Which means, the minute you "install" a new firmware (by replacing the
>> existing RPI_EFI.fd on your SD card with a new one), you're losing all your
>> existing variables anyway, including stale ones.
> 
> Ah. That is sort of unique, but I see how it could still be useful.
> It was the EFI_VARIABLE_NON_VOLATILE that threw me.
> 
>> Maybe with the Pi 4 and its 512 KB EEPROM, we'll be able to look into
>> preserving the variables. Or we may also look into writing variables to a
>> separate virtual NVRAM file on the SD card, instead of just reusing the .fd
>> (which we are doing for convenience). But for our current model, what you
>> highlight is a non issue, as the only "upgrade" path forces users to always
>> start with a virtual NVRAM that has been reset and that is therefore free
>> from any stale variable.
> 
> Sure. this works.
> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
> Pushed as 777573818e0c.

Thanks Leif.

Regards,

Phil.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-10-01 13:35 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-27  9:20 [edk2-platforms PATCH 1/1] Platforms/RPi3: DisplayDxe virtual resolution improvements Pete Batard
2019-09-27 16:38 ` [edk2-devel] " Philippe Mathieu-Daudé
2019-09-27 17:49   ` Leif Lindholm
2019-09-27 20:23     ` Philippe Mathieu-Daudé
2019-09-27 20:41       ` Pete Batard
2019-10-01 10:20         ` Philippe Mathieu-Daudé
2019-10-01 13:18           ` Leif Lindholm
2019-09-27 17:51   ` Pete Batard
2019-09-28 23:05 ` Leif Lindholm
2019-09-30  9:32   ` Pete Batard
2019-10-01 13:10     ` Leif Lindholm
2019-10-01 13:35       ` [edk2-devel] " Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox