Bug 78655 - kernel 3.15 regression, drm i915 chooses wrong monitor resolution
Summary: kernel 3.15 regression, drm i915 chooses wrong monitor resolution
Status: CLOSED FIXED
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Intel (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Jesse Barnes
QA Contact: Intel GFX Bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-13 11:41 UTC by Knut Petersen
Modified: 2017-07-24 22:54 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
dmesg with drm.debug=0xe (114.17 KB, text/plain)
2014-05-13 11:51 UTC, Knut Petersen
no flags Details
Fix the FIRST_DETAILED_PREFERRED quirk (2.47 KB, patch)
2014-05-13 13:20 UTC, Chris Wilson
no flags Details | Splinter Review
Ensure a mode is preferred in the EDID (1.84 KB, patch)
2014-05-13 13:20 UTC, Chris Wilson
no flags Details | Splinter Review

Description Knut Petersen 2014-05-13 11:41:26 UTC

    
Comment 1 Knut Petersen 2014-05-13 11:51:05 UTC
Created attachment 98973 [details]
dmesg with drm.debug=0xe

Hardware AOpen i915GMm-hfs motherboard, TFT monitor attached to VGA-1

As you can see, the monitor supports a resolution of 1280x1024, and that is what kernels up to 3.14 use. After 3.14 that changes, and the reason is quite obvious

[    4.002464] [drm:intelfb_create] no BIOS fb, allocating a new one
[    4.002470] [drm:i915_gem_object_create_stolen] creating stolen object: size=1d5000
[    4.002481] [drm:i915_pages_create_for_stolen] offset=0x1f5000, size=1921024
[    4.003880] [drm:intelfb_create] allocated 800x600 fb: 0x00200000, bo f638cc00
[    4.007426] fbcon: inteldrmfb (fb0) is primary device

Without testing I would think this is another regression introduced by commit d978ef14456a38034f6c0e94a794129501f89200

Jesse, do you agree?

cu,
 Knut
Comment 2 Knut Petersen 2014-05-13 11:58:54 UTC
see also (resolved) bug 77767
Comment 3 Jani Nikula 2014-05-13 12:04:19 UTC
(In reply to comment #1)
> Without testing I would think this is another regression introduced by
> commit d978ef14456a38034f6c0e94a794129501f89200

Please try d978ef14456a38034f6c0e94a794129501f89200^ and d978ef14456a38034f6c0e94a794129501f89200 so we don't have to speculate.
Comment 4 Chris Wilson 2014-05-13 12:27:14 UTC
I think the real question is why are using a non-native BIOS mode when !fastboot?
Comment 5 Chris Wilson 2014-05-13 12:36:34 UTC
Actually, it is why is drm_has_preferred_mode() failing?
Comment 6 Knut Petersen 2014-05-13 13:16:42 UTC
(In reply to comment #3)
> (In reply to comment #1)
> > Without testing I would think this is another regression introduced by
> > commit d978ef14456a38034f6c0e94a794129501f89200
> 
> Please try d978ef14456a38034f6c0e94a794129501f89200^ and
> d978ef14456a38034f6c0e94a794129501f89200 so we don't have to speculate.

I was wrong. Starting to bisect.

cu,
 knut
Comment 7 Knut Petersen 2014-05-13 13:18:26 UTC
(In reply to comment #4)
> I think the real question is why are using a non-native BIOS mode when
> !fastboot?

Tried fastboot ... monitor reports out-of-range video signal.

cu,
 Knut
Comment 8 Chris Wilson 2014-05-13 13:20:28 UTC
Created attachment 98977 [details] [review]
Fix the FIRST_DETAILED_PREFERRED quirk
Comment 9 Chris Wilson 2014-05-13 13:20:49 UTC
Created attachment 98978 [details] [review]
Ensure a mode is preferred in the EDID
Comment 10 Knut Petersen 2014-05-13 14:43:27 UTC
Hi Chris!

I tested attachments 98977 and 98978, they applied to kernel 4186fea0cb06bc43181ce239efe0df6f1af260a with a bit of offset and fixed the problem here. Definitely another candidate for 3.15.

[    3.496049] [drm:intel_gmbus_force_bit] enabling bit-banging on i915 gmbus vga. force bit now 1
[    3.536426] [drm:intel_gmbus_force_bit] disabling bit-banging on i915 gmbus vga. force bit now 0
[    3.536478] [drm:edid_ensure_preferred] No preferred mode found in EDID on connector VGA-1, marking the first (1280x1024) as preferred
[    3.536485] [drm:drm_edid_to_eld] ELD: no CEA Extension found
[    3.536506] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:8:VGA-1] probed modes :
[    3.536516] [drm:drm_mode_debug_printmodeline] Modeline 82:"1280x1024" 60 108000 1280 1328 1440 1688 1024 1025 1028 1066 0x48 0x5
[    3.536525] [drm:drm_mode_debug_printmodeline] Modeline 90:"1280x1024" 75 135000 1280 1296 1440 1688 1024 1025 1028 1066 0x40 0x5
[    3.536535] [drm:drm_mode_debug_printmodeline] Modeline 97:"1152x864" 75 108000 1152 1216 1344 1600 864 865 868 900 0x40 0x5
[    3.536544] [drm:drm_mode_debug_printmodeline] Modeline 91:"1024x768" 75 78800 1024 1040 1136 1312 768 769 772 800 0x40 0x5
[    3.536554] [drm:drm_mode_debug_printmodeline] Modeline 92:"1024x768" 70 75000 1024 1048 1184 1328 768 771 777 806 0x40 0xa
[    3.536563] [drm:drm_mode_debug_printmodeline] Modeline 93:"1024x768" 60 65000 1024 1048 1184 1344 768 771 777 806 0x40 0xa
[    3.536572] [drm:drm_mode_debug_printmodeline] Modeline 94:"832x624" 75 57284 832 864 928 1152 624 625 628 667 0x40 0xa
[    3.536582] [drm:drm_mode_debug_printmodeline] Modeline 95:"800x600" 75 49500 800 816 896 1056 600 601 604 625 0x40 0x5
[    3.536591] [drm:drm_mode_debug_printmodeline] Modeline 96:"800x600" 72 50000 800 856 976 1040 600 637 643 666 0x40 0x5
[    3.536600] [drm:drm_mode_debug_printmodeline] Modeline 83:"800x600" 60 40000 800 840 968 1056 600 601 605 628 0x40 0x5
[    3.536610] [drm:drm_mode_debug_printmodeline] Modeline 84:"800x600" 56 36000 800 824 896 1024 600 601 603 625 0x40 0x5
[    3.536619] [drm:drm_mode_debug_printmodeline] Modeline 85:"640x480" 75 31500 640 656 720 840 480 481 484 500 0x40 0xa
[    3.536628] [drm:drm_mode_debug_printmodeline] Modeline 86:"640x480" 73 31500 640 664 704 832 480 489 491 520 0x40 0xa
[    3.536637] [drm:drm_mode_debug_printmodeline] Modeline 87:"640x480" 67 30240 640 704 768 864 480 483 486 525 0x40 0xa
[    3.536647] [drm:drm_mode_debug_printmodeline] Modeline 88:"640x480" 60 25200 640 656 752 800 480 490 492 525 0x40 0xa
[    3.536656] [drm:drm_mode_debug_printmodeline] Modeline 89:"720x400" 70 28320 720 738 846 900 400 412 414 449 0x40 0x6


[    3.998321] [drm:drm_enable_connectors] connector 8 enabled? yes
[    3.998327] [drm:drm_enable_connectors] connector 11 enabled? no
[    3.998332] [drm:drm_enable_connectors] connector 13 enabled? no
[    3.998338] [drm:drm_enable_connectors] connector 30 enabled? no
[    3.998343] [drm:drm_enable_connectors] connector 47 enabled? no
[    3.998349] [drm:drm_enable_connectors] connector 64 enabled? no
[    3.998354] [drm:drm_enable_connectors] connector 65 enabled? no
[    3.998361] [drm:intel_fb_initial_config] looking for cmdline mode on connector 8
[    3.998367] [drm:intel_fb_initial_config] looking for preferred mode on connector 8
[    3.998374] [drm:intel_fb_initial_config] connector VGA-1 on crtc 5: 1280x1024
[    3.998379] [drm:intel_fb_initial_config] connector 11 not enabled, skipping
[    3.998385] [drm:intel_fb_initial_config] connector 13 not enabled, skipping
[    3.998390] [drm:intel_fb_initial_config] connector 30 not enabled, skipping
[    3.998395] [drm:intel_fb_initial_config] connector 47 not enabled, skipping
[    3.998401] [drm:intel_fb_initial_config] connector 64 not enabled, skipping
[    3.998406] [drm:intel_fb_initial_config] connector 65 not enabled, skipping
[    3.998412] [drm:drm_setup_crtcs] desired mode 1280x1024 set on crtc 5
[    3.998427] [drm:intelfb_create] BIOS fb too small (800x600), we require (1280x1024), releasing it
[    3.998432] [drm:intelfb_create] no BIOS fb, allocating a new one
[    3.998438] [drm:i915_gem_object_create_stolen] creating stolen object: size=500000
[    3.998448] [drm:i915_pages_create_for_stolen] offset=0x1f5000, size=5242880
[    4.004393] [drm:intelfb_create] allocated 1280x1024 fb: 0x00200000, bo f638cc00
[    4.005714] fbcon: inteldrmfb (fb0) is primary device


Thanks,
 Knut
Comment 11 Knut Petersen 2014-05-13 14:45:21 UTC
(In reply to comment #7)
> (In reply to comment #4)
> > I think the real question is why are using a non-native BIOS mode when
> > !fastboot?
> 
> Tried fastboot ... monitor reports out-of-range video signal.
> 
> cu,
>  Knut

To make it clear: This is the same bug and also fixed by attachments 98977 & 98978

cu,
 Knut
Comment 12 Chris Wilson 2014-05-13 15:06:02 UTC
Let's keep the bug open until Daniel/Jani has taken a patch. I'm not too keen on frobbing the EDID modes, as that may affect other things (and even userspace).

In light of that, I prefer:

diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 1d3f0a9cce31..8dc702ab524a 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -397,6 +397,11 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
                                                          height);
                }
 
+               /* No preferred mode marked by the EDID? Are there any modes? */
+               if (!modes[i] && !list_empty(&connector->modes))
+                       modes[i] = list_first_entry(struct drm_display_mode,
+                                                   &connector->modes, head);
+
                /* last resort: use current mode */
                if (!modes[i]) {
                        /*
Comment 13 Knut Petersen 2014-05-13 15:49:37 UTC
(In reply to comment #12)
> Let's keep the bug open until Daniel/Jani has taken a patch. I'm not too
> keen on frobbing the EDID modes, as that may affect other things (and even
> userspace).

Ok. But as kernels up to 3.14.x seem to default to the same solution (although silently) I would not expect problems ...

Excerpts from 3.14.1 dmesg on the same hardware:


[    3.480049] [drm:intel_gmbus_force_bit], enabling bit-banging on i915 gmbus vga. force bit now 1
[    3.520395] [drm:intel_gmbus_force_bit], disabling bit-banging on i915 gmbus vga. force bit now 0
[    3.520450] [drm:drm_edid_to_eld], ELD: no CEA Extension found
[    3.520470] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:5:VGA-1] probed modes :
[    3.520480] [drm:drm_mode_debug_printmodeline], Modeline 86:"1280x1024" 75 135000 1280 1296 1440 1688 1024 1025 1028 1066 0x40 0x5
[    3.520489] [drm:drm_mode_debug_printmodeline], Modeline 78:"1280x1024" 60 108000 1280 1328 1440 1688 1024 1025 1028 1066 0x40 0x5
[    3.520499] [drm:drm_mode_debug_printmodeline], Modeline 93:"1152x864" 75 108000 1152 1216 1344 1600 864 865 868 900 0x40 0x5
[    3.520508] [drm:drm_mode_debug_printmodeline], Modeline 87:"1024x768" 75 78800 1024 1040 1136 1312 768 769 772 800 0x40 0x5
[    3.520518] [drm:drm_mode_debug_printmodeline], Modeline 88:"1024x768" 70 75000 1024 1048 1184 1328 768 771 777 806 0x40 0xa
[    3.520527] [drm:drm_mode_debug_printmodeline], Modeline 89:"1024x768" 60 65000 1024 1048 1184 1344 768 771 777 806 0x40 0xa
[    3.520536] [drm:drm_mode_debug_printmodeline], Modeline 90:"832x624" 75 57284 832 864 928 1152 624 625 628 667 0x40 0xa
[    3.520546] [drm:drm_mode_debug_printmodeline], Modeline 91:"800x600" 75 49500 800 816 896 1056 600 601 604 625 0x40 0x5
[    3.520555] [drm:drm_mode_debug_printmodeline], Modeline 92:"800x600" 72 50000 800 856 976 1040 600 637 643 666 0x40 0x5
[    3.520564] [drm:drm_mode_debug_printmodeline], Modeline 79:"800x600" 60 40000 800 840 968 1056 600 601 605 628 0x40 0x5
[    3.520574] [drm:drm_mode_debug_printmodeline], Modeline 80:"800x600" 56 36000 800 824 896 1024 600 601 603 625 0x40 0x5
[    3.520583] [drm:drm_mode_debug_printmodeline], Modeline 81:"640x480" 75 31500 640 656 720 840 480 481 484 500 0x40 0xa
[    3.520592] [drm:drm_mode_debug_printmodeline], Modeline 82:"640x480" 73 31500 640 664 704 832 480 489 491 520 0x40 0xa
[    3.520601] [drm:drm_mode_debug_printmodeline], Modeline 83:"640x480" 67 30240 640 704 768 864 480 483 486 525 0x40 0xa
[    3.520611] [drm:drm_mode_debug_printmodeline], Modeline 84:"640x480" 60 25200 640 656 752 800 480 490 492 525 0x40 0xa
[    3.520620] [drm:drm_mode_debug_printmodeline], Modeline 85:"720x400" 70 28320 720 738 846 900 400 412 414 449 0x40 0x6



[    3.982908] [drm:drm_setup_crtcs], 
[    3.982915] [drm:drm_enable_connectors], connector 5 enabled? yes
[    3.982921] [drm:drm_enable_connectors], connector 8 enabled? no
[    3.982926] [drm:drm_enable_connectors], connector 10 enabled? no
[    3.982932] [drm:drm_enable_connectors], connector 27 enabled? no
[    3.982937] [drm:drm_enable_connectors], connector 44 enabled? no
[    3.982943] [drm:drm_enable_connectors], connector 61 enabled? no
[    3.982948] [drm:drm_enable_connectors], connector 62 enabled? no
[    3.982954] [drm:drm_target_preferred], looking for cmdline mode on connector 5
[    3.982960] [drm:drm_target_preferred], looking for preferred mode on connector 5
[    3.982967] [drm:drm_target_preferred], found mode 1280x1024
[    3.982973] [drm:drm_setup_crtcs], picking CRTCs for 4096x4096 config
[    3.982981] [drm:drm_setup_crtcs], desired mode 1280x1024 set on crtc 3
[    3.982996] [drm:intelfb_create], no BIOS fb, allocating a new one
[    3.983003] [drm:i915_gem_object_create_stolen], creating stolen object: size=500000
[    3.983013] [drm:i915_pages_create_for_stolen], offset=0x20000, size=5242880
[    3.988996] [drm:intelfb_create], allocated 1280x1024 fb: 0x00020000, bo f6391c40
[    3.990289] fbcon: inteldrmfb (fb0) is primary device

cu,
 Knut
Comment 14 Chris Wilson 2014-05-15 09:01:48 UTC
commit afba0b5a221c0dacbbdf3a778d539fbc90fc6191
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue May 13 16:07:37 2014 +0100

    drm/i915: Use the first mode if there is no preferred mode in the EDID
    
    This matches the algorithm used by earlier kernels when selecting the
    mode for the fbcon. And only if there is no modes at all, do we fall
    back to using the BIOS configuration. Seamless transition is still
    preserved (from the BIOS configuration to ours) so long as the BIOS has
    also chosen what we hope is the native configuration.
    
    Reported-by: Knut Petersen <Knut_Petersen@t-online.de>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78655
    Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
    Tested-by: Knut Petersen <Knut_Petersen@t-online.de>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    [Jani: applied Chris' "Please imagine that I wrote this correctly."]
    Signed-off-by: Jani Nikula <jani.nikula@intel.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.