[PATCH 4/5] randr: Fix up yet another corner case in preferred mode selection

Alex Deucher alexdeucher at gmail.com
Mon Jul 30 11:36:33 PDT 2012


On Mon, Jul 30, 2012 at 2:32 PM, Adam Jackson <ajax at redhat.com> wrote:
> Let's say - purely for the sake of argument, mind you - that you had a
> server GPU with anemic memory bandwidth, and you walked up to it and
> plugged in a monitor that was 1920x1080 because that's what happened to
> be on the crash cart.  Say the memory bandwidth is such that anything
> larger than 1280x1024 gets filtered away.  Now you're in trouble,
> because the established timings section includes a 720x400 mode because
> that's what DOS 80x25 is, and that happens to just about match the
> physical aspect ratio.
>
> Instead let's reuse the logic from the existing aspect-match path: pick
> the larger mode of either the physical aspect ratio or 4:3.
>
> Reviewed-by: Julien Cristau <jcristau at debian.org>
> Signed-off-by: Adam Jackson <ajax at redhat.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  hw/xfree86/modes/xf86Crtc.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
> index 2628409..dfce1d1 100644
> --- a/hw/xfree86/modes/xf86Crtc.c
> +++ b/hw/xfree86/modes/xf86Crtc.c
> @@ -2073,12 +2073,13 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
>
>      /*
>       * If there's no preferred mode, but only one monitor, pick the
> -     * biggest mode for its aspect ratio, assuming one exists.
> +     * biggest mode for its aspect ratio or 4:3, assuming one exists.
>       */
>      if (!ret)
>          do {
>              int i = 0;
>              float aspect = 0.0;
> +            DisplayModePtr a = NULL, b = NULL;
>
>              /* count the number of enabled outputs */
>              for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++);
> @@ -2092,8 +2093,11 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
>                  aspect = (float) config->output[p]->mm_width /
>                      (float) config->output[p]->mm_height;
>
> +            a = bestModeForAspect(config, enabled, 4.0/3.0);
>              if (aspect)
> -                preferred_match[p] = bestModeForAspect(config, enabled, aspect);
> +                b = bestModeForAspect(config, enabled, aspect);
> +
> +            preferred_match[p] = biggestMode(a, b);
>
>              if (preferred_match[p])
>                  ret = TRUE;
> --
> 1.7.7.6
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel


More information about the xorg-devel mailing list