Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Nov 2007 13:49:21 +1300
From:      Kevin Dorne <sweetpea@tentacle.net>
To:        x11@freebsd.org
Subject:   Re: Patch for ignored PreferredMode on xorg startup
Message-ID:  <200711091349.21276.sweetpea@tentacle.net>
In-Reply-To: <200711091151.42917.sweetpea@tentacle.net>
References:  <200711091151.42917.sweetpea@tentacle.net>

next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart4458503.c5879ApsvT
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Patch included below:

=2D-- hw/xfree86/common/xf86str.h.orig
+++ hw/xfree86/common/xf86str.h
@@ -132,6 +132,7 @@ typedef enum {
 # define M_T_DEFAULT 0x10      /* (VESA) default modes */
 # define M_T_USERDEF 0x20      /* One of the modes from the config file=20
*/
 # define M_T_DRIVER  0x40      /* Supplied by the driver (EDID, etc) */
+# define M_T_USERPREF 0x80     /* mode preferred by the user config */
=20
 /* Video mode */
 typedef struct _DisplayModeRec {
=2D-- hw/xfree86/modes/xf86Crtc.c.orig
+++ hw/xfree86/modes/xf86Crtc.c
@@ -711,7 +711,8 @@ xf86DefaultMode (xf86OutputPtr output, int width,=20
int height)
     for (mode =3D output->probed_modes; mode; mode =3D mode->next)
     {
        int         dpi;
=2D       int         preferred =3D (mode->type & M_T_PREFERRED) !=3D 0;
+       int         preferred =3D (((mode->type & M_T_PREFERRED) !=3D 0) +
+                                ((mode->type & M_T_USERPREF) !=3D 0));
        int         diff;
=20
        if (xf86ModeWidth (mode, output->initial_rotation) > width ||
@@ -1415,7 +1416,7 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX,=20
int maxY)
                        mode->prev =3D NULL;
                        output->probed_modes =3D mode;
                    }
=2D                   mode->type |=3D M_T_PREFERRED;
+                   mode->type |=3D (M_T_PREFERRED|M_T_USERPREF);
                }
                else
                    mode->type &=3D ~M_T_PREFERRED;
@@ -1532,6 +1533,7 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool=20
canGrow)
     xf86CrtcConfigPtr  config =3D XF86_CRTC_CONFIG_PTR(scrn);
     int                        o, c;
     DisplayModePtr     target_mode =3D NULL;
+    int                        target_preferred =3D 0;
     Rotation           target_rotation =3D RR_Rotate_0;
     xf86CrtcPtr                *crtcs;
     DisplayModePtr     *modes;
@@ -1572,43 +1574,34 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool=20
canGrow)
     }
    =20
     /*
=2D     * Let outputs with preferred modes drive screen size
+     * User preferred > preferred > other modes
      */
     for (o =3D 0; o < config->num_output; o++)
     {
=2D       xf86OutputPtr output =3D config->output[o];
+       xf86OutputPtr   output =3D config->output[o];
+       DisplayModePtr  default_mode;
+       int             default_preferred;
=20
=2D       if (enabled[o] &&
=2D           xf86OutputHasPreferredMode (output, width, height))
+       if (!enabled[o])
+           continue;
+       default_mode =3D xf86DefaultMode (output, width, height);
+       if (!default_mode)
+           continue;
+       default_preferred =3D (((default_mode->type & M_T_PREFERRED) !=3D 0=
)=20
+
+                            ((default_mode->type & M_T_USERPREF) !=3D=20
0));
+       if (default_preferred > target_preferred || !target_mode)
        {
=2D           target_mode =3D xf86DefaultMode (output, width, height);
+           target_mode =3D default_mode;
+           target_preferred =3D default_preferred;
            target_rotation =3D output->initial_rotation;
=2D           if (target_mode)
=2D           {
=2D               modes[o] =3D target_mode;
=2D               config->compat_output =3D o;
=2D               break;
=2D           }
=2D       }
=2D    }
=2D    if (!target_mode)
=2D    {
=2D       for (o =3D 0; o < config->num_output; o++)
=2D       {
=2D           xf86OutputPtr output =3D config->output[o];
=2D           if (enabled[o])
=2D           {
=2D               target_mode =3D xf86DefaultMode (output, width, height);
=2D               target_rotation =3D output->initial_rotation;
=2D               if (target_mode)
=2D               {
=2D                   modes[o] =3D target_mode;
=2D                   config->compat_output =3D o;
=2D                   break;
=2D               }
=2D           }
+           config->compat_output =3D o;
        }
     }
+    if (target_mode)
+       modes[config->compat_output] =3D target_mode;
+    /*
+     * Fill in other output modes
+     */
     for (o =3D 0; o < config->num_output; o++)
     {
        xf86OutputPtr output =3D config->output[o];
=2D-- hw/xfree86/modes/xf86Crtc.h.orig
+++ hw/xfree86/modes/xf86Crtc.h
@@ -39,6 +39,9 @@
 #ifndef M_T_DRIVER
 #define M_T_DRIVER     0x40
 #endif
+#ifndef M_T_USERPREF
+#define M_T_USERPREF   0x80
+#endif
 #ifndef HARDWARE_CURSOR_ARGB
 #define HARDWARE_CURSOR_ARGB                           0x00004000
 #endif

--nextPart4458503.c5879ApsvT
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQBHM66RWPypEt5k4n0RAhXzAJwNxQZf4Bsdy/DjtEmPO//XMF+inACeJiwy
5kUHFAsWaLGGD4pWKPWgtSg=
=AKgM
-----END PGP SIGNATURE-----

--nextPart4458503.c5879ApsvT--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711091349.21276.sweetpea>