On Tue, Apr 04, 2017 at 12:59:25PM +0200, Maarten Lankhorst wrote: > mode_valid() called from drm_helper_probe_single_connector_modes() > may need to look at connector->state because what a valid mode is may > depend on connector properties being set. For example some HDMI modes > might be rejected when a connector property forces the connector > into DVI mode. > > Some implementations of detect() already lock all state, > so we have to pass an acquire_ctx to them to prevent a deadlock. > > This means changing the function signature of detect() slightly, > and passing the acquire_ctx for locking multiple crtc's. > For the callbacks, it will always be non-zero. To allow callers > not to worry about this, drm_helper_probe_detect_ctx is added > which might handle -EDEADLK for you. > > Changes since v1: > - Always set ctx parameter. > > Signed-off-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx> > Cc: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxxxxxxx> > /** > + * drm_helper_probe_detect - probe connector status > + * @connector: connector to probe > + * @ctx: lock acquire_ctx, or NULL to let this function handle it. > + * @force: Whether destructive probe operations should be performed. > + * > + * This function calls the detect callbacks of the connector. > + * This function returns drm_connector_status, or > + * if @ctx is set, it might also return -EDEADLK. > + */ > +int > +drm_helper_probe_detect(struct drm_connector *connector, > + struct drm_modeset_acquire_ctx *ctx, > + bool force) > +{ > + const struct drm_connector_helper_funcs *funcs = connector->helper_private; > + > + if (funcs->detect_ctx && ctx) > + return funcs->detect_ctx(connector, ctx, force); > + else if (funcs->detect_ctx) > + return drm_helper_probe_detect_ctx(connector, force); > + else if (connector->funcs->detect) > + return connector->funcs->detect(connector, force); > + else > + return connector_status_connected; On irc we discussed that we need to hold mode_config->connection_mutex around _all_ types of ->detect. But here you only do that for ->detect_ctx, which defeats the purpose and also runs against your commit message. Sent out the wrong version? I can't find v3 anywhere ... -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx