Kernel warning when mode setting with no connectors connected

Daniel Vetter daniel at ffwll.ch
Sun Apr 13 01:44:28 PDT 2014


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
> > <linux at arm.linux.org.uk> 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 <daniel.vetter at ffwll.ch>
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


More information about the dri-devel mailing list