Bug 45966

Summary: [965GM regression in 3.3-rc1] Screen flicker logging in in Gnome (pipe B underrun)
Product: DRI Reporter: Albert Damen <albrt>
Component: DRM/IntelAssignee: Jesse Barnes <jbarnes>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: medium CC: ben, chris, daniel, jbarnes
Version: DRI git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
dmesg on 3.3-rc3, running xrandr after switching on drm.debug
none
Xorg.0.log
none
output of xrandr --verbose
none
output of intel_reg_dumper
none
For comparison, dmesg of running xrandr on 3.2.5
none
dmesg booting rc3 with drm.debug=0x0e
none
video of logging in none

Description Albert Damen 2012-02-12 13:45:59 UTC
Created attachment 56929 [details]
dmesg on 3.3-rc3, running xrandr after switching on drm.debug

Bug description:
The screen heavily flickers when I login in gnome from gdm. The flickering also happens when I run xrandr in gnome-terminal (but not as bad as when logging in).
dmesg with drm.debug=0x0e shows pipe B underruns.

System environment:
-- chipset: 965GM
-- system architecture: 64-bit
-- xf86-video-intel: SNA from git, commit 798aad6c95a1 (7 Feb)
-- xserver: 1.11.99.903
-- mesa: 8.0
-- libdrm: 2.4.31
-- kernel: 3.3-rc3
-- Linux distribution: Ubuntu Maverick, Gnome (Oct 2010)
-- Machine or mobo model: Compal IFL91 laptop
-- Display connector: LVDS

Reproducing steps:
log in into gnome from gdm or run xrandr in gnome-terminal

Additional info:
The issue also exists in kernel 3.3-rc1. With kernel 3.2.5 the problem does not occur.
Kernels build from drm-intel-next and -fixes are also affected.
Comment 1 Albert Damen 2012-02-12 13:48:43 UTC
Created attachment 56930 [details]
Xorg.0.log
Comment 2 Albert Damen 2012-02-12 13:49:20 UTC
Created attachment 56931 [details]
output of xrandr --verbose
Comment 3 Albert Damen 2012-02-12 13:50:05 UTC
Created attachment 56932 [details]
output of intel_reg_dumper
Comment 4 Albert Damen 2012-02-12 13:51:08 UTC
Created attachment 56933 [details]
For comparison, dmesg of running xrandr on 3.2.5
Comment 5 Chris Wilson 2012-02-12 16:31:27 UTC
[    8.132408] [drm:intel_framebuffer_init] *ERROR* unsupported pixel format

A clue?
Comment 6 Daniel Vetter 2012-02-13 01:39:32 UTC
A few things to check:
- Please boot with drm.debug=0xe on the kernel cmdline, log in (for the flickering) and then attach the entire dmesg.
- Can you describe the kind of flickering some more or maybe make a video/take a picture of it?
-
Comment 7 Daniel Vetter 2012-02-13 01:40:39 UTC
A few things to check:
- Please boot with drm.debug=0xe on the kernel cmdline, log in (for the flickering) and then attach the entire dmesg.
- Can you describe the kind of flickering some more or maybe make a video/take a picture of it?
- The issue seems to be newly introduce in 3.3-rc1. Can you do a bisect to find out where this regression got introduced?
Comment 8 Albert Damen 2012-02-13 13:14:06 UTC
Created attachment 56990 [details]
dmesg booting rc3 with drm.debug=0x0e
Comment 9 Albert Damen 2012-02-13 13:20:44 UTC
Looks like Chris was spot on:

308e5bcbdb10452e8aba31aa21432fb67ee46d72 is the first bad commit
commit 308e5bcbdb10452e8aba31aa21432fb67ee46d72
Author: Jesse Barnes <jbarnes@virtuousgeek.org>
Date:   Mon Nov 14 14:51:28 2011 -0800

    drm: add an fb creation ioctl that takes a pixel format v5

Running the commit before this (drm: add plane support v3) solves the flicker at login and running xrandr. Also, the error message about unsupported pixel format has gone.
Comment 10 Daniel Vetter 2012-02-13 14:24:23 UTC
Looks like Jesse failed to take some random interaction between all things fb pixel layout into account.
Comment 11 Albert Damen 2012-02-13 14:46:47 UTC
Created attachment 56997 [details]
video of logging in
Comment 12 Albert Damen 2012-02-14 14:30:04 UTC
Setting a proper pixel_format for the load detection of the TV solves the flickering. As in my case the problem was with creating a framebuffer for TV load detection, I used pixel format DRM_FOURCC_VYUY (and added a case for VYUY in drm_helper_get_fb_bpp_depth).
As the same function seems to be used for crt detection on pre 945 as well, I guess that value will not always work. Maybe one of the RGB formats can be used for load detection of both TV and CRT?

diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 432d539..10795ce 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -843,6 +843,10 @@ void drm_helper_get_fb_bpp_depth(uint32_t format, unsigned int *depth,
                *depth = 32;
                *bpp = 32;
                break;
+       case DRM_FOURCC_VYUY:
+               *depth = 24;
+               *bpp = 32;
+               break;
        default:
                DRM_DEBUG_KMS("unsupported pixel format\n");
                *depth = 0;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 50ae915..08c14c2 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6332,7 +6332,7 @@ intel_framebuffer_create_for_mode(struct drm_device *dev,
        mode_cmd.height = mode->vdisplay;
        mode_cmd.pitches[0] = intel_framebuffer_pitch_for_width(mode_cmd.width,
                                                                bpp);
-       mode_cmd.pixel_format = 0;
+       mode_cmd.pixel_format = DRM_FOURCC_VYUY;
 
        return intel_framebuffer_create(dev, &mode_cmd, obj);
 }
Comment 13 Albert Damen 2012-02-23 12:01:30 UTC
[PATCH] drm/i915: fix mode set on load pipe. (v2) 
as posted to intel-gfx today solves the problem.
Comment 14 Chris Wilson 2012-02-29 14:47:27 UTC
In airlied/drm-fixes:

commit 5ca0c34ae28344b6b4ca3036bc82f89c8db16a59
Author: Dave Airlie <airlied@redhat.com>
Date:   Thu Feb 23 15:33:40 2012 +0000

    drm/i915: fix mode set on load pipe. (v2)
    
    Booted my i965 machine and it started printing the unsupported pixel
    format of 0 message (once I added content to it).
    
    Oh looksie here, we pass 0. fix.
    
    v2: compile it.
    
    Buzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45966
    
    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
    Signed-off-by: Dave Airlie <airlied@redhat.com>
    Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

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.