[PATCH] drm/crtc: fix connector reference counting mismatch in drm_crtc_helper_set_config

Daniel Vetter daniel at ffwll.ch
Fri Jun 3 19:07:22 UTC 2016


On Fri, Jun 03, 2016 at 10:27:11AM +0200, Philipp Zabel wrote:
> Am Donnerstag, den 02.06.2016, 22:25 +0200 schrieb Daniel Vetter:
> [...]
> > >     [drm:drm_ioctl] pid=205, dev=0xe201, auth=1, DRM_IOCTL_MODE_SETCRTC
> > >     [drm:drm_mode_setcrtc] [CRTC:24:crtc-0]
> > >     [drm:drm_mode_setcrtc] [CONNECTOR:36:LVDS-1]
> 
> ^ This is printed after each drm_connector_lookup call. The crtc_req
> only contains connector 36, and only that one is looked up and gets its
> refcount incremented to 2. The unrelated, unbound connector 34 is not
> part of the request, doesn't get added to the drm_mode_set, and stays at
> reference count 1.
> 
> > >     [drm:drm_crtc_helper_set_config] 
> > >     [drm:drm_crtc_helper_set_config] [CRTC:24:c 13.982686] [drm:drm_mode_debug_printmodeline] Modeline 0:"" 0 0 0 0 0 0 0 0 0 0 0x0 0x0
> > >     [drm:drm_mode_debug_printmodeline] Modeline 41:"1280x800" 60 71100 1280 1281 1439 1440 800 801 822 823 0x40 0x0
> > >     [drm:drm_mode_object_reference] OBJ ID: 36 (2)
> > >     [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:36:LVDS-1] to [CRtc-0]
> > >     [drm:drm_crtc_helper_set_mode] [ENCODER:35:LVDS-35] set [MODE:41:1280x800]
> > >     [drm:drm_calc_timestamping_constants] crtc 24: hwmode: htotal 1440, vtotal 823, vdisplay 800
> > >     [drm:drm_calc_timestamping_constants] crtc 24: clock 71100 kHz framedur 16668354 linedur 20253
> > >     [drm:drm_crtc_helper_set_config] Setting connector DPMS state to on
> > >     [drm:drm_crtc_helper_set_config] 	[CONNECTOR:36:LVDS-1] set DPMS on
> > >     [drm:drm_mode_object_unreference] OBJ ID: 34 (1)
> 
> ^ And here the temporary copy of connector 34 gets its reference count
> decremented to 0.
> 
> > The additional get/put I'm talking off happens in drm_mode_setcrtc (the
> > get is hidden in drm_connector_lookup). Might be interesting to trace the
> > refcount for each connector after each get and before each put.
> 
> drm_connector_lookup is not called for connector 34 if userspace just
> requests to enable a single output on connector 36.

Hm indeed ...

But again we're back to why isn't this an immediate fireworks show on all
the other legacy kms drivers. I have no idea ...
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list