dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Angelo Compagnucci" <angelo.compagnucci@gmail.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/fbdev-dma: Copy the shadow buffer on unblank
Date: Sat, 14 Nov 2026 16:38:13 +0000	[thread overview]
Message-ID: <sashiko-outbox-214768@kernel.org> (raw)
In-Reply-To: <20261113110708.927665-1-angelo.compagnucci@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/fbdev-dma: sleeping lock in
  drm_fbdev_dma_shadowed_fb_blank() on oops
- [Low] drm/fbdev-dma: missing Fixes trailer for shadow buffer unblank
  fix
--

commit a63597b4af664e3cb6d1b39bfd1dd1e573a6fdb2
Author: Angelo Compagnucci <angelo.compagnucci@gmail.com>

> drm/fbdev-dma: Copy the shadow buffer on unblank
>
> With a shadow buffer, what userspace draws in fbdev reaches the
> framebuffer memory only when the damage worker runs. Turning the display
> on shows the framebuffer memory as it is. So a program that draws its
> first picture and then unblanks, such as a boot splash, shows an older
> picture for a moment.
>
> Seen on an ILI9341 panel (tinydrm ili9341): enabling the pipe sends the
> whole framebuffer memory to the panel, still black, and the splash only
> replaces it once the damage worker runs.
>
> Nothing can be flushed to a display that is off. But the copy from the
> shadow buffer into the framebuffer memory does not need the display. On
> unblank, copy the whole shadow buffer into the framebuffer memory before
> turning the display on. The damage worker still flushes the damage once
> the display is on.
>
> Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>

[Severity: Low]
This fixes a bug introduced with shadow buffering.  Should the commit
message include a Fixes tag?

  Fixes: 360399643299 ("drm/fbdev-dma: Add shadow buffering for deferred I/O")

> diff --git a/drivers/gpu/drm/drm_fbdev_dma.c b/drivers/gpu/drm/drm_fbdev_dma.c
> index 452f844003504..cc8813538bd90 100644
> --- a/drivers/gpu/drm/drm_fbdev_dma.c
> +++ b/drivers/gpu/drm/drm_fbdev_dma.c

[ ... ]

> @@ -196,6 +187,41 @@ static const struct drm_fb_helper_funcs drm_fbdev_dma_helper_funcs = {
>   * struct drm_fb_helper
>   */
>  
> +static int drm_fbdev_dma_shadowed_fb_blank(int blank, struct fb_info *info)
> +{
> +	struct drm_fb_helper *fb_helper = info->par;
> +	struct drm_clip_rect clip = {
> +		.x2 = fb_helper->fb->width,
> +		.y2 = fb_helper->fb->height,
> +	};
> +
> +	/*
> +	 * Turning the display on shows the framebuffer memory. Copy the
> +	 * shadow buffer into it first, so it holds what was drawn. This
> +	 * does not need the display; the damage worker still flushes the
> +	 * damage once the display is on.
> +	 */
> +	if (blank == FB_BLANK_UNBLANK)
> +		drm_fbdev_dma_damage_blit(fb_helper, &clip);
> +
> +	return drm_fb_helper_blank(blank, info);
> +}

[Severity: Medium]
Can calling drm_fbdev_dma_damage_blit() before checking oops_in_progress
sleep in atomic context or deadlock during an oops or panic?

When the VT console is blanked during an oops or panic, bust_spinlocks(0)
and panic() call console_unblank() -> ... -> fb_blank(info,
FB_BLANK_UNBLANK) with oops_in_progress set and interrupts disabled.
drm_fb_helper_blank() guards against this at entry:

drivers/gpu/drm/clients/drm_fbdev_helper.c:drm_fb_helper_blank() {
	if (oops_in_progress)
		return -EBUSY;
    ...
}

Calling drm_fbdev_dma_damage_blit() before reaching that check
unconditionally acquires the sleeping mutex fb_helper->lock, which sleeps in
atomic context and can deadlock if the crashing context or a stopped CPU
already holds fb_helper->lock.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261113110708.927665-1-angelo.compagnucci@gmail.com?part=1

  reply	other threads:[~2026-11-14 16:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  9:16 [PATCH] drm/fb-helper: flush damage before unblanking Angelo Compagnucci
2026-11-13  9:03 ` Thomas Zimmermann
2026-11-13 11:07 ` [PATCH v2] drm/fbdev-dma: Copy the shadow buffer on unblank Angelo Compagnucci
2026-11-14 16:38   ` sashiko-bot [this message]
2026-11-14 20:13   ` [PATCH v3] " Angelo Compagnucci
2026-11-16  9:11     ` sashiko-bot
2026-11-16  7:48   ` [PATCH v2] " Thomas Zimmermann
2026-11-16 15:20     ` Angelo Compagnucci

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-214768@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=angelo.compagnucci@gmail.com \
    --cc=dri-devel@lists.freedesktop.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