Skip to contentSkip to conversation

Allow 1366x768 as a valid VGA resolution

PATCH In review John Baboval 2 participants 5 messages Oct 28, 2011 – Nov 3, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Allow 1366x768 as a valid VGA resolution

760p TV panels have a 1366x768 resolution, and have been popular recently as low-cost monitors. The 1366 resolution doesn't pass the (xres & 7) == 0 test.

---
 hw/vga.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/vga.c +1 -1
index 8003eda..f12a371 100644
@@ -680,7 +680,7 @@ static void vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val)
             }
             break;
         case VBE_DISPI_INDEX_XRES:
-            if ((val <= vs.max_xres) && ((val & 7) == 0)) {
+            if (val <= vs.max_xres) {
                 s->vbe_regs[s->vbe_index] = val;
             }
             break;
Signature · 1 line
1.7.4.1
#1 lore raw
Quoted 3 lines · John Baboval

760p TV panels have a 1366x768 resolution, and have been popular recently as low-cost monitors. The 1366 resolution doesn't pass the (xres & 7) == 0 test.

Why is it save to simply remove the test?
Guess there is a reason why it is there in the first place?

cheers,
Gerd

#2 lore raw

I don't know of any reason for it.

-John

Quoted 11 lines · Gerd Hoffmann
Quoted 3 lines · John Baboval

760p TV panels have a 1366x768 resolution, and have been popular recently as low-cost monitors. The 1366 resolution doesn't pass the (xres & 7) == 0 test.

Why is it save to simply remove the test?
Guess there is a reason why it is there in the first place?

cheers,
Gerd

#3 lore raw
Quoted 1 line · John Baboval

I don't know of any reason for it.

I'd guess it is alignment, probably not important for all color depts.

Maybe it is a good idea to do all sanity checks in the VBE_DISPI_INDEX_ENABLE branch where the actual mode switch happens. Then you already know xres, yres and depth when applying the checks. You can calculate the scanline length, then check the scanline alignment instead of being overly strict on xres in high color modes to satisfy alignment requirements in low color modes.

You can also simply calculate how much memory the video mode needs and check that against the configured video ram instead of pulling xres and yres limits out of thin air.

cheers,
Gerd

#4 lore raw

This is a good idea. I'm going to re-work the patch, but I have a lot of other stuff going on too, so it may be a week or so before I get back to it.

Quoted 17 lines · Gerd Hoffmann
Quoted 1 line · John Baboval

I don't know of any reason for it.

I'd guess it is alignment, probably not important for all color depts.

Maybe it is a good idea to do all sanity checks in the VBE_DISPI_INDEX_ENABLE branch where the actual mode switch happens. Then you already know xres, yres and depth when applying the checks. You can calculate the scanline length, then check the scanline alignment instead of being overly strict on xres in high color modes to satisfy alignment requirements in low color modes.

You can also simply calculate how much memory the video mode needs and check that against the configured video ram instead of pulling xres and yres limits out of thin air.

cheers,
Gerd