Re: drm: Bogus WARN() in drm_atomic_helper_update_legacy_modeset_state() ?

From: Thierry Reding
Date: Thu Nov 12 2015 - 07:26:42 EST


On Thu, Nov 12, 2015 at 02:27:29PM +0800, Mark yao wrote:
> On 2015å11æ11æ 00:56, Thierry Reding wrote:
> >On Tue, Nov 10, 2015 at 03:01:03PM +0000, Liviu Dudau wrote:
> >>Hello,
> >>
> >>When booting my Juno board with the HDLCD driver that I have converted to
> >>atomic operations I'm getting the following warning:
> >Perhaps you can provide pointers to the source code, that might make it
> >easier for people to spot what's going wrong.
> >
> >Thierry
> >
> >
> >_______________________________________________
> >dri-devel mailing list
> >dri-devel@xxxxxxxxxxxxxxxxxxxxx
> >http://lists.freedesktop.org/mailman/listinfo/dri-devel
> Hi Thierry
> I encountered the same problem as Liviu.
> I'm coverting rockchip drm to atomic api, when booting with hdmi
> connected, get under warning:
>
> [ 1.300156] WARNING: CPU: 0 PID: 26 at
> drivers/gpu/drm/drm_atomic_helper.c:674
> drm_atomic_helper_update_legacy_modeset_state+0x3c/0x1f8()
> [ 1.300161] Modules linked in:
> [ 1.300171] CPU: 0 PID: 26 Comm: kworker/0:1 Not tainted 4.3.0-rc5+ #160
> [ 1.300174] Hardware name: Rockchip (Device Tree)
> [ 1.300189] Workqueue: events output_poll_execute
> [ 1.300224] [<c0015e54>] (unwind_backtrace) from [<c00123cc>]
> (show_stack+0x10/0x14)
> [ 1.300241] [<c00123cc>] (show_stack) from [<c01a5980>]
> (dump_stack+0x6c/0x88)
> [ 1.300255] [<c01a5980>] (dump_stack) from [<c0024050>]
> (warn_slowpath_common+0x80/0xa8)
> [ 1.300265] [<c0024050>] (warn_slowpath_common) from [<c0024090>]
> (warn_slowpath_null+0x18/0x1c)
> [ 1.300277] [<c0024090>] (warn_slowpath_null) from [<c0221184>]
> (drm_atomic_helper_update_legacy_modeset_state+0x3c/0x1f8)
> [ 1.300293] [<c0221184>] (drm_atomic_helper_update_legacy_modeset_state)
> from [<c0221548>] (drm_atomic_helper_commit_modeset_disables+0x208/0x364)
> [ 1.300305] [<c0221548>] (drm_atomic_helper_commit_modeset_disables) from
> [<c0222248>] (drm_atomic_helper_commit+0xf8/0x140)
> [ 1.300320] [<c0222248>] (drm_atomic_helper_commit) from [<c02404cc>]
> (drm_atomic_commit+0x50/0x60)
> [ 1.300333] [<c02404cc>] (drm_atomic_commit) from [<c0223180>]
> (restore_fbdev_mode+0xf4/0x278)
> [ 1.300345] [<c0223180>] (restore_fbdev_mode) from [<c0224164>]
> (drm_fb_helper_restore_fbdev_mode_unlocked+0x30/0x68)
> [ 1.300357] [<c0224164>] (drm_fb_helper_restore_fbdev_mode_unlocked) from
> [<c02241d8>] (drm_fb_helper_set_par+0x3c/0x54)
> [ 1.300368] [<c02241d8>] (drm_fb_helper_set_par) from [<c022411c>]
> (drm_fb_helper_hotplug_event+0xe4/0xfc)
> [ 1.300382] [<c022411c>] (drm_fb_helper_hotplug_event) from [<c021ade8>]
> (drm_kms_helper_hotplug_event+0x24/0x28)
> [ 1.300396] [<c021ade8>] (drm_kms_helper_hotplug_event) from [<c021af20>]
> (output_poll_execute+0x134/0x18c)
> [ 1.300413] [<c021af20>] (output_poll_execute) from [<c00377c0>]
> (process_one_work+0x1e0/0x318)
> [ 1.300426] [<c00377c0>] (process_one_work) from [<c0037c70>]
> (worker_thread+0x378/0x4c4)
> [ 1.300438] [<c0037c70>] (worker_thread) from [<c003c69c>]
> (kthread+0xdc/0xf0)
> [ 1.300450] [<c003c69c>] (kthread) from [<c000f5d8>]
> (ret_from_fork+0x14/0x3c)
>
> I can't found who can set encoder->crtc value before atomic_commit, what's
> going wrong?

The explanation here is probably the same as the one I gave to Liviu.
Does the below help?

Thierry

--- >8 ---
diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index 56de9f1c95fc..ffef392ccc13 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -1648,8 +1648,6 @@ static int dw_hdmi_register(struct drm_device *drm, struct dw_hdmi *hdmi)
drm_connector_init(drm, &hdmi->connector, &dw_hdmi_connector_funcs,
DRM_MODE_CONNECTOR_HDMIA);

- hdmi->connector.encoder = encoder;
-
drm_mode_connector_attach_encoder(&hdmi->connector, encoder);

return 0;

Attachment: signature.asc
Description: PGP signature