:: commit b11b21dfb0bf5188b43cca83a296cd22ca8d7243

mintsuki <mintsuki@protonmail.com> — 2022-05-22 04:38

parents: 0d1871dc72

fb: Expand width and height to 64-bit

diff --git a/common/drivers/gop.c b/common/drivers/gop.c
index ddab844d..0c972682 100644
--- a/common/drivers/gop.c
+++ b/common/drivers/gop.c
@@ -34,7 +34,7 @@ static void linear_mask_to_mask_shift(
 
 // Most of this code taken from https://wiki.osdev.org/GOP
 
-static bool try_mode(struct fb_info *ret, size_t mode, int width, int height, int bpp) {
+static bool try_mode(struct fb_info *ret, size_t mode, uint64_t width, uint64_t height, int bpp) {
     EFI_STATUS status;
 
     EFI_GUID gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
@@ -90,8 +90,8 @@ static bool try_mode(struct fb_info *ret, size_t mode, int width, int height, in
     }
 
     if (width != 0 && height != 0 && bpp != 0) {
-        if ((int)mode_info->HorizontalResolution != width
-         || (int)mode_info->VerticalResolution != height
+        if ((uint64_t)mode_info->HorizontalResolution != width
+         || (uint64_t)mode_info->VerticalResolution != height
          || (int)ret->framebuffer_bpp != bpp)
             return false;
     }
@@ -128,7 +128,7 @@ static bool try_mode(struct fb_info *ret, size_t mode, int width, int height, in
 static no_unwind size_t preset_mode = INVALID_PRESET_MODE;
 
 bool init_gop(struct fb_info *ret,
-              uint16_t target_width, uint16_t target_height, uint16_t target_bpp) {
+              uint64_t target_width, uint64_t target_height, uint16_t target_bpp) {
     ret->default_res = false;
 
     EFI_STATUS status;
diff --git a/common/drivers/gop.h b/common/drivers/gop.h
index 087e9f9c..4d31917e 100644
--- a/common/drivers/gop.h
+++ b/common/drivers/gop.h
@@ -9,7 +9,7 @@
 #include <lib/fb.h>
 
 bool init_gop(struct fb_info *ret,
-              uint16_t target_width, uint16_t target_height, uint16_t target_bpp);
+              uint64_t target_width, uint64_t target_height, uint16_t target_bpp);
 
 #endif
 
diff --git a/common/lib/fb.c b/common/lib/fb.c
index 7d617204..ae0e9d70 100644
--- a/common/lib/fb.c
+++ b/common/lib/fb.c
@@ -7,7 +7,7 @@
 #include <mm/pmm.h>
 
 bool fb_init(struct fb_info *ret,
-             uint16_t target_width, uint16_t target_height, uint16_t target_bpp) {
+             uint64_t target_width, uint64_t target_height, uint16_t target_bpp) {
     bool r;
 
 #if bios == 1
diff --git a/common/lib/fb.h b/common/lib/fb.h
index d19b1567..f2428b76 100644
--- a/common/lib/fb.h
+++ b/common/lib/fb.h
@@ -4,8 +4,8 @@
 #include <stdint.h>
 
 struct resolution {
-    uint16_t width;
-    uint16_t height;
+    uint64_t width;
+    uint64_t height;
     uint16_t bpp;
 };
 
@@ -13,9 +13,9 @@ struct fb_info {
     bool default_res;
     uint8_t  memory_model;
     uint64_t framebuffer_addr;
-    uint16_t framebuffer_pitch;
-    uint16_t framebuffer_width;
-    uint16_t framebuffer_height;
+    uint64_t framebuffer_pitch;
+    uint64_t framebuffer_width;
+    uint64_t framebuffer_height;
     uint16_t framebuffer_bpp;
     uint8_t  red_mask_size;
     uint8_t  red_mask_shift;
@@ -26,7 +26,7 @@ struct fb_info {
 };
 
 bool fb_init(struct fb_info *ret,
-             uint16_t target_width, uint16_t target_height, uint16_t target_bpp);
+             uint64_t target_width, uint64_t target_height, uint16_t target_bpp);
 
 void fb_clear(struct fb_info *fb);
 
tab: 248 wrap: offon