Re: [PATCH 1/1] drm/bridge: vga-dac: Fix detect of monitor connection

From: Daniel Vetter
Date: Thu Jul 25 2019 - 14:05:58 EST


On Thu, Jul 25, 2019 at 11:05:24AM +0000, Oleksandr Suvorov wrote:
> DDC and VGA channels are independent, and therefore
> we cannot decide whether the monitor is connected or not,
> depending on the information from the DDC.
>
> So the monitor should always be considered connected.
> Thus there is no reason to use connector detect callback for this
> driver.
>
> Fixes DRM error of dumb monitor detection like:
> ...
> DRM: head 'VGA-1' found, connector 32 is disconnected.
> ...
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: 56fe8b6f4991 ("drm/bridge: Add RGB to VGA bridge support")
> Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@xxxxxxxxxxx>

Uh nope :-)

Yes VGA monitors are broken, but the way to fix that is to either override
that on the kernel cmdline, or in your userspace somewhere. Not hardcode
this in the kernel for everyone. Because not everyone does have a broken
VGA monitor, but if you do this _every_ desktop will try to light up that
broken monitor. Which leads to lots of bug reports and regressions.

This case is exactly what connector_status_unknown is meant for: The
kernel couldn't authoritatively figure out whether there is a monitor or
not. Userspace should/can try this into account for autoconfiguration.

Note a more proper fix would be to somehow wire up load detection. That
will work even for dumb VGA monitors, and e.g. i915 then gives you an
authoritative connector_status_disconnected if it could execute a load
detect cycle (not always possible on some hw) and there's no screen
detected with that.

Maybe we should document this better somewhere in docs? Would be great if
you can type a patch for this ...
-Daniel

> ---
>
> drivers/gpu/drm/bridge/dumb-vga-dac.c | 18 ------------------
> 1 file changed, 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/dumb-vga-dac.c b/drivers/gpu/drm/bridge/dumb-vga-dac.c
> index d32885b906ae..e37c19356d12 100644
> --- a/drivers/gpu/drm/bridge/dumb-vga-dac.c
> +++ b/drivers/gpu/drm/bridge/dumb-vga-dac.c
> @@ -73,25 +73,7 @@ static const struct drm_connector_helper_funcs dumb_vga_con_helper_funcs = {
> .get_modes = dumb_vga_get_modes,
> };
>
> -static enum drm_connector_status
> -dumb_vga_connector_detect(struct drm_connector *connector, bool force)
> -{
> - struct dumb_vga *vga = drm_connector_to_dumb_vga(connector);
> -
> - /*
> - * Even if we have an I2C bus, we can't assume that the cable
> - * is disconnected if drm_probe_ddc fails. Some cables don't
> - * wire the DDC pins, or the I2C bus might not be working at
> - * all.
> - */
> - if (!IS_ERR(vga->ddc) && drm_probe_ddc(vga->ddc))
> - return connector_status_connected;
> -
> - return connector_status_unknown;
> -}
> -
> static const struct drm_connector_funcs dumb_vga_con_funcs = {
> - .detect = dumb_vga_connector_detect,
> .fill_modes = drm_helper_probe_single_connector_modes,
> .destroy = drm_connector_cleanup,
> .reset = drm_atomic_helper_connector_reset,
> --
> 2.20.1
>

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch