[SeaBIOS] [PATCH] Add additional resolutions for 16:9 displays: 1600x900 and 2560x1440

Uwe Kleine-König posted 1 patch 4 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/seabios tags/patchew/20190705170809.28156-1-ukleinek@debian.org
There is a newer version of this series
vgasrc/cbvga.c     | 8 ++++++++
vgasrc/svgamodes.c | 8 ++++++++
2 files changed, 16 insertions(+)
[SeaBIOS] [PATCH] Add additional resolutions for 16:9 displays: 1600x900 and 2560x1440
Posted by Uwe Kleine-König 4 years, 10 months ago
From: Uwe Kleine-König <uwe@kleine-koenig.org>

This allows to have qemu run at the native screen resolution of my
(physical) monitor.

This is inspired by a patch created by Andreas Dangel that I found on
https://adangel.org/2015/09/11/qemu-kvm-custom-resolutions/ .
---
Andreas's patch applied to 1.12.0, I rebased it to current master.

 vgasrc/cbvga.c     | 8 ++++++++
 vgasrc/svgamodes.c | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c
index 438d8fda6c6e..ac0b62c7bd25 100644
--- a/vgasrc/cbvga.c
+++ b/vgasrc/cbvga.c
@@ -81,6 +81,14 @@ static struct cbvga_mode_s
     { 0x190, { MM_DIRECT, 1920, 1080, 16, 8, 16, SEG_GRAPH } },
     { 0x191, { MM_DIRECT, 1920, 1080, 24, 8, 16, SEG_GRAPH } },
     { 0x192, { MM_DIRECT, 1920, 1080, 32, 8, 16, SEG_GRAPH } },
+
+    /* custom resolutions for 16:9 displays */
+    { 0x193, { MM_DIRECT, 1600,  900, 16, 8, 16, SEG_GRAPH } },
+    { 0x194, { MM_DIRECT, 1600,  900, 24, 8, 16, SEG_GRAPH } },
+    { 0x195, { MM_DIRECT, 1600,  900, 32, 8, 16, SEG_GRAPH } },
+    { 0x196, { MM_DIRECT, 2560, 1440, 16, 8, 16, SEG_GRAPH } },
+    { 0x197, { MM_DIRECT, 2560, 1440, 24, 8, 16, SEG_GRAPH } },
+    { 0x198, { MM_DIRECT, 2560, 1440, 32, 8, 16, SEG_GRAPH } },
 };
 
 struct vgamode_s *cbvga_find_mode(int mode)
diff --git a/vgasrc/svgamodes.c b/vgasrc/svgamodes.c
index 013504c3e691..f89ebef950a8 100644
--- a/vgasrc/svgamodes.c
+++ b/vgasrc/svgamodes.c
@@ -76,5 +76,13 @@ struct generic_svga_mode svga_modes[] VAR16 = {
     { 0x190, { MM_DIRECT, 1920, 1080, 16, 8, 16, SEG_GRAPH } },
     { 0x191, { MM_DIRECT, 1920, 1080, 24, 8, 16, SEG_GRAPH } },
     { 0x192, { MM_DIRECT, 1920, 1080, 32, 8, 16, SEG_GRAPH } },
+
+    /* custom resolutions for 16:9 displays */
+    { 0x193, { MM_DIRECT, 1600,  900, 16, 8, 16, SEG_GRAPH } },
+    { 0x194, { MM_DIRECT, 1600,  900, 24, 8, 16, SEG_GRAPH } },
+    { 0x195, { MM_DIRECT, 1600,  900, 32, 8, 16, SEG_GRAPH } },
+    { 0x196, { MM_DIRECT, 2560, 1440, 16, 8, 16, SEG_GRAPH } },
+    { 0x197, { MM_DIRECT, 2560, 1440, 24, 8, 16, SEG_GRAPH } },
+    { 0x198, { MM_DIRECT, 2560, 1440, 32, 8, 16, SEG_GRAPH } },
 };
 unsigned int svga_mcount VAR16 = ARRAY_SIZE(svga_modes);
-- 
2.20.1
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] Add additional resolutions for 16:9 displays: 1600x900 and 2560x1440
Posted by Uwe Kleine-König 4 years, 9 months ago
Hello,

On 7/5/19 7:08 PM, Uwe Kleine-König wrote:
> From: Uwe Kleine-König <uwe@kleine-koenig.org>

hmm, git send-email failed to set the encoding for this mail, so my name
looks funny for some people here I assume. (Corrected for this mail.)

> This allows to have qemu run at the native screen resolution of my
> (physical) monitor.
> 
> This is inspired by a patch created by Andreas Dangel that I found on
> https://adangel.org/2015/09/11/qemu-kvm-custom-resolutions/ .

IMHO my change is beneficial, I wonder why I don't a response. Is
something wrong with it?

Best regards
Uwe

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] Add additional resolutions for 16:9 displays: 1600x900 and 2560x1440
Posted by Kevin O'Connor 4 years, 9 months ago
On Thu, Jul 25, 2019 at 07:57:33AM +0200, Uwe Kleine-König wrote:
> Hello,
> 
> On 7/5/19 7:08 PM, Uwe Kleine-König wrote:
> > From: Uwe Kleine-König <uwe@kleine-koenig.org>
> 
> hmm, git send-email failed to set the encoding for this mail, so my name
> looks funny for some people here I assume. (Corrected for this mail.)
> 
> > This allows to have qemu run at the native screen resolution of my
> > (physical) monitor.
> > 
> > This is inspired by a patch created by Andreas Dangel that I found on
> > https://adangel.org/2015/09/11/qemu-kvm-custom-resolutions/ .
> 
> IMHO my change is beneficial, I wonder why I don't a response. Is
> something wrong with it?

That patch changes svgamodes.c - which is the "bochs" modes used by
QEMU.  So, I was hoping Gerd would review.  I think he may be on
vacation right now.

Thanks.
-Kevin
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] Add additional resolutions for 16:9 displays: 1600x900 and 2560x1440
Posted by Gerd Hoffmann 4 years, 9 months ago
[ just back from summer vacation, wading through my backlog ... ]

On Sun, Jul 28, 2019 at 11:12:29AM -0400, Kevin O'Connor wrote:
> On Thu, Jul 25, 2019 at 07:57:33AM +0200, Uwe Kleine-König wrote:
> > Hello,
> > 
> > On 7/5/19 7:08 PM, Uwe Kleine-König wrote:
> > > From: Uwe Kleine-König <uwe@kleine-koenig.org>
> > 
> > hmm, git send-email failed to set the encoding for this mail, so my name
> > looks funny for some people here I assume. (Corrected for this mail.)
> > 
> > > This allows to have qemu run at the native screen resolution of my
> > > (physical) monitor.
> > > 
> > > This is inspired by a patch created by Andreas Dangel that I found on
> > > https://adangel.org/2015/09/11/qemu-kvm-custom-resolutions/ .
> > 
> > IMHO my change is beneficial, I wonder why I don't a response. Is
> > something wrong with it?
> 
> That patch changes svgamodes.c - which is the "bochs" modes used by
> QEMU.  So, I was hoping Gerd would review.  I think he may be on
> vacation right now.

Note the patch changes cbvga.c too.
Patch looks good to me.

Changing cbvga.c to use the svgamodes.c list too (which is already
shared by bochs and ati vga code) might be a good idea, so we have
to maintain a single list only.

cheers,
  Gerd
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] [PATCH 1/2] cbvga: reuse svga modes definitions from svgamodes.c
Posted by Uwe Kleine-König 4 years, 9 months ago
---
 vgasrc/cbvga.c | 77 +++++---------------------------------------------
 1 file changed, 7 insertions(+), 70 deletions(-)

diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c
index 438d8fda6c6e..39fb701512b2 100644
--- a/vgasrc/cbvga.c
+++ b/vgasrc/cbvga.c
@@ -13,76 +13,13 @@
 #include "vgabios.h" // SET_VGA
 #include "vgafb.h" // handle_gfx_op
 #include "vgautil.h" // VBE_total_memory
+#include "svgamodes.h" // svga_modes
 
 static int CBmode VAR16;
 static struct vgamode_s CBmodeinfo VAR16;
 static struct vgamode_s CBemulinfo VAR16;
 static u32 CBlinelength VAR16;
 
-static struct cbvga_mode_s
-{
-    u16 mode;
-    struct vgamode_s info;
-} cbvesa_modes[] VAR16 = {
-    /* VESA 1.0 modes */
-    { 0x110, { MM_DIRECT, 640,  480,  15, 8, 16, SEG_GRAPH } },
-    { 0x111, { MM_DIRECT, 640,  480,  16, 8, 16, SEG_GRAPH } },
-    { 0x112, { MM_DIRECT, 640,  480,  24, 8, 16, SEG_GRAPH } },
-    { 0x113, { MM_DIRECT, 800,  600,  15, 8, 16, SEG_GRAPH } },
-    { 0x114, { MM_DIRECT, 800,  600,  16, 8, 16, SEG_GRAPH } },
-    { 0x115, { MM_DIRECT, 800,  600,  24, 8, 16, SEG_GRAPH } },
-    { 0x116, { MM_DIRECT, 1024, 768,  15, 8, 16, SEG_GRAPH } },
-    { 0x117, { MM_DIRECT, 1024, 768,  16, 8, 16, SEG_GRAPH } },
-    { 0x118, { MM_DIRECT, 1024, 768,  24, 8, 16, SEG_GRAPH } },
-    { 0x119, { MM_DIRECT, 1280, 1024, 15, 8, 16, SEG_GRAPH } },
-    { 0x11A, { MM_DIRECT, 1280, 1024, 16, 8, 16, SEG_GRAPH } },
-    { 0x11B, { MM_DIRECT, 1280, 1024, 24, 8, 16, SEG_GRAPH } },
-    { 0x11D, { MM_DIRECT, 1600, 1200, 15, 8, 16, SEG_GRAPH } },
-    { 0x11E, { MM_DIRECT, 1600, 1200, 16, 8, 16, SEG_GRAPH } },
-    { 0x11F, { MM_DIRECT, 1600, 1200, 24, 8, 16, SEG_GRAPH } },
-    /* VESA 2.0 modes */
-    { 0x141, { MM_DIRECT, 640,  400,  32, 8, 16, SEG_GRAPH } },
-    { 0x142, { MM_DIRECT, 640,  480,  32, 8, 16, SEG_GRAPH } },
-    { 0x143, { MM_DIRECT, 800,  600,  32, 8, 16, SEG_GRAPH } },
-    { 0x144, { MM_DIRECT, 1024, 768,  32, 8, 16, SEG_GRAPH } },
-    { 0x145, { MM_DIRECT, 1280, 1024, 32, 8, 16, SEG_GRAPH } },
-    { 0x147, { MM_DIRECT, 1600, 1200, 32, 8, 16, SEG_GRAPH } },
-    { 0x149, { MM_DIRECT, 1152, 864,  15, 8, 16, SEG_GRAPH } },
-    { 0x14a, { MM_DIRECT, 1152, 864,  16, 8, 16, SEG_GRAPH } },
-    { 0x14b, { MM_DIRECT, 1152, 864,  24, 8, 16, SEG_GRAPH } },
-    { 0x14c, { MM_DIRECT, 1152, 864,  32, 8, 16, SEG_GRAPH } },
-    { 0x175, { MM_DIRECT, 1280, 768,  16, 8, 16, SEG_GRAPH } },
-    { 0x176, { MM_DIRECT, 1280, 768,  24, 8, 16, SEG_GRAPH } },
-    { 0x177, { MM_DIRECT, 1280, 768,  32, 8, 16, SEG_GRAPH } },
-    { 0x178, { MM_DIRECT, 1280, 800,  16, 8, 16, SEG_GRAPH } },
-    { 0x179, { MM_DIRECT, 1280, 800,  24, 8, 16, SEG_GRAPH } },
-    { 0x17a, { MM_DIRECT, 1280, 800,  32, 8, 16, SEG_GRAPH } },
-    { 0x17b, { MM_DIRECT, 1280, 960,  16, 8, 16, SEG_GRAPH } },
-    { 0x17c, { MM_DIRECT, 1280, 960,  24, 8, 16, SEG_GRAPH } },
-    { 0x17d, { MM_DIRECT, 1280, 960,  32, 8, 16, SEG_GRAPH } },
-    { 0x17e, { MM_DIRECT, 1440, 900,  16, 8, 16, SEG_GRAPH } },
-    { 0x17f, { MM_DIRECT, 1440, 900,  24, 8, 16, SEG_GRAPH } },
-    { 0x180, { MM_DIRECT, 1440, 900,  32, 8, 16, SEG_GRAPH } },
-    { 0x181, { MM_DIRECT, 1400, 1050, 16, 8, 16, SEG_GRAPH } },
-    { 0x182, { MM_DIRECT, 1400, 1050, 24, 8, 16, SEG_GRAPH } },
-    { 0x183, { MM_DIRECT, 1400, 1050, 32, 8, 16, SEG_GRAPH } },
-    { 0x184, { MM_DIRECT, 1680, 1050, 16, 8, 16, SEG_GRAPH } },
-    { 0x185, { MM_DIRECT, 1680, 1050, 24, 8, 16, SEG_GRAPH } },
-    { 0x186, { MM_DIRECT, 1680, 1050, 32, 8, 16, SEG_GRAPH } },
-    { 0x187, { MM_DIRECT, 1920, 1200, 16, 8, 16, SEG_GRAPH } },
-    { 0x188, { MM_DIRECT, 1920, 1200, 24, 8, 16, SEG_GRAPH } },
-    { 0x189, { MM_DIRECT, 1920, 1200, 32, 8, 16, SEG_GRAPH } },
-    { 0x18a, { MM_DIRECT, 2560, 1600, 16, 8, 16, SEG_GRAPH } },
-    { 0x18b, { MM_DIRECT, 2560, 1600, 24, 8, 16, SEG_GRAPH } },
-    { 0x18c, { MM_DIRECT, 2560, 1600, 32, 8, 16, SEG_GRAPH } },
-    { 0x18d, { MM_DIRECT, 1280, 720,  16, 8, 16, SEG_GRAPH } },
-    { 0x18e, { MM_DIRECT, 1280, 720,  24, 8, 16, SEG_GRAPH } },
-    { 0x18f, { MM_DIRECT, 1280, 720,  32, 8, 16, SEG_GRAPH } },
-    { 0x190, { MM_DIRECT, 1920, 1080, 16, 8, 16, SEG_GRAPH } },
-    { 0x191, { MM_DIRECT, 1920, 1080, 24, 8, 16, SEG_GRAPH } },
-    { 0x192, { MM_DIRECT, 1920, 1080, 32, 8, 16, SEG_GRAPH } },
-};
-
 struct vgamode_s *cbvga_find_mode(int mode)
 {
     if (mode == GET_GLOBAL(CBmode))
@@ -91,8 +28,8 @@ struct vgamode_s *cbvga_find_mode(int mode)
         return &CBemulinfo;
 
     int i;
-    for (i = 0; i < ARRAY_SIZE(cbvesa_modes); i++) {
-        struct cbvga_mode_s *cbmode_g = &cbvesa_modes[i];
+    for (i = 0; i < svga_mcount; i++) {
+        struct generic_svga_mode *cbmode_g = &svga_modes[i];
         if (GET_GLOBAL(cbmode_g->mode) == 0xffff)
             continue;
         if (GET_GLOBAL(cbmode_g->mode) == mode)
@@ -114,8 +51,8 @@ cbvga_list_modes(u16 seg, u16 *dest, u16 *last)
          * + 24 Bpp and 32 Bpp are supported
          */
         int i;
-        for (i = 0; i < ARRAY_SIZE(cbvesa_modes) && dest < last; i++) {
-            struct cbvga_mode_s *cbmode_g = &cbvesa_modes[i];
+        for (i = 0; i < svga_mcount && dest < last; i++) {
+            struct generic_svga_mode *cbmode_g = &svga_modes[i];
             u16 mode = GET_GLOBAL(cbmode_g->mode);
             if (mode == 0xffff)
                 continue;
@@ -265,8 +202,8 @@ cbvga_setup_modes(u64 addr, u8 bpp, u32 xlines, u32 ylines, u32 linelength)
                , get_global_seg(), &CBmodeinfo, sizeof(CBemulinfo));
 
     // Validate modes
-    for (i = 0; i < ARRAY_SIZE(cbvesa_modes); i++) {
-        struct cbvga_mode_s *cbmode_g = &cbvesa_modes[i];
+    for (i = 0; i < svga_mcount; i++) {
+        struct generic_svga_mode *cbmode_g = &svga_modes[i];
         /* Skip VBE modes that doesn't fit into coreboot's framebuffer */
         if ((GET_GLOBAL(cbmode_g->info.height) > ylines)
             || (GET_GLOBAL(cbmode_g->info.width) > xlines)
-- 
2.20.1
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH 1/2] cbvga: reuse svga modes definitions from svgamodes.c
Posted by Kevin O'Connor 4 years, 9 months ago
Hi,

On Tue, Jul 30, 2019 at 07:21:36PM +0200, Uwe Kleine-König wrote:
> @@ -91,8 +28,8 @@ struct vgamode_s *cbvga_find_mode(int mode)
>          return &CBemulinfo;
>  
>      int i;
> -    for (i = 0; i < ARRAY_SIZE(cbvesa_modes); i++) {
> -        struct cbvga_mode_s *cbmode_g = &cbvesa_modes[i];
> +    for (i = 0; i < svga_mcount; i++) {

The vgabios runs in 16bit mode, so all reads of global variables must
be wrapped in GET_GLOBAL() - for example:

    for (i = 0; i < GET_GLOBAL(svga_mcount); i++) {

Otherwise, the series looks good to me.

-Kevin
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH 1/2] cbvga: reuse svga modes definitions from svgamodes.c
Posted by Gerd Hoffmann 4 years, 9 months ago
  Hi,

>      // Validate modes
> -    for (i = 0; i < ARRAY_SIZE(cbvesa_modes); i++) {
> -        struct cbvga_mode_s *cbmode_g = &cbvesa_modes[i];
> +    for (i = 0; i < svga_mcount; i++) {
> +        struct generic_svga_mode *cbmode_g = &svga_modes[i];
>          /* Skip VBE modes that doesn't fit into coreboot's framebuffer */
>          if ((GET_GLOBAL(cbmode_g->info.height) > ylines)
>              || (GET_GLOBAL(cbmode_g->info.width) > xlines)

Note that svga_modes has more modes than cbvesa_modes, specifically some
where memmodel != MM_DIRECT.  These must be skipped too.

Otherwise looks fine.  Didn't test it yet though.

cheers,
  Gerd
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] [PATCH 2/2] Add additional resolutions for 16:9 displays: 1600x900 and 2560x1440
Posted by Uwe Kleine-König 4 years, 9 months ago
This allows to have qemu run at the native screen resolution of my
(physical) monitor.

This is inspired by a patch created by Andreas Dangel that I found on
https://adangel.org/2015/09/11/qemu-kvm-custom-resolutions/ .
---
 vgasrc/svgamodes.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/vgasrc/svgamodes.c b/vgasrc/svgamodes.c
index 013504c3e691..f89ebef950a8 100644
--- a/vgasrc/svgamodes.c
+++ b/vgasrc/svgamodes.c
@@ -76,5 +76,13 @@ struct generic_svga_mode svga_modes[] VAR16 = {
     { 0x190, { MM_DIRECT, 1920, 1080, 16, 8, 16, SEG_GRAPH } },
     { 0x191, { MM_DIRECT, 1920, 1080, 24, 8, 16, SEG_GRAPH } },
     { 0x192, { MM_DIRECT, 1920, 1080, 32, 8, 16, SEG_GRAPH } },
+
+    /* custom resolutions for 16:9 displays */
+    { 0x193, { MM_DIRECT, 1600,  900, 16, 8, 16, SEG_GRAPH } },
+    { 0x194, { MM_DIRECT, 1600,  900, 24, 8, 16, SEG_GRAPH } },
+    { 0x195, { MM_DIRECT, 1600,  900, 32, 8, 16, SEG_GRAPH } },
+    { 0x196, { MM_DIRECT, 2560, 1440, 16, 8, 16, SEG_GRAPH } },
+    { 0x197, { MM_DIRECT, 2560, 1440, 24, 8, 16, SEG_GRAPH } },
+    { 0x198, { MM_DIRECT, 2560, 1440, 32, 8, 16, SEG_GRAPH } },
 };
 unsigned int svga_mcount VAR16 = ARRAY_SIZE(svga_modes);
-- 
2.20.1
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org