:: commit 5434ccb598ed8d1fcebbdfae93477639611caa2f

mintsuki <mintsuki@protonmail.com> — 2021-04-10 23:29

parents: 4bbc98b62e

gop: Implement missing logic to avoid setting modes when unnecessary

diff --git a/stage23/drivers/gop.c b/stage23/drivers/gop.c
index 42f6f129..7a5c039e 100644
--- a/stage23/drivers/gop.c
+++ b/stage23/drivers/gop.c
@@ -101,14 +101,14 @@ static bool try_mode(struct fb_info *ret, size_t mode, int width, int height, in
 
     if ((int)mode == current_video_mode) {
         print("gop: Mode was already set, perfect!\n");
-    }
-
-    status = uefi_call_wrapper(gop->SetMode, 2, gop, mode);
+    } else {
+        status = uefi_call_wrapper(gop->SetMode, 2, gop, mode);
 
-    if (status) {
-        current_video_mode = -2;
-        print("gop: Failed to set video mode %x, moving on...\n", mode);
-        return false;
+        if (status) {
+            current_video_mode = -2;
+            print("gop: Failed to set video mode %x, moving on...\n", mode);
+            return false;
+        }
     }
 
     current_video_mode = mode;
tab: 248 wrap: offon