From 8a17dd1dc4db9f230f29d0ab8dc929fbb2b81066 Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris@chris-wilson.co.uk>
Date: Mon, 23 Sep 2013 15:24:40 +0100
Subject: [PATCH] xfree86: Infer VirtualSize from Driver modes

The VirtualSize inferrence was originally conceived in

commit 81ef1b6d6063c20db4963abf7b7848e235aa4ebb
Author: Adam Jackson <ajax@benzedrine.nwnk.net>
Date:   Thu Sep 14 19:18:58 2006 -0400

    Mark EDID modes as driver modes.  Infer virtual size from driver modes.

and made sure to prefer the modes reported by the driver.

This regressed in

commit 7bb653bedceb6180a0361ead1c612839e776ce98
Author: Olivier Fourdan <ofourdan@redhat.com>
Date:   Mon Oct 18 15:59:35 2010 -0400

    modes: improve aspect ratio match for classic drivers

which switched the VirtualSize inferrence to select the largest
builtin mode. This has the side-effect of causing X to reject all valid
driver modes larger than the builtins.

Reported-by: Felix Miata <mrmazda@earthlink.net>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Adam Jackson <ajax@redhat.com>
Cc: Olivier Fourdan <ofourdan@redhat.com>
---
 hw/xfree86/common/xf86Mode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index 44bc559..983e9ec 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -1869,10 +1869,10 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
         }
         if (vx < virtX || vy < virtY) {
             const int types[] = {
-                M_T_BUILTIN | M_T_PREFERRED,
-                M_T_BUILTIN,
                 M_T_DRIVER | M_T_PREFERRED,
                 M_T_DRIVER,
+                M_T_BUILTIN | M_T_PREFERRED,
+                M_T_BUILTIN,
                 0
             };
             const int ntypes = sizeof(types) / sizeof(int);
-- 
2.0.1