mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Yongbang Shi <shiyongbang@huawei.com>,
	dmitry.baryshkov@oss.qualcomm.com, tiantao6@hisilicon.com,
	xinliang.liu@linaro.org, maarten.lankhorst@linux.intel.com,
	mripard@kernel.org, airlied@gmail.com, daniel@ffwll.ch,
	kong.kongxinwei@hisilicon.com
Cc: liangjian010@huawei.com, chenjianmin@huawei.com,
	fengsheng5@huawei.com, helin52@h-partners.com,
	shenjian15@huawei.com, shaojijie@huawei.com,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH for drm-misc-fixes v4 2/4] drm/hisilicon/hibmc: fix no showing when no connectors connected
Date: Fri, 17 Apr 2026 09:54:57 +0200	[thread overview]
Message-ID: <cb1f80ec-20af-4e59-a32e-b1e61e66af0d@suse.de> (raw)
In-Reply-To: <20260416092455.1990632-3-shiyongbang@huawei.com>

Hi

Am 16.04.26 um 11:24 schrieb Yongbang Shi:
> From: Lin He <helin52@huawei.com>
>
> Our chip support KVM over IP feature, so hibmc driver need to support
> displaying without any connectors plugged in. If no connectors are
> connected, the vdac connector status should be set to 'connected' to
> ensure proper KVM display functionality. Additionally, for
> previous-generation products that may lack hardware link support and
> thus cannot detect the monitor, the same approach should be applied
> to ensure VGA display functionality. Add phys_state in the struct of
> dp and vdac to check all physical outputs.
>
> For get_modes: using BMC modes for connector if no display is attached to
> phys VGA cable, otherwise use EDID modes by drm_connector_helper_get_modes,
> because KVM doesn't provide EDID reads.
>
> Fixes: 4c962bc929f1 ("drm/hisilicon/hibmc: Add vga connector detect functions")
> Reported-by: Thomas Zimmermann <tzimmermann@suse.de>
> Closes: https://lore.kernel.org/all/0eb5c509-2724-4c57-87ad-74e4270d5a5a@suse.de/

The bug I reported is that the DDC does not return an EDID at all. 
Therefore hibmc fails to detect the connected VGA monitor. AFAIU that's 
not what is being fixed in this patch.

> Signed-off-by: Lin He <helin52@huawei.com>
> Signed-off-by: Yongbang Shi <shiyongbang@huawei.com>
> ---
[...]
> +static int hibmc_vdac_detect(struct drm_connector *connector,
> +			     struct drm_modeset_acquire_ctx *ctx,
> +			     bool force)
> +{
> +	struct hibmc_drm_private *priv = to_hibmc_drm_private(connector->dev);
> +	struct hibmc_vdac *vdac = to_hibmc_vdac(connector);
> +
> +	vdac->phys_state = drm_connector_helper_detect_from_ddc(connector,
> +								ctx, force);
> +
> +	/* If the DP connectors are disconnected, the hibmc_vdac_detect function
> +	 * must return a connected state to ensure KVM display functionality.
> +	 * Additionally, for previous-generation products that may lack hardware
> +	 * link support and thus cannot detect the monitor, hibmc_vdac_detect
> +	 * should also return a connected state.
> +	 */
> +	if (priv->dp.phys_state != connector_status_connected)
> +		return connector_status_connected;
> +
> +	return vdac->phys_state;

This will break user-space compositors if DP and VGA are connected at 
the same time. I know, because we had such logic in ast and mgag200.

Today's compositors expect a single encoder-connector pair on each CRTC. 
That's what most contemporary hardware provides.  But the server 
chipsets usually come with one a single CRTC and multiple connectors 
attached to it.  Compositors fail to configure that. When we had this in 
ast and mgag200, Gnome would display garbage to the screen and 
mode-setting would fail. The bug report is at [1].

In ast and mgag200, only one connector would be installed on a single 
system. So we could avoid the problem. It looks like that this is not an 
option with hibmc. VGA always seems to be present and DP seems optional. 
I would advice to only report one of the connectors as 'connected' if 
both are installed on a system.

You also need to increment the connector's epoch_counter if the physical 
status changed. Doing this will trigger DRM clients to re-read the 
connector state and reconfigure display.

Something like that

dp_detect()
{
     dp.phys_state = detect_from_hw()

     if (dp.phys_state changed)
         ++epoch_counter
     return connected
}

vdac_detect()
{
     if (dp.phys_state == connected)
         return disconnected

     vdac.phys_state = detect_from_hw()

     if (vdac.phys_state changed)
         ++epoch_counter
     return connected
}

This handles the KVM in each connector's helper. The ast driver is 
probably the best reference for the current logic. See [2].

[1] https://gitlab.gnome.org/GNOME/mutter/-/issues/3858
[2] 
https://elixir.bootlin.com/linux/v7.0/source/drivers/gpu/drm/ast/ast_vga.c#L47

Best regards
Thomas

> +}
> +
>   static const struct drm_connector_helper_funcs
>   	hibmc_connector_helper_funcs = {
>   	.get_modes = hibmc_connector_get_modes,
> -	.detect_ctx = drm_connector_helper_detect_from_ddc,
> +	.detect_ctx = hibmc_vdac_detect,
>   };
>   
>   static const struct drm_connector_funcs hibmc_connector_funcs = {
> @@ -130,6 +145,8 @@ int hibmc_vdac_init(struct hibmc_drm_private *priv)
>   
>   	connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;
>   
> +	vdac->phys_state = connector_status_connected;
> +
>   	return 0;
>   
>   err:

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)



  reply	other threads:[~2026-04-17  7:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-16  9:24 [PATCH for drm-misc-fixes v4 0/4] Fix some bugs in the hibmc driver Yongbang Shi
2026-04-16  9:24 ` [PATCH for drm-misc-fixes v4 1/4] drm/hisilicon/hibmc: add updating link cap in DP detect() Yongbang Shi
2026-04-16  9:24 ` [PATCH for drm-misc-fixes v4 2/4] drm/hisilicon/hibmc: fix no showing when no connectors connected Yongbang Shi
2026-04-17  7:54   ` Thomas Zimmermann [this message]
2026-04-20  8:40     ` Yongbang Shi
2026-04-20  9:32       ` Thomas Zimmermann
2026-04-20 14:00         ` Yongbang Shi
2026-04-20 14:54           ` Thomas Zimmermann
2026-04-21  7:24             ` Yongbang Shi
2026-04-21  7:44               ` Thomas Zimmermann
2026-04-21  7:52                 ` Yongbang Shi
2026-04-16  9:24 ` [PATCH for drm-misc-fixes v4 3/4] drm/hisilicon/hibmc: move display contrl config to hibmc_probe() Yongbang Shi
2026-04-16  9:24 ` [PATCH for drm-misc-fixes v4 4/4] drm/hisilicon/hibmc: use clock to look up the PLL value Yongbang Shi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb1f80ec-20af-4e59-a32e-b1e61e66af0d@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=chenjianmin@huawei.com \
    --cc=daniel@ffwll.ch \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fengsheng5@huawei.com \
    --cc=helin52@h-partners.com \
    --cc=kong.kongxinwei@hisilicon.com \
    --cc=liangjian010@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=shaojijie@huawei.com \
    --cc=shenjian15@huawei.com \
    --cc=shiyongbang@huawei.com \
    --cc=tiantao6@hisilicon.com \
    --cc=xinliang.liu@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®