dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Anush Veeranala" <j@gnu.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/fb-helper: Keep blanked outputs off across restore and hotplug
Date: Sat, 05 Dec 2026 14:31:21 +0000	[thread overview]
Message-ID: <sashiko-outbox-251630@kernel.org> (raw)
In-Reply-To: <875wx7rfwp.fsf@gnu.org>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/fb-helper: drm_fb_helper_dpms() latches dpms_mode despite
  -EBUSY failure
- [Medium] drm/fb-helper: forced restore leaves dpms_mode stale across
  delayed hotplug
--

commit 5438bb76521b1ee953b8205afd87e275ec4f45c5
Author: Anush Veeranala <j@gnu.org>

drm/fb-helper: Keep blanked outputs off across restore and hotplug

This commit caches the last DPMS blank mode in struct drm_fb_helper and uses
drm_client_modeset_dpms() on unforced atomic restores so blanked outputs stay
off across drm_lastclose() and hotplug events.

> diff --git a/drivers/gpu/drm/clients/drm_fbdev_helper.c b/drivers/gpu/drm/clients/drm_fbdev_helper.c
> index 415764ee086a8..592b1f23cee63 100644
> --- a/drivers/gpu/drm/clients/drm_fbdev_helper.c
> +++ b/drivers/gpu/drm/clients/drm_fbdev_helper.c
> @@ -105,6 +105,17 @@ __drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper,
>  		 * racing here, see drm_fb_helper_set_par().
>  		 */
>  		ret = drm_client_modeset_commit_locked(&fb_helper->client);
> +	} else if (fb_helper->dpms_mode != DRM_MODE_DPMS_ON &&
> +		   drm_drv_uses_atomic_modeset(fb_helper->dev)) {
> +		/*
> +		 * Keep blanked outputs off. Forced restores still light them:
> +		 * fbcon forces one when switching back to text mode and then
> +		 * unblanks, and sysrq forces one to show the console. Legacy
> +		 * DPMS doesn't commit the configuration, so legacy drivers
> +		 * keep committing it with the outputs on.
> +		 */
> +		ret = drm_client_modeset_dpms(&fb_helper->client,
> +					      fb_helper->dpms_mode);
>  	} else {
>  		ret = drm_client_modeset_commit(&fb_helper->client);
>  	}

[Severity: Medium]
Should the forced restore branch reset fb_helper->dpms_mode to
DRM_MODE_DPMS_ON on success?

If the console is blanked and fb_helper->delayed_hotplug was set while a DRM
master was active, a SysRq-v forced restore lights the outputs via
drm_client_modeset_commit_locked() and then immediately runs
drm_fb_helper_hotplug_event() -> drm_fb_helper_set_par().

That calls __drm_fb_helper_restore_fbdev_mode_unlocked() with force unset,
so the stale fb_helper->dpms_mode commits the CRTCs back off before SysRq-v
finishes, defeating the emergency restore.

[ ... ]

> @@ -146,6 +158,7 @@ static void drm_fb_helper_dpms(struct fb_info *info, int dpms_mode)
>  	struct drm_fb_helper *fb_helper = info->par;
>  
>  	mutex_lock(&fb_helper->lock);
> +	fb_helper->dpms_mode = dpms_mode;
>  	drm_client_modeset_dpms(&fb_helper->client, dpms_mode);
>  	mutex_unlock(&fb_helper->lock);
>  }

[Severity: Medium]
Can drm_fb_helper_dpms() latch fb_helper->dpms_mode even when
drm_client_modeset_dpms() fails with -EBUSY?

If userspace issues FBIOBLANK while a compositor holds DRM master in
KD_GRAPHICS, drm_client_modeset_dpms() returns -EBUSY without changing the
display.  fbcon_fb_blanked() ignores the notification in KD_GRAPHICS, so
par->blank_state stays FB_BLANK_UNBLANK while fb_helper->dpms_mode is stale.

When the compositor exits to KD_TEXT, fbcon_unblank() clears console_blanked
and skips fb_blank(info, FB_BLANK_UNBLANK) because par->blank_state is
already unblanked.  drm_lastclose() then runs an unforced restore and turns
all CRTCs off on a console that keypresses cannot wake.

Updating fb_helper->dpms_mode only when drm_client_modeset_dpms() returns 0
would avoid latching a failed blank request.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/875wx7rfwp.fsf@gnu.org?part=1

       reply	other threads:[~2026-12-05 14:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <875wx7rfwp.fsf@gnu.org>
2026-12-05 14:31 ` sashiko-bot [this message]
2026-12-05 16:40   ` [PATCH] drm/fb-helper: Keep blanked outputs off across restore and hotplug Anush V

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=sashiko-outbox-251630@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=j@gnu.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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