Bug 38851

Summary: 1360x768 resolution slants/wraps-around display in kernels newer than 2.6.32
Product: xorg Reporter: J-Mag Guthrie <j.mag.guthrie>
Component: Driver/intelAssignee: Chris Wilson <chris>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: major    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description J-Mag Guthrie 2011-06-30 12:50:22 UTC
I use the 1360x768 resolution on my higher-res screen.  it's a Dell Studio 17 laptop.  Newer kernels skew the screen.  The whole screen is displayed but slanted 

\
 \
  \
   \

Like that.

It works under 2.6.32 but not more recent kernels.
Comment 1 Chris Wilson 2011-06-30 13:12:19 UTC
Please attach your Xorg.log, xrandr --verbose and dmesg.
Comment 2 J-Mag Guthrie 2011-06-30 15:19:28 UTC
Hi, Chris.

Which kernel do you want it from?  I can boot a plethora of them.

- J-Mag



On Thu, Jun 30, 2011 at 3:12 PM, <bugzilla-daemon@freedesktop.org> wrote:

> https://bugs.freedesktop.org/show_bug.cgi?id=38851
>
> --- Comment #1 from Chris Wilson <chris@chris-wilson.co.uk> 2011-06-30
> 13:12:19 PDT ---
> Please attach your Xorg.log, xrandr --verbose and dmesg.
>
> --
> Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.
>
Comment 3 Chris Wilson 2011-07-01 11:23:16 UTC
2.6.32 + a non-working kernel of your choice, and please include xrandr --verbose.
I suspect we will need intel_reg_dumper for 2.6.32 and broken config as well.
Comment 4 J-Mag Guthrie 2011-07-03 17:25:17 UTC
For the third blinking time.

Bugzilla doeesn't think I'm including any text or whatever.

---------- Forwarded message ----------
From: J-Mag Guthrie <j.mag.guthrie@gmail.com>
Date: Sun, Jul 3, 2011 at 7:23 PM
Subject: Fwd: [Bug 38851] 1360x768 resolution slants/wraps-around
display in kernels newer than 2.6.32
To: bugzilla-daemon@freedesktop.org


It thought it was HTML or something.

---------- Forwarded message ----------
From: J-Mag Guthrie <j.mag.guthrie@gmail.com>
Date: Sun, Jul 3, 2011 at 7:22 PM
Subject: Re: [Bug 38851] 1360x768 resolution slants/wraps-around
display in kernels newer than 2.6.32
To: bugzilla-daemon@freedesktop.org


2.6.32-5 and 2.6.39-2

On Fri, Jul 1, 2011 at 1:23 PM, <bugzilla-daemon@freedesktop.org> wrote:
>
> https://bugs.freedesktop.org/show_bug.cgi?id=38851
>
> --- Comment #3 from Chris Wilson <chris@chris-wilson.co.uk> 2011-07-01 11:23:16 PDT ---
> 2.6.32 + a non-working kernel of your choice, and please include xrandr
> --verbose.
> I suspect we will need intel_reg_dumper for 2.6.32 and broken config as well.
>
> --
> Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.
Comment 5 J-Mag Guthrie 2011-07-09 11:35:09 UTC
Is there anything more you need from me about this?

- J-Mag
Comment 6 J-Mag Guthrie 2011-07-13 12:24:01 UTC
Are you waiting on me for something?

- J-Mag
Comment 7 Chris Wilson 2011-07-29 02:04:34 UTC
I was waiting upon the attachments bugzilla kept stripping. Fortunately Adam Jackson found the bug, and in drm-intel-fixes:


commit 302983e9059e9ef5de3ca7671918eeb237c5971e
Author: Adam Jackson <ajax@redhat.com>
Date:   Wed Jul 13 16:32:32 2011 -0400

    drm/i915/pch: Fix integer math bugs in panel fitting
    
    Consider a 1600x900 panel, upscaling a 1360x768 mode, full-aspect.  The
    old math would give you:
    
        scaled_width  = 1600 * 768;         /* 1228800 */
        scaled_height = 1360 * 900;         /* 1224000 */
        if (scaled_width > scaled_height) { /* pillarbox, and true */
            width  = 1224000 / 768;         /* int(1593.75) = 1593 */
            x      = (1600 - 1593 + 1) / 2; /* 4 */
            y      = 0;
            height = 768;
        } /* ... */
    
    This is broken.  The total width of scanout would then be 1593 + 4 + 4,
    or 1601, which is wider than the panel itself.  The hardware very
    dutifully implements this, and you end up with a black 45° diagonal from
    the top-left corner to the bottom edge of the screen.  It's a cool
    effect and all, but not what you wanted.  Similar things happen for the
    letterbox case.
    
    The problem is that you have an integer number of pixels, which means
    it's usually impossible to upscale equally on both axes.  1360/768 is
    1.7708, 1600/900 is 1.7777.  Since we're constrained on the one axis,
    the other one wants to come out as an even number of pixels (the panel
    is almost certainly even on both axes, and the x/y offsets will be
    applied on both sides).  In the math above, if 'width' comes out even,
    rounding down is correct; if it's odd, you'd rather round up.  So just
    increment width/height in those cases.
    
    Tested on a Lenovo T500 (Ironlake).
    
    Signed-off-by: Adam Jackson <ajax@redhat.com>
    Tested-By: Daniel Manrique <daniel.manrique@canonical.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38851
    Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
    Cc: stable@kernel.org
    Signed-off-by: Keith Packard <keithp@keithp.com>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.