Bug 97443

Summary: Intel GM965 internal display cropped and scaled incorrectly
Product: DRI Reporter: Sean Greenslade <sean>
Component: DRM/IntelAssignee: Ville Syrjala <ville.syrjala>
Status: CLOSED FIXED QA Contact: Intel GFX Bugs mailing list <intel-gfx-bugs>
Severity: major    
Priority: medium CC: intel-gfx-bugs, sean
Version: DRI git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: I965GM i915 features: display/LVDS
Attachments:
Description Flags
Photograph of screen
none
dmesg output of a boot on the bad commit
none
dmesg output (with drm.debug) of a boot on the bad commit none

Description Sean Greenslade 2016-08-22 20:21:01 UTC
Created attachment 125960 [details]
Photograph of screen

I have a Panasonic Toughbook CF-30 that has started having a strange issue with its internal display. The image is being scaled larger than the display, offset, and cropped. Photo attached, notice black bar at top and cut off WM at right. This also happens in console mode without X running. Xrandr reports that the system *thinks* it is running at the panel's native resolution.

I have bisected the drm-intel git tree, and found this to be the problem commit:

commit a05628195a0d9f3173dd9aa76f482aef692e46ee
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date:   Mon Apr 11 10:23:51 2016 +0300

    drm/i915: Get panel_type from OpRegion panel details

I don't understand this code well enough to try and fix it, so I'm hoping for some insight here.


System info:

lspci:
00:00.0 Host bridge: Intel Corporation Mobile PM965/GM965/GL960 Memory Controller Hub (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (primary) (rev 03)
00:02.1 Display controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (secondary) (rev 03)
00:04.0 Signal processing controller: Intel Corporation Device 2a08 (rev 03)
00:1a.0 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #4 (rev 03)
00:1a.1 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 (rev 03)
00:1a.7 USB controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 (rev 03)
00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)
00:1c.0 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 (rev 03)
00:1c.1 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 2 (rev 03)
00:1c.2 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 3 (rev 03)
00:1c.3 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 4 (rev 03)
00:1c.4 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 5 (rev 03)
00:1d.0 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 (rev 03)
00:1d.1 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 (rev 03)
00:1d.2 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 (rev 03)
00:1d.7 USB controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev f3)
00:1f.0 ISA bridge: Intel Corporation 82801HM (ICH8M) LPC Interface Controller (rev 03)
00:1f.1 IDE interface: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) IDE Controller (rev 03)
00:1f.2 SATA controller: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) SATA Controller [AHCI mode] (rev 03)
00:1f.3 SMBus: Intel Corporation 82801H (ICH8 Family) SMBus Controller (rev 03)
0b:00.0 Network controller: Intel Corporation PRO/Wireless 4965 AG or AGN [Kedron] Network Connection (rev 61)
0d:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8055 PCI-E Gigabit Ethernet Controller (rev 13)
0e:00.0 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev ba)
0e:00.1 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller (rev 04)
0e:00.2 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 21)
Comment 1 Sean Greenslade 2016-08-22 20:21:44 UTC
Created attachment 125961 [details]
dmesg output of a boot on the bad commit
Comment 2 Sean Greenslade 2016-08-22 20:38:56 UTC
Created attachment 125962 [details]
dmesg output (with drm.debug) of a boot on the bad commit
Comment 3 Sean Greenslade 2016-08-22 22:24:40 UTC
This in particular from the debug log is suspicious:

1114 [   20.020773] [drm:intel_fb_initial_config] looking for cmdline mode on connector LVDS-1
1115 [   20.020775] [drm:intel_fb_initial_config] looking for preferred mode on connector LVDS-1 0
1116 [   20.020777] [drm:intel_fb_initial_config] connector LVDS-1 on pipe B [CRTC:29]: 1280x1024
1117 [   20.020779] [drm:intel_fb_initial_config] connector VGA-1 not enabled, skipping
1118 [   20.020781] [drm:drm_setup_crtcs] desired mode 1280x1024 set on crtc 29 (0,0)

The panel's native resolution is 1024x768. Xrandr reports the following:

Screen 0: minimum 8 x 8, current 1024 x 768, maximum 32767 x 32767
LVDS1 connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1280x1024     59.68 +
   1280x960      60.00  
   1024x768      60.00* 
   800x600       60.32    56.25  
   640x512       60.00  
   640x480       59.94  
VGA1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
Comment 4 Ville Syrjala 2016-09-06 12:09:39 UTC
Dang. Can you try 
git://github.com/vsyrjala/linux.git opregion_panel_type_stuff

I'm not expecting it would really fix the problem, but it will at least show us the full response from the BIOS.
Comment 5 Sean Greenslade 2016-09-06 16:36:16 UTC
Thanks for looking into this. I built the linked branch and tested it (still bad, as expected). The line of interest is:

[   18.780038] [drm:swsci] GBDA get panel details 0x00000020 0x00020400
Comment 6 Ville Syrjala 2016-09-06 18:38:49 UTC
(In reply to Sean Greenslade from comment #5)
> Thanks for looking into this. I built the linked branch and tested it (still
> bad, as expected). The line of interest is:
> 
> [   18.780038] [drm:swsci] GBDA get panel details 0x00000020 0x00020400

Thanks. I pushed a new patch to the branch which I think should get us back on track with your machine. So please pull again, and retest.

I don't really know if it's any more correct than the current code though, and I don't yet know if it works for the original machine that needs the opregion panel type.
Comment 7 Sean Greenslade 2016-09-06 19:50:32 UTC
The new commit works for me.

I am still quite curious about the panel details reserved bit. According to the ACPI IGD OpRegion spec, the panel details bit 17 is reserved 0, but on all three Intel graphics laptops I own (from three different vendors and three different CPU generations), it is set to 1. (Table 7-24 SWSCI Mailbox, PARM Offset – Panel Details) Is the spec sheet I'm looking at out of date? Does that bit mean something else?
Comment 8 Ville Syrjala 2016-09-07 05:12:58 UTC
(In reply to Sean Greenslade from comment #7)
> The new commit works for me.
> 
> I am still quite curious about the panel details reserved bit. According to
> the ACPI IGD OpRegion spec, the panel details bit 17 is reserved 0, but on
> all three Intel graphics laptops I own (from three different vendors and
> three different CPU generations), it is set to 1. (Table 7-24 SWSCI Mailbox,
> PARM Offset – Panel Details) Is the spec sheet I'm looking at out of date?
> Does that bit mean something else?

I don't know. I've not found any version of the spec that would show the bit as being anything but reserved.
Comment 9 Ville Syrjala 2016-09-08 09:15:14 UTC
I had to resort to a quirk to fix this for all machines. Please test this branch:

git://github.com/vsyrjala/linux.git opregion_panel_type_quirk
Comment 10 Sean Greenslade 2016-09-08 21:25:50 UTC
Yes, the -quirk branch works for me. Feel free to add my Tested-by.

Tested-by: Sean Greenslade <sean@seangreenslade.com>
Comment 11 Ville Syrjala 2016-09-09 08:46:21 UTC
(In reply to Sean Greenslade from comment #10)
> Yes, the -quirk branch works for me. Feel free to add my Tested-by.
> 
> Tested-by: Sean Greenslade <sean@seangreenslade.com>

I had to revise the patch a bit more to make it actually work on the original machine that needs the quirk:
git://github.com/vsyrjala/linux.git opregion_panel_type_quirk_2

Please test to make sure I didn't fumble anything for other machines. Fingers crossed that this is the last revision...
Comment 12 Sean Greenslade 2016-09-09 17:58:33 UTC
All good.

For branch opregion_panel_type_quirk_2 (current HEAD 1138c4d8382f0):
Tested-by: Sean Greenslade <sean@seangreenslade.com>

Thanks for all your work on this.
Comment 13 yann 2016-09-13 09:37:19 UTC
Patch submitted and under review: https://patchwork.freedesktop.org/series/12380/
Comment 14 yann 2016-09-13 09:57:20 UTC
Resolving as fixed due to re-test feedback and waiting for patch to be merged and tested to close it.
Comment 15 Jani Nikula 2016-09-13 13:09:46 UTC
(In reply to yann from comment #14)
> Resolving as fixed due to re-test feedback and waiting for patch to be
> merged and tested to close it.

Please let's resolve fixed only after the patch has been merged. Thanks.
Comment 16 Jani Nikula 2016-09-14 09:37:19 UTC
Fixed by

commit ea54ff4008892b46c7a3e6bc8ab8aaec9d198639
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date:   Tue Sep 13 12:22:19 2016 +0300

    drm/i915: Ignore OpRegion panel type except on select machines

in drm-intel-fixes.

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.