From: Daniel Vetter Subject: Re: Kernel warning when mode setting with no connectors connected Date: Sun, 13 Apr 2014 10:44:28 +0200 Message-ID: <20140413084428.GQ9262@phenom.ffwll.local> References: <20140412103229.GU16119@n2100.arm.linux.org.uk> <20140412212018.GW16119@n2100.arm.linux.org.uk> <20140412220430.GX16119@n2100.arm.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ee0-f47.google.com (mail-ee0-f47.google.com [74.125.83.47]) by gabe.freedesktop.org (Postfix) with ESMTP id A4CD56E64D for ; Sun, 13 Apr 2014 01:44:32 -0700 (PDT) Received: by mail-ee0-f47.google.com with SMTP id b15so5449428eek.20 for ; Sun, 13 Apr 2014 01:44:29 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20140412220430.GX16119@n2100.arm.linux.org.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Russell King - ARM Linux Cc: Daniel Vetter , dri-devel List-Id: dri-devel@lists.freedesktop.org On Sat, Apr 12, 2014 at 11:04:31PM +0100, Russell King - ARM Linux wrote: > On Sat, Apr 12, 2014 at 11:49:44PM +0200, Daniel Vetter wrote: > > On Sat, Apr 12, 2014 at 11:20 PM, Russell King - ARM Linux > > wrote: > > > So what happens is that a mode is attempted to be set with no connectors. > > > > That case is the other nonsense use of ->set_config I've curbed with > > all the fb helper fixes. > > > > BUG_ON(set->fb && set->num_connectors == 0); > > > > in drm_crtc_helper_set_config should catch this abuse of trying to set > > a mode with no connectors. So I'm still confused what exactly is going > > on in your box. > > Here's the DRM debug enabled: > > drm_mode_set_config_internal: pre: fb d8407080 mode dab0ab00 crtc dae72018 crtc->fb (null) > [drm:drm_crtc_helper_set_config], > [drm:drm_crtc_helper_set_config], [CRTC:3] [FB:11] #connectors=1 (x y) (0 0) > [drm:drm_crtc_helper_set_config], crtc has no fb, full mode set > [drm:drm_crtc_helper_set_config], encoder changed, full mode switch > [drm:drm_crtc_helper_set_config], crtc changed, full mode switch > [drm:drm_crtc_helper_set_config], [CONNECTOR:9:HDMI-A-1] to [CRTC:3] > [drm:drm_crtc_helper_set_config], attempting to set mode from userspace > [drm:drm_mode_debug_printmodeline], Modeline 12:"1360x768" 0 84750 1360 1432 1568 1776 768 771 781 798 0x0 0x6 > [drm:drm_crtc_helper_set_mode], [CRTC:3] > [drm:drm_crtc_helper_set_mode], [ENCODER:8:TMDS-8] set [MODE:12:1360x768] > [drm:drm_calc_timestamping_constants], crtc 3: hwmode: htotal 1776, vtotal 798, vdisplay 768 > [drm:drm_calc_timestamping_constants], crtc 3: clock 84750 kHz framedur 16722690 linedur 20955, pixeldur 11 > [drm:drm_crtc_helper_set_config], Setting connector DPMS state to on > [drm:drm_crtc_helper_set_config], [CONNECTOR:9:HDMI-A-1] set DPMS on > drm_helper_disable_unused_functions: crtc dae72018 crtc->fb d8407080 > drm_helper_disable_unused_functions: crtc dae72418 crtc->fb (null) > drm_crtc_helper_set_config: success > drm_mode_set_config_internal: post: fb d8407080 mode dab0ab00 crtc->fb (null) ret 0 > > This shows that the mode was being set with one connector present, and > seemed to be successful, but drm_helper_disable_unused_functions() still > tried to disable it. > > However, adding more debugging to drm_helper_disable_unused_functions() > reveals the problem: > > drm_helper_disable_unused_functions: connector 9 status 2 > drm_helper_disable_unused_functions: encoder 8 not in use > drm_helper_disable_unused_functions: crtc 3 crtc->fb da898500 > drm_helper_disable_unused_functions: crtc 6 crtc->fb (null) > > So we try to set a mode on CRTC 3 using encoder 8 and connector 9. > However connector 9 is disconnected, so the connector has its > encoder disassociated. The encoder is now not used, so the encoder > is disabled. This then means that the CRTC is not being used by > any encoder, so the CRTC gets disabled. That's a bit strange since userspace normally shouldn't attempt to set a mode when nothing is connected, at least if you don't force a specific configuration. In any case it sounds like you want commit e3d6ddb35f6221859b6054879d186e13a3af351e Author: Daniel Vetter Date: Tue Apr 1 22:15:00 2014 +0200 drm/crtc-helper: don't disable disconnected outputs I wonder whether we should put a cc: stable onto that one (maybe after a bit more testing) since apparently userspace can force the kernel to do stupid things if we auto-disable disconnected outputs. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch