From 16ae4afbe87e3fd60ef2b459fbeb2bbc8ed388297706f8fd4d79f92e23fab256 Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Thu, 24 Jan 2019 10:05:22 +0000 Subject: [PATCH] Accepting request 668263 from home:michael-chang:branches:Base:System - Improved hiDPI device support (FATE#326680) * grub2-video-limit-the-resolution-for-fixed-bimap-font.patch OBS-URL: https://build.opensuse.org/request/show/668263 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=322 --- ...-the-resolution-for-fixed-bimap-font.patch | 59 +++++++++++++++++++ grub2.changes | 6 ++ grub2.spec | 9 ++- 3 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 grub2-video-limit-the-resolution-for-fixed-bimap-font.patch diff --git a/grub2-video-limit-the-resolution-for-fixed-bimap-font.patch b/grub2-video-limit-the-resolution-for-fixed-bimap-font.patch new file mode 100644 index 0000000..363b08a --- /dev/null +++ b/grub2-video-limit-the-resolution-for-fixed-bimap-font.patch @@ -0,0 +1,59 @@ +From 5f7f27d1198ef425f4943cc10132509415bbaf55 Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Thu, 24 Jan 2019 16:41:04 +0800 +Subject: [PATCH] video: limit the resolution for fixed bimap font + +As grub uses fixed bitmap font and also its size is a fixed property, it is not +possible to accommodate to all resolutions, therefore we raise some limit to +the preferred resolution as most themes are designed on popular device and the +resolution in its prime, which is supposedly Full HD. + +This change also makes grub font readable on hiDPI device without going through +the steps in. + +https://wiki.archlinux.org/index.php/HiDPI#GRUB +--- + grub-core/video/efi_gop.c | 7 +++++++ + grub-core/video/i386/pc/vbe.c | 8 +++++++- + 2 files changed, 14 insertions(+), 1 deletion(-) + +diff --git a/grub-core/video/efi_gop.c b/grub-core/video/efi_gop.c +index 1e7b396..1db39e7 100644 +--- a/grub-core/video/efi_gop.c ++++ b/grub-core/video/efi_gop.c +@@ -377,6 +377,13 @@ grub_video_gop_setup (unsigned int width, unsigned int height, + preferred_height = 600; + grub_errno = GRUB_ERR_NONE; + } ++ else ++ { ++ /* Limit the range of preferred resolution not exceeding FHD ++ to keep the fixed bitmap font readable */ ++ preferred_width = (preferred_width < 1920) ? preferred_width : 1920; ++ preferred_height = (preferred_height < 1080) ? preferred_height : 1080; ++ } + } + + again: +diff --git a/grub-core/video/i386/pc/vbe.c b/grub-core/video/i386/pc/vbe.c +index b0d3190..68700ec 100644 +--- a/grub-core/video/i386/pc/vbe.c ++++ b/grub-core/video/i386/pc/vbe.c +@@ -994,7 +994,13 @@ grub_video_vbe_setup (unsigned int width, unsigned int height, + { + grub_vbe_get_preferred_mode (&width, &height); + if (grub_errno == GRUB_ERR_NONE) +- preferred_mode = 1; ++ { ++ preferred_mode = 1; ++ /* Limit the range of preferred resolution not exceeding FHD ++ to keep the fixed bitmap font readable */ ++ width = (width < 1920) ? width : 1920; ++ height = (height < 1080) ? height : 1080; ++ } + else + { + /* Fall back to 640x480. This is conservative, but the largest +-- +2.12.3 + diff --git a/grub2.changes b/grub2.changes index a3a2901..3ffa65e 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Jan 24 09:26:09 UTC 2019 - mchang@suse.com + +- Improved hiDPI device support (FATE#326680) + * grub2-video-limit-the-resolution-for-fixed-bimap-font.patch + ------------------------------------------------------------------- Wed Jan 23 10:44:09 UTC 2019 - rw@suse.com diff --git a/grub2.spec b/grub2.spec index 2dc8322..d31a276 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,9 +14,9 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # - - # needssslcertforbuild + + %define _binaries_in_noarch_package_terminate_build 0 Name: grub2 @@ -313,6 +313,8 @@ Patch455: 0006-Add-support-for-EFI-handover-on-ARM64.patch # Use pkg-config to find Freetype2 Patch500: grub2-freetype-pkgconfig.patch Patch501: grub2-btrfs-help-on-snapper-rollback.patch +# Improved hiDPI device support (FATE#326680) +Patch510: grub2-video-limit-the-resolution-for-fixed-bimap-font.patch Requires: gettext-runtime %if 0%{?suse_version} >= 1140 @@ -407,9 +409,9 @@ provides support for %{platform} systems. %package %{grubefiarch} Summary: Bootloader with support for Linux, Multiboot and more -Group: System/Boot # Require efibootmgr # Without it grub-install is broken so break the package as well if unavailable +Group: System/Boot BuildArch: noarch Requires: efibootmgr Requires(post): efibootmgr @@ -611,6 +613,7 @@ swap partition while in resuming %patch455 -p1 %patch500 -p1 %patch501 -p1 +%patch510 -p1 %build # collect evidence to debug spurious build failure on SLE15